Gentoo: Upgrade the Linux Kernel

I have not updated my kernel for a while. As you can see, I will be updating from version 3.8.13-gentoo to version 3.10.7-gentoo-r1.

storm ~ # ls -la /usr/src
total 20
drwxr-xr-x  5 root root 4096 Oct  1 22:32 .
drwxr-xr-x 14 root root 4096 Aug 19 03:40 ..
-rw-r--r--  1 root root    0 Aug  1 04:16 .keep
lrwxrwxrwx  1 root root   19 Aug  6 05:40 linux -> linux-3.8.13-gentoo
drwxr-xr-x 24 root root 4096 Aug 22 22:22 linux-3.10.7-gentoo
drwxr-xr-x 24 root root 4096 Oct  1 22:33 linux-3.10.7-gentoo-r1
drwxr-xr-x 24 root root 4096 Aug 31 22:21 linux-3.8.13-gentoo
storm ~ # 

As I am skipping a couple of kernels, I will not attempt to use the old .config file with the new kernel.

Update the Kernel Symbolic Link

You can update the symbolic link a number of ways, see the official documentation for more information.

Using eselect

I prefer to use eselect as its quicker and easier. If you don’t already have it you will need to install it first.

emerge eselect

Once installed, list the available kernels with.

storm ~ # eselect kernel list
Available kernel symlink targets:
  [1]   linux-3.8.13-gentoo *
  [2]   linux-3.10.7-gentoo
  [3]   linux-3.10.7-gentoo-r1
storm ~ # 

Select the new kernel.

eselect kernel set 3

Then check with either.

storm ~ # eselect kernel list
Available kernel symlink targets:
  [1]   linux-3.8.13-gentoo
  [2]   linux-3.10.7-gentoo
  [3]   linux-3.10.7-gentoo-r1 *
storm ~ # 

Or.

storm ~ # ls -la /usr/src/linux
lrwxrwxrwx 1 root root 22 Oct 11 15:24 /usr/src/linux -> linux-3.10.7-gentoo-r1

Manually Update Symbolic Link

You can also just do it manually with.

cd /usr/src
ln -sfn linux-3.10.7-gentoo-r1 linux

The s option is to create the soft link, the f to force, and the n to treat link no differently than a normal directory.

Configure the New Kernel

Run menuconfig and make the relevant selection.

cd /usr/src/linux
make menuconfig

Link to required kernel options page

Compile and Install the New Kernel

cd /usr/src/linux
make && make modules_install
mount /boot
cp -v arch/x86_64/boot/bzImage /boot/kernel-3.10.7-gentoo-r1

Rebuilt initramfs Image and Grub Configuration

mount /boot
genkernel --lvm --mdadm initramfs
grub2-mkconfig -o /boot/grub/grub.cfg
reboot

And cross your fingers!

Resources

Gentoo.org: Gentoo Linux Kernel Upgrade Guide
http://www.gentoo.org/doc/en/kernel-upgrade.xml

Wiki.gentoo.org: Kernel/Upgrade
http://wiki.gentoo.org/wiki/Kernel/Upgrade

Negativesum.net: Gentoo Kernel Upgrade Guide
http://negativesum.net/tech/linux/gentoo/kernel

Be the first to comment

Leave a Reply