X86 platform: The Linux system compiles the configuration kernel and starts the kernel __linux

Source: Internet
Author: User

X86 platform: The Linux system compiles the configuration kernel and starts the kernel

This article turns from: http://blog.chinaunix.net/uid-25811099-id-1704590.html

PC System: Windows XP Virtual machine: VMware 6.5.1 build-126130 Virtual machine system: Linux system (provided on version:2.6.25-14.fc9.i686 friendly CD) compile kernel version: linux-2.6.3 2 The main steps to compile the kernel and start: 1 Download the kernel and unzip it. 2 Configure and compile the kernel/module. 3) Make Init RAMDisk. 4) Copy the corresponding file to/boot/. 5) Modify the startup selection. The following details: 1 Download the kernel and decompression. 1. Download the kernel to the following Web site download Linux source code: http://www.kernel.org I download here is the linux-2.6.32 version, and then put it in the/usr/src/directory. 2. Unpack the kernel #cd/usr/src #tar xvzf./linux-2.6.32 2) to configure and compile the kernel/module 1. Pre-configuration cleanup because here directly from the official website to download the ' dry static ' kernel source code, solid This step can be omitted ~, if your source code has been used many times, then before compiling can have a choice to run the following three commands one. Make clean--> remove most generated files but keep the config make Mrproper--> remove all generated files + Config Files Make Distclean--> mrproper + Remove editor backup and patch files 2. Configuring the kernel configuration kernel has four commands: @ Make config: the most traditional text-based interactive configuration interface, which is deprecated with # make Menuconfig: A text-based menu based configuration interface that recommends $ make xconfig: A graphical configuration interface to show QT Installed% make Oldconfig: Use an existing configuration file (. config), but ask for new configuration options Here I choose to use made Menuconfig, enter the interface, do not change anything, exit and save. 3. Compile the kernel #make bzimage This process takes a long time, about 20 minutes (just estimate ~), and when finished, it will generate bzimage files in the/usr/src/linux-2.6.32/arch/x86/boot/directory. In thisTell me why you use make bzimage instead of make zimage to compile the kernel: because I am compiling the inside of x86, under the x86 platform, Zimage can only be used for kernels less than 512K. But there is no difference between the other platforms. 4. Compile and install kernel module #make Modules Modules_install This process is time-consuming and is also relatively long, after completion will be the kernel module will be installed into the/lib/modules/directory. Because the kernel version I use is linux-2.6.32, So you'll see a 2.6.32 folder in this directory. It is necessary to say: I am here to compile, install the kernel module on a command line, or write the make modules and made Modules_install separately. Make modules--> This process compiles the files of the option configured as ' M ' to the. ko file make Modules_install--> the installation process actually cuts the kernel module in the kernel source code to the/lib/modules/. 3) When you make the init ramdisk #mkinitrd initrd-2.6.32 2.6.32 Complete this command, the initrd-2.6.32 file will be generated in the kernel source code. The MKINITRD command is explained here: Mkinitrd initrd-$version $version initrd-$version The name here can be arbitrarily taken, but the meaning of this is to be able to echo Linux. $version This can not be arbitrarily taken, he is just in the/lib/modules/directory generated by the corresponding Linux version number of the folder. 4 Copy the corresponding file to/boot 1. Copy and rename/usr/src/linux-2.6.32/arch/x86/boot/bzimage to the/boot/directory #cp/usr/src/linux-2.6.32/arch/x86/ boot/bzimage/boot/vmlinuz-2.6.32 here renamed to vmlinuz-2.6.32 is mainly to be consistent with the corresponding files in Linux. 2. Copy/usr/src/linux-2.6.32/initrd-2.6.32 to/boot/directory #cp/USR/SRC/LINUX-2.6.32/INITRD-2.6.32/BOOT/5) Modify startup options Modify/etc/ grub.conf files. #cd/etc #vim GrubBefore modification: Modified: Title Mylinux (linux-2.6.32)--> This will occur when the Linux system selection system is launched kernel/vmlinuz-2.6.32--> that/boot/ vmlinuz-2.6.32 initrd/initrd-2.6.32--> that/boot/initrd-2.6.32 then, reboot, type Enter when you start, that will appear now and then select the kernel you have just configured to log on to the system. ~~

 

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.