Building Your Own Linux Kernel, part 1 - page 2
Configure and Build
Configure and build
Once you have a .config file in place from an older kernel, you need to update it for anything that's changed in the latest version.
Once you finally make it through make oldconfig, you're ready to build. That part is easy:
$ make -j4 && sudo make modules_installAdjust the -j4 according to the number of processors you have; see the Linux Planet article on multi-core machines for more details.
Install and boot
When the build finishes, your new kernel will be in arch/i386/boot/bzImage. As root, copy it into /boot, but give it a suitable filename:
$ sudo cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.31
With the new kernel in place, you need to add it to the list grub shows you at boot time. (If you use a boot loader other than grub, you're on your own.)
Grub's list of kernels is normally in /boot/grub/menu.lst. Edit that file, skip past pages of comments and look for the first "boot stanza", which will look something like this:
title Ubuntu jaunty, kernel 2.6.28-11-generic root (hd0,3) kernel /boot/vmlinuz-2.6.28-11-generic root=UUID=c8253db2-ac0b-4664-9e3c-837ce469a95d ro quiet splash initrd /boot/initrd.img-2.6.28-11-generic
Make a copy of that. The copy can go either before or after the original. If you put your new one first, it will become the default boot line the next time you boot. If not, you'll have to use the arrow key to choose it in the grub menu (Figure 2).
Replace the title with anything you want, and the filename in the kernel line with your new kernel. So your new boot stanza might look like this (changed sections in bold):
title Ubuntu jaunty with my new 2.6.31 kernel root (hd0,3) kernel /boot/vmlinuz-2.6.31 root=UUID=c8253db2-ac0b-4664-9e3c-837ce469a95d ro quiet splash initrd /boot/initrd.img-2.6.28-11-generic
You may notice that the initrd line still refers to the old kernel version, 2.6.28-11. That's okay -- the initrd is used only while booting. You'll see in a future article how to make your own initrd, and what details like the "AUTOMAGIC KERNELS LIST" in menu.lst means, as well as how to make custom kernel configurations that will make your kernel both smaller and more efficient.
But for now, try booting into your new kernel!
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 2Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative
- 3Linux Top 3: Fedora, Ubuntu and Gluster Lose Community Leaders
- 4Red Hat Enterprise Linux 7 Finally Hits the Big Time
- 5Linux Top 3: Tails 1.0, OpenMandriva Lx 2014.0 and Debian 7.5