Ubuntu kernel Compilation

Source: Internet
Author: User
I. kernel compilation 1. Download the kernel source code in Kernel. 2. Install the relevant Compilation Program. Install make, gcc, make-kpkg, run menuconfig, and other kernel-related tools. Unable to install. Check the/etc/apt/sources. list file. Run the command: $ sudoapt-getinstal

I. kernel Compilation

1. Download the kernel source code
Download the desired new kernel at http://www.kernel.org/and click "f" to download the file.
2. Install the relevant Compilation Program. Install make, gcc, make-kpkg, run menuconfig, and other kernel-related tools. Unable to install. Check the/etc/apt/sources. list file.

Run the following command:
$ Sudo apt-get install build-essential kernel-package libncurses5-dev

3. Enter the su command on the terminal and switch to the rootpermission. Then copy the linux- .tar.bz2 file to the/usr/src/directory. If su: authentication fails, the root password is not set. Ubuntu does not have a password by default, but the first user is in the admin group. It can set a password for the root user.
Sudo passwd root
[Sudo] password for username: <-enter the password
Enter a new UNIX Password: <-enter a new password.
Re-enter the new UNIX Password: <-re-enter the new password
Passwd: the password is successfully updated.
4. cd to the/usr/src/directory and run the tar-jxvf linux- .tar.bz2 command to decompress the source code package. Decompress the package to the/usr/src/linux-version folder.
5. Start preparations before compilation.
First, clear the temporary files left during previous compilation. If the package is just unlocked, you do not need to perform this step. If it is the second or the nth compilation, it must be executed. Then cd to the/usr/src/linux-version folder. Run the make mrproper command (root user ). This command ensures that the. o file. config file is not in the source code directory.

Many tutorials on the Internet refer to copying the current kernel config for reference. According to the experiment, it is not required. ubuntu and debian will automatically perform this step.
6. Start to configure the kernel options. Run the command: make menuconfig (in this case, you 'd better choose to load the previous kernel. config File, add new features to be added based on the previous configuration to generate a new one. for more information about Kernel options, see the Linux private kitchen related chapter http://www.linuxidc.com/Linux/2011-06/36804.htm .)

After seeing this, you will find that the screen is mainly divided into two parts: one is the anti-white column in the large box, and the other is the small box below, which contains select, three options: exit and help. The general usage of these components is as follows:

 

  • "Left and Right Direction keys": you can move the bottom,,Project;"Up and down arrow keys": you can move the anti-white column in the upper frame. If this row has an arrow (--->), it indicates that there are other items to be configured in the row;Select a project: select the project you want to configure with the "up/down key", and selectThen, press Enter to Enter the project for further configuration;
  • Optional functions: in the configuration of a detailed project, if there is a [] or <> symbol before, the project can be selected, and you can use the "Blank key" to select;
  • If it is [*] <*>, it indicates that it is compiled into the core. If it is It indicates compiling into a module! If you do not know when the project is, and you can select a module, you can directly select it as a module!
  • When you select And press Enter to exit the detailed project!

 

Figure 1. make menuconfig core function selection menu

Basically, we recommend that you just use the six buttons "Up and down the arrow keys, blank keys, and Enter! Do not use Esc; otherwise, an error may be triggered! In addition, we recommend that you consider the selection of the entire core function as follows:

 

  • The core functions must be directly compiled into the core;
  • Compile the "may be used in the future" function into a module as much as possible;
  • If you don't know what the things are going to do, you can't understand the help. Then you can retain the default value or compile it into a module;

 

In short, try to keep the core small and beautiful, and compile the remaining functions into modules.

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.