How To Compile A Kernel - The Mandriva Way - Page 2
5 Build The Kernel
To build the kernel, simply execute this command:
Now be patient, the kernel compilation can take some hours, depending on your kernel configuration and your processor speed.
6 Install The New Kernel
After the successful kernel build, a src.rpm and an rpm package have been created. The src.rpm package can be found in the /usr/src/rpm/SRPMS/ directory, you can find out about its name by running
ls -l /usr/src/rpm/SRPMS/
On my system it was called kernel-18.104.22.168default-1.src.rpm.
The rpm package can be found in /usr/src/rpm/RPMS/i386/, /usr/src/rpm/RPMS/i586/, /usr/src/rpm/RPMS/i686/, /usr/src/rpm/RPMS/x86_64/, etc., depending on your architecture. On my system it was located in /usr/src/rpm/RPMS/i386/, and by running
ls -l /usr/src/rpm/RPMS/i386/
I found out that its name was kernel-22.214.171.124default-1.i386.rpm.
Now we can install our kernel rpm package like this:
You can now even transfer the kernel rpm package to other Mandriva systems and install it there exactly the same way, which means you don't have to compile the kernel there again.
Next we create a ramdisk for our new kernel, because otherwise the system will most likely not boot our new kernel:
mkinitrd /boot/initrd-126.96.36.199-default.img 188.8.131.52-default
7 Configure The LILO Boot Loader
Now we must configure our LILO boot loader so that our new kernels gets booted when we restart the system.
ls -l /boot
to find out about your new kernel (typically begins with vmlinuz, e.g. vmlinuz-184.108.40.206-default) and ramdisk (typically begins with initrd, e.g. initrd-220.127.116.11-default.img).
Then edit /etc/lilo.conf. Have a look at your existing (working) kernel stanzas there and take one of them as a sample for your new stanza and replace the kernel and ramdisk, then add the stanza above all other stanzas. Make sure you specify a unique name for that kernel in the label line (e.g. linux-18.104.22.168-default) and specify exactly the same name in the default line so that the kernel gets booted when you restart the system.
For example, my lilo.conf looks like this before I add the new stanza:
and like this afterwards (keep in mind what I said about the label and default lines):
Now reboot the system:
shutdown -r now
If everything goes well, it should come up with the new kernel. You can check if it's really using your new kernel by running
This should display something like
If the system doesn't start, restart it, and when you come to the LILO boot loader menu, select your old kernel and start the system:
You can now try again to compile a working kernel. Don't forget to remove the stanza of the not-working kernel from /etc/lilo.conf, and make sure you run
after modifying /etc/lilo.conf.