# Kernel compilation

## ttre

I have questions about kernel.

Last kernel that I compiled was 4.9.6, and It was last week and it was first time since I have installed gentoo in spring 2016.

Now I see that emerge took gentoo sources 4.9.16, so I probably need to compile again.

1. How often is released new kernel version ?

2. Do I need to compile new kernel always ?

3. My size of kernel is 5282832 is it too big ?

4. I have netbook 1,6 GHz - one core and my kernel compile 10 hours - is not too long ?

----------

## NeddySeagoon

ttre,

You should update your kernel once every minor release. That's 4.x to 4.x+1.  Its about every 8 weeks.

Consider doing security updates as they happen, if you need the fixes. 

5.2Mb is  only part of your kernel. Thats the binary with all the built in modules.

The loadable modules are in /lib/modules.  They are a part of the kernel build.

You can save kernel compile time by removing things you will never need, in the menuconfig stage.

How you do that and what you can remove, depends on your hardware and how you build your kernel.

I have a netbook like that too.

----------

## ttre

I noticed that a lot of modules installation took a lot of time.

I wonder if there are parts in menuconfig level that I do not need in normal desktop using or if it need to be individual approach.

----------

## NeddySeagoon

ttre,

The kernel can almost drive all of the hardware made in the last 20 years, much of which is now forgotten.

You probably don't have much of that in your netbook.

----------

## nativemad

Hey ttre, 

You can actually disable most of the drivers and only enable what you need...

The good thing is that the kernel is quite good in finding out what it needs to be built/rebuilt after a config change!

So if you compile the kernel once and change the config, the next run will be quite quick as it only compiles the changes. 

This is the default with manual compilation and can be achieved with genkernel by adding --no-clean.

So don't be afraid of disabling stuff as long as you keep a rescue kernel that at least boots (either a different version or one with everything needed such as the disk built in and not as module... because modules get rewritten within the same version!   :Cool: 

Of course, also little core changes might affect all modules and take quite long to compile therefore..................

HTH, cheers

----------

## ttre

 *nativemad wrote:*   

> Hey ttre, 
> 
> You can actually disable most of the drivers and only enable what you need...
> 
> The good thing is that the kernel is quite good in finding out what it needs to be built/rebuilt after a config change!
> ...

 

ok, my last compilation seemed:

```

zcat /proc/config.gz > /usr/src/linux/.config

cd /usr/src/linux

cp .config ~/kernel-config-`uname -r`

make oldconfig && make && make modules_install install

genkernel --install initramfs

grub-mkconfig -o /boot/grub/grub.cfg

emerge --ask @module-rebuild
```

I think that using genkernel with --no-clean option it should be a little differently.

----------

## nativemad

 *Quote:*   

> genkernel --install initramfs 

 

No, you seem to use genkernel only to create the initramfsthat way!

 *Quote:*   

> make oldconfig && make && make modules_install install 

 

This is what takes ages, and there it shouldn't clear a previous compile run...

You can customize the kernel by running "make menuconfig" before the actual "make".

----------

## ttre

 *nativemad wrote:*   

> 
> 
> No, you seem to use genkernel only to create the initramfsthat way!

 

ok, I followed https://wiki.gentoo.org/wiki/Kernel/Upgrade

there is nothing about genkernel to use.

----------

