Linux Kernel compilation steps

Source: Internet
Author: User

Before compiling the Linux kernel, check the file Documentation/Changes in the kernel source code to view the runtime environment required during kernel compilation. If the file is not suitable for compiling and may fail. Since the compilation methods of the 2.4 and 2.6 kernels are not the same, we will discuss how to compile the 2.4 kernel separately in two cases: Compile the 2.6 kernel first step: make mrproper-Clear the kernel source code tree (clear junk information) make mrproper Step 2: make menuconfig -- configure the kernel and kernel module make menuconfig (related Commands include make config, make oldconfig, and make xconfig) (Interactive Q & A) (generated through the old kernel) (compiled on the GUI) we recommend that you use make menuconfig to perform this operation most conveniently and directly. After entering the Kernel configuration menu, in principle, you can change it with confidence. If you are unsure, remember not to change it. Otherwise, compilation may fail. During the change, * indicates that the compilation enters the kernel-start M with the system, and the compilation enters the module-does not start with the system, call as needed (some unimportant external drivers can be compiled as the kernel module, so that the kernel will not be too large and will not affect the startup speed, indicates that the function is neither compiled into the kernel nor compiled into the module ---- discard this function. if the system does not support this function, you can discard the Last Exit and prompt to save it, save the configuration as a name. the configuration file of config, whether we use make menuconfig, make oldconfig, make xconfig, and make config, will eventually generate this. config file. All subsequent operations will be performed according to the content in this file. This file stores the changes we just made and can be less. config. Step 3: make dep -- Build dependency Step 4: make bzImage -- generate a new kernel make (2.6 kernel simplifies the three steps on the left to make) Step 5: make modules -- it takes a long time to compile the kernel module! This step is the longest execution time. Step 6: make modules_install -- install the kernel module Step 7: make install -- install the kernel (all the compilation steps are best performed on the Character interface, otherwise the speed will be slow in the graphic interface) in addition, all the steps mentioned above should be checked for errors after any step is completed, that is, whether the words "error" are displayed. If any step error is displayed, it should be returned to make mrproper. No error reported. It seems that the situation is good. But don't be too happy. You need to perform a further test: 1. vi/etc/grub. conf --> to check whether a new kernel startup Item is generated. And modify the default point (0 indicates the first, 1 indicates the second, and so on ). 2. ls/boot --> check whether a new kernel file is generated by vmlinuz. Now it's almost done, but we have to restart it to see if we can start the system with a new kernel. Now that I have successfully entered the system, run uname-a to check whether we are using the new kernel: The new kernel is displayed, proving that the kernel has been compiled successfully! Success!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.