Download kernel:https://www.kernel.org/
Download busybox:http://www.busybox.net/
Download the home directory unzip the source package into the/USR/SRC directory:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/58/DD/wKioL1S_OpiyTB68AAFqnOEhtZo705.jpg "title=" 1.png " Style= "Float:none;" alt= "wkiol1s_opiytb68aafqnoehtzo705.jpg"/>
to create a soft connection in the /usr/src directory:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/58/E0/wKiom1S_OcSCtOZbAAGJEsuk4oU918.jpg "title=" 2.png " Style= "Float:none;" alt= "wkiom1s_ocsctozbaagjesuk4ou918.jpg"/>
Prepare the compilation environment:
Yum Install package group "Serverplatform development" and "Development tools"
Yum Groupinstall "Server Platform Development" "Development tools"
Execute make Allnoconfig in the Linux directory to clear all kernel options and then execute make Menuconfig
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/58/DD/wKioL1S_OpvTi2sAAAFB6C-fKpg385.jpg "title=" 3.png " Style= "Float:none;" alt= "wkiol1s_opvti2saaafb6c-fkpg385.jpg"/>
after opening the configuration interface according to your own hardware to choose the appropriate driver, to support the CPU, support multi-threading, support SCSI interface, support file system, support TCP/IP protocol stack, support keyboard and other linear devices, Choose according to your own needs.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/58/E0/wKiom1S_OcnjtJQwAALpKYgawJ4872.jpg "title=" 4.png " Style= "Float:none;" alt= "wkiom1s_ocnjtjqwaalpkygawj4872.jpg"/>
Select OK to save exit, execute makebzimage compile kernel available –j # turn on multi-line compilation faster
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/58/DD/wKioL1S_OqChjf06AALgEAbqlQY960.jpg "title=" 5.png " Style= "Float:none;" alt= "wkiol1s_oqchjf06aalgeabqlqy960.jpg"/>
compile busybox:
Cd/usr/src/busybox
Make Menuconfig
Enter the configuration interface selected Busybox Settings--->build Options---> buildbusybox as a static binary (no shared libs)
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/58/E0/wKiom1S_Oc-ifZWUAAJt14vOouo494.jpg "title=" 6.png " Style= "Float:none;" alt= "wkiom1s_oc-ifzwuaajt14voouo494.jpg"/>
The remaining options can be maintained by default.
Yum install glibc-static Pack
Yuminstall glibc-static then perform make compilation BusyBox
prepare the second hard drive and put the compiled kernel and busybox into the specified directory
The second drive is divided into two zones to make Ext4 file systems and mount them under/mnt/boot and /mnt/sysroot :
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/58/DD/wKioL1S_OqaQAY3TAAI-aLmrN5Q170.jpg "title=" 7.png " Style= "Float:none;" alt= "wkiol1s_oqaqay3taai-almrn5q170.jpg"/>
Mkfs-t ext4/dev/sdb1 Creating a file system
Mkfs-t ext4/dev/sdb2 Creating a file system
Mkdir/mnt/boot Creating a directory
Mkdir/mnt/sysroot Creating a directory
Mount/dev/sdb1/mnt/boot Mount Partition 1
Mount/dev/sdb2/mnt/sysroot Mount Partition 2
to create grub for the second hard drive :
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/58/E0/wKiom1S_OdKxyT3EAAFe3ddAiJ0738.jpg "title=" 8.png " Style= "Float:none;" alt= "wkiom1s_odkxyt3eaafe3ddaij0738.jpg"/>
Copy the kernel to /dev/sdb1,busybox copy to /dev/sdb2 and create the necessary directories
Cp/usr/src/linux/arch/x86/boot/bzimage/mnt/boot
cp/usr/src/busybox/_install/*/mnt/sysroot
Create a grub.conf file
Vim/mnt/boot/grub/grub.conf
The contents are as follows:
Default=0
Timeout=5
Title Mylinux
Root (hd0,0)
Kernel/bzimage ro Root=/dev/sda2init=/sbin/init
Create a inittab file vim/mnt/sysroot/etc/inittab
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/58/DD/wKioL1S_OqyBLAZIAABNgbIsZ18130.jpg "title=" 10.png "Style=" Float:none; "alt=" wkiol1s_oqyblaziaabngbisz18130.jpg "/>
Create a rc.sysinit file vim/mnt/sysroot/etc/rc.d/rc.sysinit
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/58/E0/wKiom1S_OdbgcAZ3AADfiCmCOE0974.jpg "title=" 9.png " Style= "Float:none;" alt= "wkiom1s_odbgcaz3aadficmcoe0974.jpg"/>
Customizing the Linux kernel and compiling busybox