Ubuntu kernel compile and CPU Hot-plug characteristic configuration whole process and encounter problem record

Source: Internet
Author: User
Tags bz2

Recently compiled Palacios requires the Linux kernel to support CPU Hot-plug (Memory hot Plug) features, Unfortunately, the Ubuntu10.04 system installed on my machine does not support memory hot-swappable features by default. So I need to modify the configuration file and recompile the Linux kernel, and then began a long process of Linux kernel compilation, fortunately, a great God to help me, and then refer to a lot of friends on the Internet blog, just let me quickly end this painful experience. Remember this, forget it, share it. First, see if your machine supports CPU Hot-plug (memory hot swappable) features

This is my initial demand.

The Linux command line executes the following command:

$ cat/boot/config-$ (uname-r) | grep hotremove

If the output below shows that your system has already supported the memory hot-swappable feature, congratulations, you don't need to recompile the kernel.

Config_memory_hotremove=y
Config_arch_enable_memory_hotremove=y

If it does not appear, it will have to hard to compile the kernel, walk up the year of the Sao. second, view the native Linux kernel version and download the target Linux kernel version

2.1 View the native Linux kernel version:

sudo uname-r

Then go to the Linux kernel website to download the kernel to be compiled, generally choose a higher than their own native kernel version, unless you have special requirements.
For example, my native Linux kernel is linux-2.6.32.21, and the target Linux kernel I choose is 2.6.32.27.

2.2 Download Kernel

Linux Kernel website: I am the kernel list

Then select the version of the package you want to download, for example, I chose linux-2.6.32.27.tar.bz2, as shown in the following figure. (The compressed file for both suffixes is OK)

2.3 Decompression Kernel

Copy the downloaded compressed package file to the/USR/SRC directory and unzip

sudo tar xvf linux-2.6.32.27.tar.bz2

Iii. Configuring the kernel configuration file

This step is the most important, directly related to the success of the compilation and the compilation of the kernel can be run up. I was stuck in this step for a long time.

3.1 Open configuration file

OK, in the last step we have unpacked the kernel compressed files, and now go to the new kernel folder we unpacked to see.

cd/usr/src/linux-2.6.32.27
ls-a

At this point, you find that there is no configuration file in the directory, that is, the. config file, so we want to generate a default configuration file, run the following command:

sudo make Defconfig

The default configuration file for the current kernel is generated. Of course, we also need to improve it, otherwise it will not be able to find the file system, and secondly we need to configure the CPU Hot-plug is set here.
Run the following command, configured in the form of a graphical interface.

sudo make Menuconfig

If you have an error in this step, you are prompted to error:curses.h:no such file or directory to indicate that you lack the necessary class library support to run Menuconfig on your machine. Run the command:

sudo apt-get install Libncurses5-dev Libncursesw5-dev

And then make Menuconfig again.

3.2 Configuring the kernel configuration file

The interface should look like this when you go in. (High version may be different, but very similar)

First, we configure the file system, if not configured, the new kernel has been unable to find the file system, reboot will be black screen then a cursor has been flashing in the upper left corner or prompted to find filesystem.

The file system configuration is shown below:

Then we configure the CPU Hot-plug feature,

1.Processor type and features->meeory model-> sparsememory
2.Processor type and features->allow for memory Hot-add
3.Processor type and features->allow for memory Hot-remove
4.Processor Type and features->page migration
5.Processor type and features->support for hot-pluggable CPUs
6.Power Management and ACPI OPTIONS->ACPI (~ ~ Full name ~) Support->memory Hotplug

The above items should be selected.

If you're still not sure, check out the official documents: I'm the official document.

In addition, there is an article about memory hot plug, but also good. Take away: Meet you, huh?

At this point, the configuration has basically reached our requirements. Then always choose Exit, and finally prompts you to save, be sure to choose Yes, save.

In addition, if you don't know whether or not to select an item in the configuration file, you will be surprised if you stop the cursor on that item and press H. Iv. Compiling and installing

Well, through the difficulties, we finally came to this step. Now you can compile and install it. (The following commands are executed within the new kernel directory)

4.1 Compiling the kernel

sudo make

Well, only one word. This process is long, if the previous configuration file is not a problem. And your compilation environment is not a problem, then it should not be.
If you do not have GCC compiled environment, then you need to execute the following command to install the necessary compilation environment.

sudo apt-get install build-essential

4.2 Compiling and installing kernel modules

sudo make Modules_install

This step should be very fast.


4.3 Installing the kernel

sudo make install

v. Build kernel mirroring and Startup items

It's going to be a success soon.

5.1 Generating Kernel Mirroring

First look at the folder in the folder/lib/modules/directory:

Ls/lib/modules

The folder should have two folders, one is the kernel module file of your original system, and the other is the kernel module file of the new kernel which just finished compiling.
Then execute:

sudo mkinitramfs-o/boot/initrd.img-2.6.32.27
sudo update-initramfs-c-k 2.6.32.27

The version number in the command corresponds to the version number of your new version.

5.2 Build Boot boot file

Finally, configure the grub file at startup:

sudo update-grub2

OK, it's done. But let's change a little bit, and we'll wait a few seconds for grub to start, instead of going straight to the default system.

sudo gedit/boot/grub/grub.cfg

And then find all of them timeout=0 or timeout= negative, all changed to timeout=10, save, exit.
Complete.
Reboot the machine, the Grub interface appears, and then select the new kernel to enter. What to do if you can't see the grub interface after rebooting.

At that time I also encountered this problem, only to start compiling the kernel due to a variety of unknown problems, resulting in the completion of the compilation of the machine after the reboot only a cursor flashing. Even the grub interface is wood, even the original system can not go in ah ... So I'll teach you how to solve the problem.

Direct to connection: I am the cheat

Just be aware that the first step in the previous tutorial is not needed. As long as one can install Ubuntu u disk can be, and the use of a U disk installed Ubuntu like, but with a U disk guide up later do not choose Istall Ubuntu, but into the first, trial Ubuntu. vii. reference materials

Thank you blog of the Great God. Many of the contents of this blog are excerpted from your blog. Thank you.

http://blog.csdn.net/fjt19900921/article/details/8316481//very reliable kernel compile blog

http://blog.chinaunix.net/uid-15007890-id-106930.html//Memory Hot-swappable introduction, mentioned above

http://smilejay.com/2011/05/linux-kernel-configuration///Kernel compilation

http://blog.chinaunix.net/uid-7525568-id-3453610.html//Kernel configuration and compilation detailed procedures, parameters are also mentioned

http://www.cnblogs.com/jack204/archive/2012/02/21/2361661.html//Kernel compilation, seemingly a 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.