Linux 2.6, 4.3 kernel compilation process experience and summary

Source: Internet
Author: User
Tags unix domain socket

Previously compiled 2.4.10 version of the kernel, very good compile, the middle has been missing the SCSI low-level drivers under the BusLogic SCSI support option caused the system can not boot, and then open the option is OK, Turn off some useless options and compile quickly and compile within 30 seconds. I thought the kernel compilation was no more than that, until four days to start compiling the updated kernel just let me eat a big loss.

My initial idea is to compile an extremely concise kernel, remove the network, USB, optical drive, and so on all unnecessary things, leaving only the core function, the more streamlined the better, so on January 21 I downloaded the linux-2.6.34.tar.gz source package, and then started make Menuconfig configured the kernel, only to reduce the compilation time, only to focus on the compilation errors, during the period due to the GCC 3.4 compatibility and binutils 2.20 version mismatch caused the link to fail, later updated GCC to 4.4.7 version. The whole process I was concerned about the compilation time is shortened, busy a day, the effect is obvious. All the way down, reduced the cheap time to about 2-3 minutes, then very happy, feel to succeed.

As a result, January 22 I started to boot the system, I found that there is no way to start, to solve a mistake and a mistake, is to turn off the option should not be closed, and eventually did not start successfully. I know there are some important options that I turned off, so I tried to use CentOS. 6.0 current kernel configuration file to compile the next 2.6.34 try, I did so, the result in the last point of the link I hard disk space is not enough, my virtual machine only assigned 5G hard disk, compiled files accounted for more than 3G, there is a system and source package occupied part of the space is not enough, so regret to give up.

To the night of 22nd, I downloaded the linux-4.3.3.tar.xz kernel, this time not manually streamlined, one by one to close the option is too troublesome, I directly make allnoconfig, first turn off the options and then manually open the necessary options, the result is still inexplicable error, Can't get into the system, countless times constantly change the configuration, turn on the option to recompile or not, you are crazy.

The morning of January 23 was a long time, but the mistakes could not be solved, so I guess it wasn't my centos. 6.0 (KERNEL-2.6.32-71) is not suitable for compiling too new kernel, just download the LINUX-2.6.32.69.TAR.XZ source package in the afternoon, make Allnoconfig, first turn off all options and then open the necessary options, the results will not be able to enter the system.

All of the above processes, no matter how to solve a small error, eventually have a few mistakes do not pass:

1, No root device found. Boot has failed.sleeping forever.

2, udevadm[2371]: Error getting socket:address family not supported by protocol

UDEVD[2535]: Error getting socket:address family not supported by protocol

3, telinit:failed to open socket:function not implemented

Init:rcs post-stop Process (282) Terminated status 1

Init:kexec-disable main process (285) terminated with status 1

This time the problem is no longer a SCSI drive, but a more tricky configuration issue.

At this point, I finally understand the long-cut function of this practice is putting the cart before the horse, my first priority is to enable the system to boot, in this premise and then streamline the function.

On the afternoon of January 23, I added a 10G virtual hard disk to the virtual machine and prepared the 2.6.32.69 kernel source code.

cp/boot/config-2.6.32-71.el6.i686. config

Copy the system comes with the kernel configuration file, this time the hard drive tube enough, I see you can do.

Yes "" | Make Oldconfig

Use the file contents of a. config that already exists and make a default selection for the newly added options. Then make wait for more than half an hour to compile, then install the module, install the kernel, and toss for 20 minutes, start trying, the results are successful!

Add a 10G virtual hard disk to the virtual machine, compile the next 4.3.3 test with this method, and the result is successfully entered the system.

This time is also tossing to the night, but the successful entry system also shows that the system comes with the configuration file is feasible.

By January 24, that is, today, my main task is to ensure that the kernel can be started normally under the premise of continuous streamlining function, take 4.3.3 kernel hands-on, shot to the networking support and virtualization the whole to cancel, Results after compiling the system, and the above error occurred. I suspect this is the virtual machine used by some of the features of the virtualization has not been opened, the results of the Help menu to see the help of networking support after the discovery of the network module is actually caused by, I never thought it would be due to the network module problems can not enter the system, I always thought that the network module could be stripped out directly from the kernel, and I was wrong, and the help message says, "Unless you really know what you're doing, you should choose Y." This is because many programs require support for kernel network functionality, even if you are running the kernel on a single machine that is not connected to the network.

This sentence clairvoyant, the original is so, immediately open the Networking support option, the results can be entered into the system. So I carefully first shut down the network inside the wireless option, there are some other hardware drivers, and then compile the restart, as long as the system can be entered, The current. config backup, and then continue to turn off some of the features, if you can enter the system and then the. config backup, sequentially iteration down, busy for a whole day, the light backup configuration file There are 12, the time flies too fast, each compile run will take more than half an hour to 40 minutes, waiting for compilation and module , the installation period of the kernel also saw a "black Man 2" and "the Enemy of machinery", as of 7 o'clock this evening to eat more, I reduced the kernel to a super compact level, Networking support option only left TCP/IP Networking and UNIX domain sockets, I again the TCP/IP option completely turned off and did not fail, so finally determined that UNIX domain sockets this thing can not be shut down, the network module shut down will cause the system can not boot, because of this thing. Later, the role of this thing is: "UNIX Domain socket is developed on the socket architecture for the same host of interprocess communication (IPC), it does not need to go through the network protocol stack, do not need to package unpacking, calculate checksum, maintain serial number and answer, etc. Just copy application-tier data from one process to another. ”

Originally used for process IPC, no wonder so important, directly can cause the system to fail to start. Now 4.3.3 configuration file I have checked each of the options in detail, can be closed off, the remaining options if you shut down the system will not start. I'm exhausted. Now the kernel will need to use 8.5, plus the-J4 parameter, to get a single-thread recompile from make clean. It seems that the 4.3.3 kernel is indeed more complex, more powerful, cheap speed and how to upgrade can not reach 2.4.10 kernel level, 2.6.32 kernel although did not start successfully, but I guess is only a UNIX domain sockets option, The compilation time should not be much worse in about 2-3 minutes, so it is a very time-consuming task to compile the kernel as the kernel develops.


This experience also let me go through all the kernel configuration options, search for a lot of data, understand a lot of options to do. In the beginning, I thought that the SCSI drive and the file systems were being worked on, and the results were not chengxiang in the network-related functions.

After this hands-on practice, I am also a deep understanding of the kernel configuration, and later it is made Allnoconfig the way from the zero configuration, I guess it can be successful.

This paper is a small summary of it.

This article is from the "Linux Kernel Developer" blog, so be sure to keep this source http://mirage1993.blog.51cto.com/2709744/1738088

Linux 2.6, 4.3 kernel compilation process experience and summary

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.