The final summary version of the Linux kernel compilation process __linux

Source: Internet
Author: User

I. Purpose of the experiment

Learn to recompile the Linux kernel to understand and master the differences between the Linux kernel and the release version.

Ii. content of the experiment

Recompile the kernel in the Linux operating system environment. Main contents of the experiment:

A. Find and download a kernel source code, this experiment uses the newest Linux kernel 2.6.36.

B. Configure the kernel.

C. Compile the kernel and modules.

D. Configure startup files.

The experimental environment is the Linux2.6.35 kernel of the environment, download and recompile the kernel source code (2.6.36), and then configure the GNU Boot Boot Tool grub, successfully run the compiled successful kernel.

Third, the main instrumentation equipment (must fill)

Linux environment: Utuntu10.10,linux kernel 2.6.35

To be compiled kernel: linux2.6.36

Iv. operating methods and experimental steps

"1" Download kernel source code

Download the latest Linux kernel 2.6.36 from the Http://os.zju.edu.cn/newlinux/files/jijiangmin website.

"2" to deploy the kernel source code

Open the terminal and change the user right to root. The practice is to enter sudo su at the terminal and then enter the password as prompted. Determine if the root user is using the WhoAmI command, and if the output is root, it has been switched to the root account.

Enter MV Linux-2.6.36.tar.gz/usr/src to move the downloaded kernel source code file to the/USR/SRC directory.

Enter CD/USR/SRC to switch to this directory.

Enter the tar zxvf linux-2.6.36.tar.gz to extract the kernel package and generate the source code in the linux-2.6.36 directory.

Enter the CD linux-2.6.36 and switch to the directory.

Enter cp/boot/config-, and then press the TAB key, and the system will automatically fill in the name of the eligible file under the directory, and then continue to enter. config, in order to use the original configuration file in the boot directory.

"3" Configuration kernel

There are a number of ways to configure the kernel, mainly as follows:

#make Menuconfig//Graphics tool interface based on NCurse library

#make Config//text-based command line tool, deprecated

#make xconfig//X11 Graphical tool interface

#make gconfig//GTK + based Graphical tool interface

Because Linux is still in the beginner stage, so choose a simple configuration kernel method, namely make menuconfig. After the terminal input make menuconfig, wait a few seconds, the terminal becomes a graphical kernel configuration interface. When configured, most options use their default values, and only a small portion of it needs to be selected according to different needs.

For each configuration option, the user has three choices, each representing the following meanings:

<*> or [*]--to compile the feature into the kernel

[]--does not compile this feature into the kernel

[m]--compiles this functionality into code that can be dynamically inserted into the kernel when needed

In this experiment, after make Menuconfig, the ext2 and ext3 file system are compiled into the kernel. If the user is compiled under a virtual machine, the SCSI device is typically compiled into the kernel. is not compiled under the virtual machine can also be compiled into it, will not have any impact.

"4" Compiling the kernel

This step is the longest one step, generally in 3 hours or so.

The build kernel simply enters make at the terminal and waits for the compilation to complete.

"5" Compiling and installing kernel modules

Enter make Modules_install, which can be done quickly.

"6" Installation kernel

Enter make install

"7" Build started

Enter the following sequence:

sudo mkinitramfs-o/boot/initrd.img-2.6.36

sudo update-initramfs-c-K 2.6.36

sudo update-grub2//automatically modifies the system boot configuration to produce grub.cfg startup files.

V. Experimental results and analysis

Move the kernel source code to the directory/USR/SRC, as shown below

Executing a statement successfully

sudo mkinitramfs-o/boot/initrd.img-2.6.36

sudo update-initramfs-c-K 2.6.36

After the boot directory, as shown below

Executing a statement successfully

sudo update-grub2

The boot entry for the new kernel is added to the Grub.cfg file, as shown below

After all of the experimental steps have been successfully completed, a reboot can be found in the startup item with two more items, namely Linux2.6.36 mode and Linux2.6.36 recovery mode. Select Linux2.6.36 mode, enter the new kernel, if the boot process did not jump out of the error prompts, said has been successful.

After entering the system, open the terminal, input uname-a, output the following figure, indicating that it is now a 2.6.36 kernel

Vi. Discussion and experience

1, this experiment, compiled two times the kernel, at the first compilation, the kernel of the configuration of this piece does not put

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.