Short guide to build kernel == Default basic build == {{{ wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.24.tar.bz2 tar xjf linux-2.6.24.tar.bz2 cd linux-2.6.24 make defconfig make all sudo make modules_install install }}} == Download Using a Distribution Kernel Source Code Package == The method of downloading the package will vary according to the distribution you are using, so you're pretty much on your own there. Note that the source code will probably be placed in a sub-directory under /usr/src. When using this method you need to be very careful that your newly compiled kernel won't overwrite the existing one (or you might not be able to boot any more...). Most distributions keep the two separately, but you need to understand how your system boots, and how kernels are selected before going too far down this route. == Download Using Git == Git is the source code control system used in the kernel. You need to download and install it. Next you need to choose a repository. The different kernel repositories are listed at http://git.kernel.org/. Most new developers will be contributing to an existing project, so the best way to find out which is the correct repository is to go to the home page for that project, and look there. == Compile == === Configure the Kernel === You need to update the .config file in the root of your kernel tree to specify which facilities/drivers are built into the kernel. If you have used your distribution's source code distribution then it may have come with a suitably configured .configure. Alternatively there may be a suitable configure file in /boot that you can use with {{{ cp /boot/config-`uname -r` .config make oldconfig }}} If you're using a tarball, or git to get the source code, then using an old .config file is a bit risky as it may not have all the new options defined for the new version of the kernel. You probably need to fall back on editing whatever .config came with your sourcode using either {{{make xconfig}}} or {{{make gconfig}}} depending on which one runs on your system. If you are running on a system with a SATA interface disk, then the default kernel configuration probably won't build. You'll need to convert some device drivers from modules to being compiled into the kernel. === Configure the Boot System === You need to configure your boot system to make the new kernel one of the options. You probably don't want it to be the default at this stage. ==== Grub ==== The build should have installed the kernel in /boot and told you what it's called. If you're using grub, you now need to edit /boot/grub/menu.lst to add it to the list of possible kernels to boot from. You need an entry something like: {{{ title My development kernel root /dev/sda1 kernel /boot/vmlinuz-2.6.24-rc3 root=/dev/sda1 ro }}} root=UUID options don't seem to work at this stage. On Debian based systems, running {{{update-grub}}} regenerates the grub configuration based on kernels found in /boot. == more == * '''Linux Kernel in a Nutshell''' by Greg Kroah-Hartman, http://www.kroah.com/lkn/, online: [http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/ html] * [http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html Kernel Rebuild Guide], Kwan Lowe, 2004 * in Debian * [http://www.debian.org/doc/FAQ/ch-kernel.en.html Debian and the kernel, FAQ] * [http://www.debian.org/doc/manuals/reference/ch-kernel.en.html The Linux kernel under Debian, Reference] * http://kernel-handbook.alioth.debian.org/