1. Configure the Environment
Operating system: CentOS 5.2
Download linux-2.6.18 version of kernel, URL: http://www.kernel.org
Description: The compiled document is suitable for 2.6. More than 18 of the Linux kernel version, only the compiled Linux kernel version can not be lower than the Linux operating system itself kernel version, otherwise you will encounter many problems;
2. Start compiling
- CP./linux-2.6.18.tar.gz/usr/src/
- TAR–ZXVF./linux-2.6.18.tar.gz
- cd/usr/src/linux-2.6.18
- All compiled build files are deleted the first time the compilation is executed
- Make Mrproper
- Using the System kernel configuration file (simplified configuration compilation)
- cp/boot/config-*./.config
- Make–j8 All
- Description: 8 in-j8 is the number of threads (faster compilation speed)
- Kernel configuration commands
Make Menuconfig (This is more commonly used)
Or make Xconfig: Graphical configuration, requires QT3
Or make Oldconfig: the existing. config is placed in the root of the source code after execution, in order to reuse the previous kernel compilation option configuration;
or make Config
- Installing the kernel module to/lib/modules
Make Modules_install
- Install the kernel binary image, build and install the boot initialization file system image file
Make install
- Vim/etc/grub.conf after seeing as shown can be;
- The following parameters are configured according to different optional configurations of the installed Linux system
Create a RAMDisk for the new kernel, or the system will not boot;
Mkinitrd/boot/initramfs-2.6.18.img 2.6.18
Start:
3, compile the problem summary
- Tip: Error not define Path_max ...
Workaround: (edit) vi/user/src/linux-2.6.18/scripts/mod/sumversion.c file, add header file # include <limits.h> recompile;
- Error tip:/user/bin/ld:cannot FIND–LC
Collect2:ld returned 1 exit status
Workaround: Yum Install glibc-static
Http://www.360doc.com/content/13/1117/19/9206388_330036790.shtml
- When you make Menuconfig, you are prompted:
Unable to find the ncurses libraries or the * * * Required header files. ' Make Menuconfig ' requires the ncurses libraries. Install ncurses (Ncurses-devel) and try again. MAKE[1]: * * * [Scripts/kconfig/dochecklxdialog] Error 1make: * * [Menuconfig] Error 2
Workaround:
Solve with yum install Ncursesyum install Ncurses-devel
Linux kernel Series (i) Compile and install the Linux kernel 2.6.18