How to build a kernel

Start by getting the kernel source. Unpack the source tarball in /usr/src and make a symlink from /usr/src/linux pointing to the newly created source directory /usr/src/linux-x.y.zz.

Configure the kernel using make xconfig or make menuconfig.


Now, the old way to do it is to run

make dep && make clean && make bzImage && make modules && make modules_install

The newly created kernel (bzImage) has to be copied to /boot; also create a symlink in the root:

cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-x.y.zz
ln -s /boot/vmlinuz-x.y.zz /vmlinuz

After this, check your /etc/lilo.conf and run lilo.


The new way to do all this is using the "kernel-package"-package.

Then, all you have to do after the kernel configuration is:

make-kpkg kernel_image

You can use the option --append-to-version=.yymmdd to create a unique kernel name in order to prevent conflicts.

This command creates a .deb file in /usr/src. Use dpkg to install this file:

dpkg -i kernel-image-x.y.zz_10.00.Custom_i386.deb

You will be asked if you want to create a boot disk and if you want to run lilo. Make sure your /etc/lilo.conf is up-to-date and run lilo.

The final step is to reboot the system.


For more details check out the info at http://newbiedoc.sourceforge.net/system/kernel-pkg.html

LinuxHowto/BuildKernel (last edited 2008-02-10 16:44:52 by localhost)