How to build a Linux kernel
Jump to navigation
Jump to search
{{#if: This page is out of date!|
}}![]() | This page is out of date! |
}}
- Make a boot disk in case the boot loader gets screwed up. Insert a floppy and type
/sbin/mkbootdisk `uname -r`
- Choose an appropriate kernel identifier. For this example, we use "-test".
- Obtain kernel source, unpack it to
/usr/src/
and append "-test" to the directory name, e.g./usr/src/linux-2.4.21-test
. We'll refer to this as the "source" directory. cd to the source directory.
- Edit the
EXTRAVERSION
variable in theMakefile
in the source directory to add a custom descriptor to the kernel version.
- If a
.config
file exists and you care about it, back it up now. Run
make mrproper
to clean out the source tree, returning it to a pristine state. This deletes the .config
file.
- Copy an appropriate config to
.config
in the source directory. This will serve as a base for configuration.
- Run
make menuconfig
(or "make xconfig
" under X Windows) to configure the kernel. This will overwrite the .config
file.
- Now run through these steps in order:
make dep make clean make bzImage make modules make modules_install make install
This last command installs the new kernel to the boot loader.
Troubleshooting
Kernel panic: VFS : Unable to mount root fs on 00:00
May need to replace "root=LABEL=/
" with "root=/dev/hda2
" in grub.conf
.