Kernel compilation experience for linux-2.6.22.6 kernel boot analysis

Source: Internet
Author: User
Tags bz2

1 Decompression, patching operation

1.1 Open Ubuntu, upload linux-2.6.22.6.tar.bz2 and patch files under Windows folder Linux-2.6.22.6-jz2440.patch to server/work/hardware directory via FTP

1.2 Enter Cd/work/hardware into the directory where the package is located, and then use the tar xjf linux-2.6.22.6tar.bz2 command to decompress the Linux kernel source compression package

1.3 Input cd/linux-2.6.22.6 into the source directory of the uncompressed kernel, execute patch-p1 <. /linux-2.6.22.6-jz2440.patch command to patch the kernel

2 configuration of the Kernel (3 methods)

Before introducing the three kernel configuration methods, the problem of executing the Meke menuconfig command in My Computer compilation environment is explained. The version of the virtual machine I am using is Ubuntu-16.04.2,gnu make, which is 4.1 (enter MAKE-V in a Linux environment to view the GNU makes version information) and encounter compilation problems such as:

Online search found the cause of the error, because the compiled linux-2.6.22.6 kernel version is older, and I use the GNU make version newer, the new version may have made some changes to the rules of make, so there are the above error prompts, Therefore, the following modifications need to be made to the makefile file at the top of the kernel:

linux-2.6.22.6 the kernel root directory, enter the vi Makefile command, enter 416gg to quickly locate to 416 lines, see the following code:

This needs to be modified to

Then the 1449 lines of the hint

This needs to be modified to

When you are finished, continue with the Make menuconfig command to see the configuration go smoothly.

2.1 Execute make menuconfig command directly, configure it yourself from beginning to end

After you execute the make Menuconfig command, there are thousands of configuration options, one to configure, and obviously a very complex operation.

2.2 Using the default configuration to make modifications based on the default configuration

Use the CD command to switch to the linux-2.3.22.6 kernel to store the root directory, and then find the default configuration file. Here we can implement the find operation by find-name the "*defconfig*" command, which finds all the folder paths with the "Defconfig" string. Finding the results below, you can see that the configuration file with the "Def_config" string is stored in the Arch schema directory.

The chip used in our Development board belongs to the ARM architecture, so the CD./arch/arm/configs enters the configs directory to find and develop boards using a similar configuration file for the chip. After entering the destination folder, use the LS command to list the configuration files that are included under the Price folder, as shown in the following configuration file:

From the above results can be seen, with 2440 similar configuration only s3c2410_defconfig files, here we first return to the root directory of the linux-2.6.22.6 kernel, and then run make s3c2410_defconfig command to configure the results as shown in the following configuration:

After configuration, the print result "configuration written to. config" means that all configuration information is written to the. config file, and the Make menuconfig command is to go back and read the contents of the. config file.

2.3 Using the manufacturer-supplied configuration file

jz2440 Factory, the manufacturer provided the corresponding configuration file Config_ok, when patching has been stored in the kernel directory. By the above introduction, we know that the Execute make menuconfig command is to read the. config content, if you want to use the manufacturer to provide the configuration file, only need to copy the manufacturer to provide the configuration file content in the. config file. Using the CD command to switch to the linux-2.3.22.6 kernel storage directory, use the cp config_ok. config command to implement the above described operation.

2.4 Execute make menuconfig configuration Menu

The menu operation commands are described in the following table:

Arrow Keys navigate the menu Keyboard up and down keys can control the menu move up and down, the left and right keys can control the level of three menu movement
<Enter> selects submenus---> Press the keyboard enter to enter the menu sub-directory
Highlighted letters is hotkeys The initial bold letter represents the menu hotkey, pressing the letter on the keyboard and positioning the cursor
Pressing <Y> includes Y key, compiled into the kernel
<N> excludes n keys, not compiled into the kernel
<M> modularizes Features M-Key for modularity
Press <Esc><Esc> to exit ESC key to exit
<?> for help ? key Help
</> for Search /key to collect the cable
Legend: Show
[*] Built-in Already built into the kernel
[] Excluded Do not compile into the kernel
<M> Module Already modular
< > Module capable Indicates that the option can be modular

3 compiling

3.1 Enter make command to compile directly

3.2 Enter make Uimage command to generate uimage form kernel file,uimage file contains head and true kernel part, can burn write in let uboot use directly. When compiling the Uimage file, you must copy the Mkimage tools that were compiled uboot to the/user/bin directory.

3.3 Run Uboot, press the command key K can pass the DNW software to the Uimage file to Uboot,uboot and then clear Flash, the uimage file written to Flash.

4 booting the kernel

4.1 Through Uboot Burn write uimage form kernel file, you can restart the kernel through the menu key B key, note that the kernel can be started successfully when the full file system is stored in flash, otherwise the kernel boot will be stuck in a certain location.

Kernel compilation experience for linux-2.6.22.6 kernel boot analysis

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.