Ubuntu kernel source code tree graphic tutorial

Source: Internet
Author: User
Many articles on the Internet, all of which he wrote are transferred and used in each article. Simply sort out an article by yourself. There are many good people on the Internet, but there are more white issues. What's more, we are not getting started with this number. Because we have recently learned the kernel and want to write modules, the modules should be compiled and installed under the source code tree, I am used to Ubuntu OS again. I can't help but turn to another party. I 'd better set it up. I have found a few articles that are not very useful. Let's start from below. PS: the current system is the last system that configured to update Jun from Ubuntu9.04 to Ubuntu10.04 in SSH. See ht

Many articles on the Internet, all of which he wrote are transferred and used in each article. Simply sort out an article by yourself.

There are many good people on the Internet, but there are more white issues. What's more, we are not getting started with this number. Because we have recently learned the kernel and want to write modules, the modules should be compiled and installed under the source code tree, I am used to Ubuntu OS again. I can't help but turn to another party. I 'd better set it up. I have found a few articles that are not very useful. Let's start from below.

PS: the current system is the previous configuration of the system for updating Jun from Ubuntu 9.04 to Ubuntu 10.04 in SSH. See http://www.linuxidc.com/Linux/2011-09/42775.htm

This is the case on the Internet.

1. install the software build-essential, autoconf, automake, cvs, and subversion required to compile the kernel.

$ Sudo apt-getinstall build-essential kernel-package libncurses5-dev

Libncurses5 is used when menuconfig is used to configure the kernel.

2. Go to/usr/src and build the source code tree here. Run the following command to view the available source code package:

$ Sudo apt-cache search linux-source

My prompt is:

Linux-source-Linux kernel source with Ubuntu patches

Linux-source-2.6.32-Linux kernel source for version 2.6.32 with Ubuntu patches

3. Let's download the kernel version 2.6.32 and run the following command:

$ Sudo apt-get install linux-source-2.6.32

Wait until the download is complete.

4. After the download is complete, go to/usr/src. By default, the directory structure will be shown here: (ls)

My display shows two Linux-header-2.6 pairs. * directory, You should have only one pair, the reason is that I updated from 9.04 to 10.4, Ubuntu will keep the previous version, don't worry about it, remember, here we use linux-headers-2.6.32-34-generic 、linux-headers-2.6.32-3420.linux-source-2.6.32.tar.bz2. Linux-source-2.6.32.tar.bz2 this is just download the source code, we extract it:

$ Sudo tar-xjvf linux-source-2.6.32.tar.bz2

Then, for the convenience of the operation, we will establish a soft connection to the source code directory:

$ Sudo ln-s linux-source-2.6.32 linux

In this way we can operate the linux-source-2.6.32 directory through linux.

$ Cd linux

5. Go to the source code tree and import the original Kernel configuration file:

$ Sudo cp ../linux-headers-2.6.32-34-generic/. config./. config

(Note: when viewing the file list under the linux-headers-2.6.32-34-generic directory, the. config file may not be visible, because the file starting with. Is hidden and can be seen with $ ls-);

Remember that it is currently in the source code tree. Run $ make menuconfig to export the original. config. A configuration page is displayed.

There are two final items: load akernel configuration...

Save a kernel configuration...

Select load a kernel configuration to save, and then save and exit after selecting save akernel configuration, and exit the configuration environment.

6. Okay. The following is the exciting make age. Can it be used? I am also looking forward to it, because I have never succeeded a few times before...

$ Make-j4

(Ps: Here-j4 uses four jobs to complete the make process. It's faster to run the job concurrently. However, if your machine is relatively slow, let's just honestly leave this option "make". After all, it takes a long time to make the kernel. We can watch a movie while waiting for its completion. Let me open a set of death or one piece. Let's watch it and compile it. ing ):

Compilation continues. It's really a long time... I want to play the ball later. Hurry up ....

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.