# Towards a leaner and smaller kernel

## rahulthewall

The topic might sound a bit ambitious but all I am trying to do here is configure the smallest possible kernel that I can boot up with and that still works with all my hardware. The kernel that I have is also self configured and it is quite minimalistic, yet I want to reduce it further.

So, my first couple of questions.

Which scheduler to use? (Am currently on deadline)

What are these three options?

/dev/cpu/microcode

/dev/cpu/*/msr

/dev/cpu/*/cpuid

Processor that I have

Intel T2300

----------

## gringo

there are some things you can do to achieve this :

- instruct the compiler to build the kernel with -Os ( optimize the kernel for size option or something like that).

- there is a embedded submenu where you can disable some kernel features you may not need ( triple check the help of each option).

- there are also the -tiny patches which aggressivly strip out several kernel features to make the kernel as tiny as possible. ( as above if you play with this, triplecheck the help menu of each option, these ones may be risky - it´s not designed for desktop users).

- modularize your kernel as much as possible - nowadays udev does a pretty cool job detecting / loading drivers for your hardware (although enabling module loading is considered a security hole by many).

and probably more things i don´t remember right now.

And remember : a tiny kernel won´t give you any noticeable benefits (unless space on disk is a problem for you of course).

 *Quote:*   

> Which scheduler to use? (Am currently on deadline) 

 

i´m using cfq, the default one.

 *Quote:*   

> /dev/cpu/microcode
> 
> /dev/cpu/*/msr
> 
> /dev/cpu/*/cpuid 

 

nothing fancy, for the first option http://gentoo-wiki.com/HARDWARE_Intel_Microcode , don´t know about the others, check the help menu.

cheers

----------

## rahulthewall

@ gringo, thanks for the information about the microcode.

Now my next question, are all these needed on my Intel Machine.

```

Intel HW Random Number Generator Support

AMD HW Random Number Generator Support

VIA HW Random Number Generator Support

```

And what exactly is /dev/nvram useful for?

----------

## alex.blackbit

there are several things in the kernel where it is not so easy to say whether you really need them or not.

i hope you will never need  /dev/nvram.

a hardware random number generator is just a nice thing to have. if you don't have one, pseudo random numbers can be generated in software, but of course that's a question of quality and speed. if you have such a hardware feature, why not use it to save 15k in kernel size?

----------

## gringo

 *Quote:*   

> there are several things in the kernel where it is not so easy to say whether you really need them or not. 

 

yes, of course, it´s a question of time and trying several configurations till you find out wth this damn option does. 

Just be sure to have support to boot from the media where your os is installed, other drivers can probably be built as a modules. Standard features have to either built in or not.

 *Quote:*   

> i hope you will never need /dev/nvram.

 

lol, i hope so too  :Razz: 

It´s used to acces non-volatile ram ( iow, the bios), mainly stuff for those who know exactly what they are doing.

cheers

----------

## peje

but nvram is very usefull to wake up the pc see nvram-wakeup

cu peje

----------

## rahulthewall

 *peje wrote:*   

> but nvram is very usefull to wake up the pc see nvram-wakeup
> 
> cu peje

 

Looks interesting.

----------

## toralf

 *alex.blackbit wrote:*   

> i hope you will never need  /dev/nvram.

 ?!

It is helpful to see graphic response while pressing <Fn>+<F?> keys - at least at a ThinkPad.

----------

