Linux kernel compilation and kernel boot boot

Source: Internet
Author: User

Linux source code compiled steps, in fact, is very simple, mainly in the configuration of which modules need to be familiar with the functional opening, the following to see how the Linux kernel needs to compile the steps:

1, need to go to the Linux official website to download a kernel version of the source code,

https://www.kernel.org/

The instance uses the following version:

Linux-2.6.32.65.tar.xz

2, need to extract the downloaded compressed package, extracted after the following folder will appear

XZ LINUX-2.6.32.65.TAR.XZ

Tar xvf Linux-2.6.32.65.tar


linux-2.6.32.65

3. Enter into the linux-2.6.32.65 file directory. Run the following command:

Make menuconfig

Note: This command is used to configure the feature items that need to be compiled, and the Linux kernel provides a number of configuration commands, this article only describes the commands that use the graphical interface to configure feature items

After you run the command, a graphical configuration interface appears, followed by the prompts to configure the features you need to

4. Compile the kernel with the following command

make-j2 >/dev/null

Note:-j2 This option means that in the process of compiling, 2 jobs are derived simultaneously (when the CPU is doing time-consuming operations, the performance of multicore processors can be guaranteed to take full advantage) 16-core processors can derive 32 jobs simultaneously, i.e.-j32

>/dev/null This option is used to process compilation information during compilation. This is configured to redirect useless information from the compilation process to a black hole with no return value, and the error message is output to the console


At the end of these steps, the Linux kernel compilation is over.


Here's how to generate a boot image:

5. Use the Make modules_install command to generate the following boot files in the/boot/directory:

Initramfs-2.6.32.65.img

vmlinuz-2.6.32.65

Mapping relationship between memory address and function, system.map-2.6.32.65



6 . Modify the boot file of Linux/etc/grub.conf

Modeled after the template modification.

Note: Explain the meaning of the options in the grup.conf file below

Default=x is the default boot system, 0 is the first system, and so on.
Timeout=x time to stay in the Grub menu, in seconds
Title Xxx,xxx is the name of the operating system you want to boot, you can modify it yourself
 
Root (hdx,y) x and Y both represent a numeric value, and X is the hard disk on which the root partition of Linux is. If you have only one hard drive. That's hd0. If one of your Linux distributions is installed on the
Two drives, this x, is 1. Y is the area in which Linux is installed on your behalf. The value is a little different, not quite clear. For instance. For example, I installed Mandrake to the first
The second partition of the two drive, which is HDB5. Then his root (hdx,y), should be written as root (hd1,4), that is, Y=hdaz or HDBZ in the z minus 1.
Kernel (hdx,y)/boot/vmlinuz Root=/dev/hdaz and Initrd (hdx,y)/boot/initrd.img is the image and initrd file to boot which hard disk partition, be sure to write the correct XY value, Or you can't boot the system .



after the above steps are completed, restart your computer and press ENTER on the GRUB interface. You will be able to see the title boot entry you added. Choose your boot entry, and if the kernel does not have a problem with the function compilation, it should start your system.



Linux kernel compilation and kernel boot boot

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.