How to change or modify your Linux kernel under gentoo

Here’s a quick guide to upgrading or modifying your kernel under gentoo. I assume you have genkernel installed (do “emerge genkernel”).

First of all, if you only want to add or remove elements to your kernel, or change options, you can do this as root:

genkernel --no-clean --menuconfig all

Do your changes and reboot.

If you want to change kernel, then look under /usr/src. Suppose the source code of your new kernel is in /usr/src/newkernel, then do

genkernel --menuconfig --kerneldir=/usr/src/newkernel all

Configure your new kernel the way you like it. Then do

rm /usr/src/linux
ln -s /usr/src/newkernel /usr/src/linux

If you have nvidia (binary) drivers, do

emerge nvidia-glx nvidia-kernel

Finally, possibly after mounting /boot (“mount /boot”) edit /boot/grub/grub.conf, basically just changing the name of the kernel throughout. Reboot and you have a new kernel compiled to your needs for your machine.

If you think this is hard, think again! When was the last time you changed your Windows kernel? Adding stuff to the Windows kernel is relatively (too) easy, but so is it easy with gentoo (single command followed by a reboot) whereas actually changing your Windows kernel is not so easy and is typically only done when you upgrade all of Windows: a task better left to experts.

2 thoughts on “How to change or modify your Linux kernel under gentoo”

  1. Well, it’s a bit challenging.
    I can bring up my prism54 card with WEP well enough under the live CD
    (I position the firmware on a thumb drive, and copy the file to
    /usr/lib/hotplug/firmware/isl3890 after booting), but I have been beaten
    down trying to get genkernel to do the Right Thing for the PCMCIA subsystem.
    This is 2004.3, emerge gentoo-dev-sources, on a Dell D800.
    Thank you for your post, though: genkernel all is apparently too naive for
    my situation.
    The wireless card situation has all the appeal of a winmodem.
    I grasp that the manufacturers have various legal/business reasons for the
    ‘firmware’ nonsense (what a goofy euphemism), and I understand Linus has a
    Pontius Pilate policy about them, but I hope that the situation can evolve
    to the point that using this hardware under Linux isn’t such a flogging for a
    medium-weight geek like me.
    Party!

Leave a Reply

Your email address will not be published. Required fields are marked *