Linuxfedorecore4 kernel compilation process

Source: Internet
Author: User
Linuxfedorecore4 kernel compilation process-general Linux technology-Linux programming and kernel information. The following is a detailed description. First, download the latest kernel package from www.kernel.org. Here I will explain it in linux-2.6.24.tar.gz. I downloaded this compressed package. It is emphasized that when downloading the compressed package, put it under/usr/src. Generally, there are two folders: kernels and redhat. Kernels contains the kernel of your current system.

After downloading, you can perform command operations! Open the terminal. Ensure that you are the root user.

Cp Linux-2.6.24.tar.gz/usr/src press Enter. In this case, the software package is placed under the/usr/src directory. The following operations are simple: extract the compressed package.

[Root @ localhost src] # tar? Press enter for the zxvf Linux-2.6.24.tar.gz and decompress it into a folder Linux-2.6.24

[Root @ localhost src] # cd Linux-2.6.24 at this time your current directory is

[Root @ localhost src] # pwd/usr/src/Linux-2.6.24/perform command operations at this time. Pay attention to the compilation process.

[Root @ localhost Linux-2.6.24] # make mrproper here we will explain the role of this command. This is to clear the original directory. config and. o (object file). If we just downloaded the source code, you can save this step, but if you have compiled the kernel multiple times, this step is required. Otherwise, there will be many minor problems in the future. After performing this step:

[Root @ localhost Linux-2.6.24] # make menuconfig or make config or make xconfig here I chose make menuconfig. To explain the role of this command: This menuconfig is mainly used for Kernel configuration. It will display a visual interface, and then you can configure the kernel on this interface.

# Make config (the most traditional text-based configuration interface is not recommended)
# Make menuconfig (Text menu-based configuration interface, recommended for character terminals)
# Make xconfig (the configuration interface based on the graphic window mode is recommended in Xwindow)
# Make oldconfig (if you only want to modify some small points based on the original Kernel configuration, it will save a lot of trouble)

In make menuconfig, some of them allow you to select *], some allow you to select [M], and some allow you to select []. * indicates that the selected files are directly loaded into the kernel, M indicates that it will be compiled into modules in later make modules, so that you can call insmod and modprobe to the kernel at any time. Note the following:

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 --->

Network device 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)

There are a lot of configuration files to explain. You can refer to them here: the configuration file DETAILS contain all the explanations of the configuration files. You can click here to modify the configuration file.

If you have completed the above three steps, your new kernel will not be faulty. Next we will take the longest steps.

[Root @ localhost Linux-2.6.24] # make clean clears unnecessary files, which can cause errors during compilation. This step is actually very important.

[Root @ localhost Linux-2.6.24] # make bzImage to generate a new kernel core to fully compile the kernel. Note the two differences between make zImage and make bzImage. Sometimes make zImage is also used. Note that both commands are used to fully compile the kernel and gzip is used to compress the kernel. The main difference is that make bzImage can generate a larger kernel. The system too big error may occur when kernel version 2.4.0 is run using make zImage. After compilation is complete, proceed to the next step:

[Root @ localhost Linux-2.6.24] # make modules this step is to set the configuration you selected in make menuconfig as M, compile all the modules and place them under/usr/src/linux-2.6.24. It is used to generate all the kernel modules. This step takes a long time. When this execution is complete, perform the following operations:

[Root @ localhost Linux-2.6.24] # make modules_install this is mainly used to install the module steps. Last step:

[Root @ localhost Linux-2.6.24] # make install this command is equivalent to an automated process, because it will help you with other configurations. You can use this command to quickly create a new system and restart the new kernel.

Finally, it describes the issues that need to be paid attention to during kernel compilation. The most important thing here is make menuconfig. here you need to configure your Linux system in detail, and you need to have a deep understanding of the file directory of this configuration. Of course, you can also configure your own Linux system. This requires you to understand and master the configuration process.

Note the following when restarting the new Linux kernel:/boot/grub. conf. Here you can refer to this content for modification.

# Grub. conf generated by anaconda

#

# Note that you do not have to rerun grub after making changes to this file

# NOTICE: You have a/boot partition. This means that

# All kernel and initrd paths are relative to/boot/, eg.

# Root (hd0, 0)

# Kernel/vmlinuz-version ro root =/dev/hdc3

# Initrd-version.img/initrd

# Boot =/dev/hdc

Default = 1

Timeout = 10

Splashimage = (hd0, 0)/grub/splash.xpm.gz

Title Red Hat Linux (2.6.7)

Root (hd0, 0)

Kernel/vmlinuz-2.6.7 ro root = LABEL =/

Initrd/initrd-2.6.7.img

Title Red Hat Linux

Root (hd0, 0)

Kernel/vmlinuz-2.4.20-8 ro root = LABEL =/

Initrd/initrd-2.4.20-8.img

By the way, the last question is from my own computer. If the following error occurs during the restart: Enforcing mode requested but no policy loaded. Halting now.

Kernel panic-not syncing: Attempted to kill init!

Then you can think about how to solve this problem. Here I solve this problem.

1. In grub. conf, change kernel/vmlinuz-2.6.19 ro root = LABEL =/rhgb quiet to: kernel/vmlinuz-2.6.19 ro root = LABEL =/enforcing = 0 rhgb quiet. You can skip this step. But pay attention to it.

2. Modify the/etc/selinux/config configuration file and change the value of SELINUX to disabled.

The cause is selinux.

The enforcing parameter is the kernel parameter passed to selinux when the kernel is started. It is used to determine whether the kernel of your system runs in the enforcing mode or the permissive mode.

In free mode, SELinux only records what he should do, but in fact does not do anything. In the forced mode, SElinux will come to the real grid. If your policy is incorrect, the system may block you from logging on in forced mode! Therefore, under normal circumstances, you should pass enforcing = 1 to the kernel at startup. When there is a problem with your SELinux policy, you can temporarily pass enforcing = 0 to the kernel for troubleshooting. There is an option in the init configuration file/etc/selinux/config. By setting it, the system can also enter the free mode.

Now you can restart your computer. At this time, you will find that your Linux system has two kernels. Choose the new kernel to start.

Author: Cheng Haifeng

[ This post was last edited by Desktop]

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.