2009年7月5日

Build your own kernel

The following instructions were done under ubuntu 8.04 with kernel source linux-2.6.30.1

1. Download the linux kernel source and extract it.

2. cd to the source dir and then configure the kernel
$ make menuconfig
3. Compile the kernel
$ make bzImage
4. Compile the modules
$ make modules
5. Install the moudles and you will see a new dir added in /lib/modules
$ sudo make modules_install
6. Make initrd. In ubuntu, use mkinitramfs instead of mkinitrd. Remember to specify the correct version of you kernel
$ sudo mkinitramfs -o /boot/initrd.img-2.6.30-1-asdone 2.6.30.1
7. Copy the image to /boot
$ sudo cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.30-1-asdone
8. Copy System.map to /boot
$ sudo cp System.map /boot/System.map-2.6.30-1-asdone
9. Edit grub menu.list
$ sudo vim /boot/grub/menu.lst
10. Add the new entry(The following lines are just for reference)
title Ubuntu 8.04.3 LTS, kernel 2.6.30-1-asdone
root (hd0,1)
kernel /boot/vmlinuz-2.6.30-1-asdone root=UUID=6da83f15-6ea3-4072-beee-4c6de3e7d98e ro quiet splash
initrd /boot/initrd.img-2.6.30-1-asdone
quiet

11. Restart. If, unfortunatelly, some errors happen, there must be some problem with the kernel config. Just Google it for solution.

沒有留言: