# [SOLVED] Kernel Upgrade Question

## Anquietas

Hello again  :Smile: 

I have a question... 

On on of my Servers is a P III (Coppermine), 700 MHz Intel Processor and 512 SDRAM .

I've installed gentoo on it when the kernel in the portage was 2.6.24-r8 , and now I've downloaded 2.6.25-r7 ...

I've installed the new kernel with the command: "genkernel --menuconfig --botloader=grub --no-clean all" ... because I wanted to spear time....

But now, when I'm booting that system, the Modules are not loading... only 1 SCSI module... I can't start my lan card, etc...

I supose I could try without the "--no-clean" option.. this way it recompiles the kernel from scratch.. but takes a loooooooot of time on my sistem... 3 Hours...

I have multiple questions:

1. Why does the new kernel not load the modules like the old kernel ?

2. If there is no other solution, than to install from scratch, can you tell me some method of Speeding up a little bit ?..s every time a new kernel is released....  :Neutral: .. Last time I waited 3 hours for the kernel to install for the first time... it's painfull to wait 3 hour

3. And isn't there a method of preserving the configuration from old kernel without acctualy saving ".config" file.. because I heard somewhere that it is not healthy, specially on significant version updates.... 

Please help with an advice or solution... It's painfull to configure the kernel and wait 3 hours everytime a tiny version of the Kernel is released, and on 3 servers I supervise...Last edited by Anquietas on Thu Aug 07, 2008 2:23 pm; edited 1 time in total

----------

## nixnut

Moved from Installing Gentoo to Kernel & Hardware.

kernel question, so moved here.

----------

## NeddySeagoon

Anquietas,

You probably don't want to hear this but I will tell it anyway.

If you do a manual kernel configuration and leave out all the unneeded things that genkernel makes for you, you should be around about 30 minutes, maybe less to build your kernel. The first time you do a manual kernel config, it will take you several hours but once you have a config that works, migrating it to new kernel versions is mostly painless.

Kernels and modules both contain a string called version magic that describes key configuration and build parameters. IF they don't match, the kernel will not load the module. A part of the version magic is the kernel version, so you cannot load modules intended for a different kernel.

The first time you make a new kernel, there are no .o or .ko files for make to reuse, so it takes as long as it takes. How long that is depends on the kernel options. When you come to do changes, make reuses what it can. It still visits every node but it will mostly compare the timestamps on the .o files with the timestamps on the source files and find that the .o file is newer, so there is nothing to do.

This post outlines the process for rolling your own kernel.

After you have a lean mean .config file, you can normally migrate it to a new kernel in under 10 minutes.

If you want to go down this route, start with a clean kernel tree with no .config file, so you start with kernel defualts.

----------

## Anquietas

ok... I understood... something... I'm not quite an expert on linux kernel, I have a medium knowledge of Linux.... I've installed Gentoo 7 days ago...  :Neutral: 

OK, I will ask you to write down the steps just like for a newbie please:

