I. Linux configuration and compilation
Linux has the following advantages:
1. Clear temporary files, intermediate files, and configuration files
(1) make clean: delete most of the generated files, but keep the configuration file
(2) Make mrproper: delete all generated files and configuration files
(3) make distclean: Delete the patch and backup files of the editor based on make mrproper.
2. Determine the hardware and software configurations of the target system, such as the CPU type, network card model, and required network protocols.
3. Use one of the following commands to configure the kernel:
(1) make config: Interactive configuration based on text mode
(2) Make menuconfig: text-based menu configuration (recommended)
(3) make oldconfig: use the existing configuration file (. config ),
(4) Make xconfig: Graphical Configuration
After the configuration command is run, A. config file is generated under the root directory of the kernel source code.
Note: in actual application, we do not need to read all the configuration options one by one, but re-configure an existing configuration.
4. Compile the kernel:
I, (1) make zimage (2) Make bzimage
Difference: On the X86 platform, zimage can only be used for kernels smaller than kb. In addition, if you want to obtain detailed compilation information, you can add parameters.
Make zimage v = 1; Make bzimage v = 1;
II. The compiled kernel is located in the arch/<CPU>/boot directory.
5. Compile the kernel module: Make modules
6. Install the kernel module: Make modules_install.Source codeDirectory copy to/lib/modules
7. Create init ramdisk:
Mkinitrd initrd-$ vsersion $ version. Note that this command has two parameters. The first parameter is usually named as initrd-$ version and 2nd, it must be the actual kernel version. For example: Make
Initrd-2.6.29 2.6.29.
8. kernel installation (eg: x86 Platform)
(1) cp arch/x86/boot/bzimage/boot/vmlinuz-$ version // copy the bzimage file to the boot directory. The vmlinuz-$ version name can be used as needed, but we generally use this form
(2) CP $ initrd/boot // copy the rimdisk to the/boot directory.
(3) Modify/etc/grub. conf or/etc/Lilo. conf.