The kernel learning notes, since it is a note to remember the key things, assorted slowly again. Here are a few simple steps to compile the kernel:
1. Go to www.kernel.org download kernel
2. mkdir/usr/src/linux-2.6.37
CP 2.6.37.tar.bz2/usr/src/linux-2.6.37 (just out)
3. The solution compresses the other situation not to consider, the concrete question concrete analysis
TAR-JXVF 2.6.37.tar.bz2
/////////////////////////////////
The following role is to update the header file, to prevent future you write the driver when the header file and the kernel inconsistent phenomenon ...
Link/usr/include/asm,/usr/inlude/linux,/USR/INCLUDE/SCSI to the corresponding directory in the/usr/src/linux/include directory.
# Cd/usr/include
# RM-RF ASM Linux
# ln-s/usr/src/linux/include/asm-i386 ASM
# ln-s/usr/src/linux/include/linux Linux
# ln-s/USR/SRC/LINUX/INCLUDE/SCSI SCSI
/////////////////////////////////
4. Deletes the remaining. o files and other subordinate files in the source code directory.
Make Mrproper
5. Start compiling the kernel here, do some configuration.
Make menuconfig or make config or make Xconfig
I'm using Ubuntu 10.04, I need to install something with make menuconfig.
<!--@page {margin:0.79in} P {margin-bottom:0.08in}-->
sudo apt-get install build-essential
sudo apt-get install libncurses5
sudo apt-get install Libncurses5-dev
6. To establish the dependent files required at compile time
Make DEP
7. Clear the target file for kernel compilation
Make clean
8. Compiling the kernel
Make Zimage
The default here is that the compiled kernel size is within 640KB, and if more is used, make Bzimage
9. To compile a loadable module
If users set up loadable modules when they configure the kernel, these modules need to be compiled so that they can be loaded later using the Insmod command.
Make modules
Make Modelus_install
10. The above steps have completed the kernel of the compilation work, haha. The following is how to apply the new kernel to your system.
Cp/usr/src/linux-2.4.22/system.map/boot/system.map
Vmlinuz instead of compiling the good one in/usr/src/linux/arch/x86/bzimage
Cp/usr/src/linux/arch/x86/bzimage/boot/vmlinuz
The startup item and what's going to change.
/boot/grub/grub.cfg
///////////////////////////////////////////////
Menuentry ' Ubuntu, with Linux 2.6.37 '--class ubuntu--class gnu-linux--class GNU--class os {
Recordfail
Insmod ext2
Set root= ' (hd0,10) '
Search--no-floppy--fs-uuid--set 886aea56-c98a-4b80-a0e3-026900d0b720
linux/boot/vmlinuz-2.6.37 root=uuid=886aea56-c98a-4b80-a0e3-026900d0b720 ro Quiet Splash
Initrd/boot/initrd.img-2.6.32-24-generic
}
///////////////////////////////////////////////
Make install it is said that this is the end, but I dare not oh, the core broke two times after I am very careful, do not dare to mess up. Let's just step by step, really.
The above operation is estimated to be one or two hours, the compilation is slow ...
Reboot problem, there are two errors when starting, the concrete is not very clear, basically the problem initrd.img,
Follow-up will continue to study it
Reference:
Http://www.chinaunix.net/jh/4/208791.html
Http://blog.csdn.net/cdsnmdl/archive/2009/02/22/3922513.aspx