Making a Custom Kernel
- Why compile?
- Customization
- Remove bloat
- Getting the kernel source
- Full source tarball
- Patches
- Installing the source
- For the full tarball:
# cd /usr/src
# rm linux
# tar -zxvf linux-2.2.12.tar.gz
# mv linux linux-2.2.12 ; ln -s linux linux-2.2.12
- For a patch:
- You need every incremental patch between your current kernel and your target kernel
- For a compressed patch:
# cd /usr/src
# zcat patch.gz | patch -p1
- For an uncompressed patch:
# cd /usr/src
# patch -p1 < patch.diff
- Configuring the kernel
- Three different ways to configure the kernel:
make config -- text-based Q&A-style configuration
make menuconfig -- ncurses-based configuration
make xconfig -- X-based configuration
- Building the kernel
# make clean
# make dep
# make [zImage|bzImage|zlilo|bzlilo|zdisk|bzdisk]
- Modules
# make modules modules_install
- using modules
- why modules?
- Installing the new kernel with LILO
- Copy the new kernel to /boot:
# cp /usr/src/linux/arch/i386/boot/vmlinux /boot/vmlinuz-2.2.12
- Edit /etc/lilo.conf:
- Edit the stanza for the old kerel, to change the label name from linux to something else. I prefer to label the current kernel as "linux", and label previous kernels with their version number, ie "linux-2.2.5"
- Add a new stanza for the new kernel:
image = /boot/vmlinux-2.2.12
label = linux
- Run
/sbin/lilo -v to reinstall lilo with the new settings
- Reboot the machine (
# shutdown -r now) to use the new kernel