Linux Kernel Compilation details

Source: Internet
Author: User
The new kernel can be downloaded in the http://www.kernel.org. Copy linux-2.6.18.2.tar.bz2 to tar? Jxvf linux-2.6.18.2.tar.bz2 cdlinux-2.6.18.2 & nbsp; makemrproper delete the original compiled Garbage & nbsp; configuration

The new kernel can be downloaded in the http://www.kernel.org.

Copy linux-2.6.18.2.tar.bz2 to/usr/src/first.

Tar? Jxvf linux-2.6.18.2.tar.bz2

Cd linux-2.6.18.2

 

Make mrproper deletes the garbage generated by the original compilation

 

You can use one of the following commands to configure the kernel based on your needs and hobbies:

# Make config (text-based most traditional configuration interface)

# Make menuconfig (text menu-based configuration interface)

# Make xconfig (graphical window mode-based configuration interface)

# Make oldconfig (if you only want to modify some small points based on the original kernel configuration, it will save a lot of trouble)

 

During configuration, the default values can be used for most options. only a small part of options need to be selected based on the user's needs. For example, if you want the kernel to support a file system with DOS partitions, you need to select FAT or dossystem for the file system. if the system is equipped with a Nic or PCMCIA card, select the type of the corresponding card in the network configuration.

When you select the corresponding configuration, there are three options, which represent the following meanings:

"Y"-compile this function into the kernel

"N"-do not compile this function into the kernel

"M"-compile this function into a module that can be dynamically inserted into the kernel as needed.

Compile some functional code that is far away from the other parts of the core and is not frequently used into a loadable module. This helps reduce the length of the kernel and reduce the memory consumed by the kernel, this feature simplifies the impact on the kernel when the corresponding environment changes. Many functions can be processed in this way, such as Nic support and file system support such as FAT.

In fact, the most important thing to compile the kernel is to configure the kernel. I usually use make menuconfig to configure the kernel.

When you configure the 2.6.0 kernel, if your motherboard is an Intel chip, you may get a satisfactory kernel by default. Make menuconfig and save it when it leaves.

The difficulty here is pci. if your hard disk is IDE, you must choose the Nanqiao chip on your motherboard. For SCSI, select your scsicard model.

There is also the model of the NIC and sound card chip. you can use lspci to find their models.

 

[Root @ leo boot] # lspci

00:00. 0 Host bridge: Intel Corp. sort BX/ZX/DX-sort 43bx/ZX/DX Host bridge (rev 01)

00:01. 0 PCI bridge: Intel Corp. sort BX/ZX/DX-sort 43bx/ZX/dx agp bridge (rev 01)

00:07. 0 ISA bridge: Intel Corp. 82371AB/EB/MB PIIX4 ISA (rev 08)

. 1 IDE interface: Intel Corp. 82371AB/EB/MB PIIX4 IDE (rev 01)

00:07. 2 USB Controller: Intel Corp. 82371AB/EB/MB PIIX4 USB

. 3 Bridge: Intel Corp. 82371AB/EB/MB PIIX4 ACPI (rev 08)

00: 0f. 0 VGA compatible controller: VMware Inc [VMware svga ii] PCI Display Adapter

. 0 SCSI storage controller: LSI Logic/Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)

. 0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)

. 0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)

 

Compile configuration

Please pay special attention to the configuration of several important modules in this part. Generally, use the "make menuconfig" command to configure the kernel.

Enter the preceding command and a menu interface appears. you can view the required modules. The following describes several important configurations.

1) file system

Make sure to select the ext3 file system,

File systems --->

[*] Ext3 journalling file system support

[*] Ext3 Security Labels

[*] JBD (ext3) debugging support

The above three items must be selected, and must be built in (that is, the mark *). this is very important. check after configuration. does the config file contain "CONFIG_EXT3_FS = y. if it is not "CONFIG_EXT3_FS = y" but "CONFIG_EXT3_FS = m", you will encounter the following error when running the kernel: too Troot: effect_root (/sysroot,/sysroot/initrd) failed

  

2) NIC driver

Make sure to compile the driver corresponding to your Nic into the kernel. the common Nic is realtek 8139. The following is the Nic configuration for your reference.

Device Drivers --->

Networking support --->

Ethernet (10 or 100 Mbit) --->

<*> RealTek RTL-8139 C + PCI Fast Ethernet Adapter support (EXPERIMENTAL)

<*> RealTek RTL-8139 PCI Fast Ethernet Adapter support


3) sound card drive

You also need to compile the driver corresponding to your own sound card into the kernel. the general sound card is i810_audio. The following is the configuration of this sound card for your reference.

Device Drivers --->

Sound --->

<*> Sound card support

Advanced Linux Sound Architecture --->

<*> Advanced Linux Sound Architecture

<*> Sequencer support

<> Sequencer dummy client

<*> OSS Mixer API

<*> Oss pcm (digital audio) API [*] OSS Sequencer API

<*> RTC Timer support

PCI devices --->

<*> Intel i8x0/MX440, SiS 7012; Ali 5455; NForce Audio; AMD768/8111

Open Sound System --->

<> Open Sound System (DEPRECATED)

The above three configurations are related to the normal operation of the new kernel. Please note that other configurations can be selected by default if they are not well understood.

 

# Make dep (ensure that the key files are in the correct location) 2. 5. *-2.6.0 is not required. In fact,. * Some kernels are not required.

# Make clean (make sure all related files are in the latest version)

# Make zImage (compile the compressed kernel)

When the kernel supports many peripherals and functions, the kernel may become very large. in this case, you can compile the large kernel:

# Make bzImage

The compilation time depends on the hardware conditions and kernel configuration of the machine. the obtained kernel is located in the/usr/src/linux/arch/i386/boot directory, assume that the user's CPU is x86.

If you select a loadable module, compile the selected module after compiling the kernel:

# Make modules)

# Make module_install (transfer the compiled module to the standard system location)

 

# Make install

 

The above command "make install" will:

(1) copy the compressed kernel image to the/boot directory and create the System. map symbolic link;

(2) modify the configuration file of the bootloader;

(3) call the mkinitrd program to create the initrd image of the kernel. for GRUB, add the following similar configuration lines in the/boot/grub. conf configuration file:

 

Title Red Hat Linux (2 .***)

Root (hd0, 1)

Kernel/boot/vmlinuz-2. *** ro root = LABEL =/

&

Related Article

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.