So, I have the old Kernel (2.6.24-r :Cool:  working perfectly and I've downloaded the new Kernel (2.6.25-r7).

Please tell me how to use Genkernel (genkernel --....) in order to:

      1. KEEP the actual config (I supose the .config) file

      2. install in 30 minutes or so

      3. All the Modules to be loaded just like in the old Kernel

Thank you and sorry, but I know average Linux things, I'm not quite an expert on Linux Kernel installations  :Smile: 

----------

## NeddySeagoon

Anquietas,

You cannot do what you want every time however you make the kernel.

Keeping the build time down depends on you not Genkernel making the .config file. There is some learning for you for this but it pays back very quickly.

I have never used genkernel but I've seen the .config files it makes. It takes a scattergun approach so it builds many modules you don't need.

First, get a clean kernel tree. You can clean one you have, or get a later one, which will be clean anyway.

Go into (cd into) this kernel tree and run make xconfig (make menuconfig works too) so you can see the kernel context sensitive help.

Work you way through each and every option, setting options as follows.

Set <*> for things you need to boot the system

Set <M> for things you will need after booting

Set < > for things you do not need  

Some examples. 

<*> for your root filesystem type and the hardware options needed for the kernel to control your hard drive

<M> for your network card(s), sound, USB and so on.

< > for all the sound cards you do not own, IDSN, Firewire and other things you don't have.

Use of < > often turns off whole menus, so you have less options to review.

Save your config under the default name and run 

```
make

make modules_install
```

This will build all your selected options and will be a lot less than 3 hours. There are no old files to reuse yet as this is the first time you have run make on this kernel.

mount /boot and copy the kernel over, giving it a new name. Nobodies first kernel works so do not overwrite your old kernel.

Make a new entry in grub.conf to boot the new kernel. NB. It will not want an initrd line.

You can use my one year old Browsable Gentoo Install for hints. Its an image of my P3 600MHz laptop install. The kernel .config files are there but you will have to ask for them by name as Apache does not show filenames starting with a dot

How do you know what options to select ?

lspci will identify your hardware. Post it here if you cannot find the kernel options.

After you have your first kernel, adjusting it is much faster as you only need a few options and apart from a few rare changes, only the changes are compiled.

A word of warning ... never edit the .config file directly. Many menuconfig choices set 3 or more flags and getting things in a mess with manual edits means starting again.

----------

## Anquietas

Well, I've managed to upgrade my Kernel manually, indeed it compiles more faster...

So than, I am convinced... manual Kernel upgrade is way better than Genkernel  :Smile: 

All I had to do is:

emerge gentoo-sources

verify that the symlink /usr/src/linux points to the newest kernel

cd /usr/src/linux

make clean

make mrproper

make menuconfig (here I marked everything I needed)

make && make modules_install

cp arch/i386/boot/bzImage /boot/kernel.......

find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko' >> /etc/modules.autoload.d/kernel-2.6 (and I left only the module name that I wish to be loaded)

and I've modified the grub.conf to load the new kernel...

All these tasks took me 15 minutes !, with a cleaned up new kernel and everything is working perfectly... I supose, .... I did not find any problems.

I want you to:

1. confirm me if I've done it correctly, `cause if yes, then Manual Kernel compile is my solution for kernels for my entire life. 15 minutes is WAY WAY better than 3 hours with genkernel...

2. tell me please which is the difference in the fact that with the new kernel, I've used root=/dev/hda3 directly, and not the Initram... file

3. In the future, when I shall make upgrades, will this method of installing do ?... even with the "make clean", everything clean, it took me 15 minutes which is wonderfull, is there a point in saving an older configuration ? or if it just took me 15 minutes then I can configure it manually everytime and use a clean configuration...

----------

## NeddySeagoon

Anquietas,

You do not need to do 

```
make mrproper
```

 ever. It removes everything from the kernel tree, including saved config files.

That make target is intended for kernel developers.

```
make clean
```

is only needed when you have changed something fundamental, like 4KSTACKS, SMP support (and a few others) that affect the way everything is compiled. Its also needed when you upgrade gcc.

The find step to add modules to /etc/modules.autoload.d/kernel-2.6 is rarely needed. Between them, kernel module autoloading, udev and /etc/modules.d/* load almost everything automatically. For me, the only thing I need in /etc/modules.autoload.d/kernel-2.6 is my network card.

Your steps are exactly right - the above may help you shave off another minute or two.

The initram file is a fake root filesystem loaded into RAM by grub. Its required by genkernel kernels as genkernel makes a completely modular kernel.

Even the modules needed to control your hard drive and read the real root filesystem are modules. This is a problem as kernel modules live in /lib/modules which is on the root filesystem. However, until you can read the hard drive and mount root, you can't load the modules needed to read the hard drive and mount root. To get around this, initrd support allows the kernel to read this fake root filesystem in RAM, so it can load the modules to mount the real_root from there.

Provided these modules are built into the kernel, the kernel has all it needs to mount root without any other code, thus no initrd is needed

You can migrate .config files to newer kernels by copying the .config over and running 

```
make oldconfig
```

 in the new kernel tree.

make oldconfig discards options that have been removed, sets unchanged options as they were in the input .config file and asks you to choose settings for new options. Most of the time, this is the way to migrate to a new kernel.  Now and again, when there are big changes, make oldconfig gets it wrong and you have to use menuconfig to sort it all out.

Without doubt, this is the way to go. You are no longer building a lot of modules you will never need.

----------

## Anquietas

Thank you  :Smile: 

Tagging [SOLVED] prefix @ 1st Post's Title...

----------

