Build your own Linux release with the LINUX open-source Kernel

Source: Internet
Author: User

In fact, it is not difficult to compile the kernel. If you can follow the correct method, it will take up to one and a half hours to complete. Is it very encouraging. Today I will bring you together to build your own kernel system.

Preparations before Compilation

1. download a copy of the internal source code. The following code is linux-2.6.7.tar.bz2. You can download it or update it at the following URL.

Http://kernel.org/pub/linux/kernel/v2.6/

2) download the latest version of module-init-tools ("module-init-tools-3.0.tar.gz" and "modutils-2.4.21-23.src.rpm ")

Http://www.kernel.org/pub/linux/ker...ools-3.0.tar.gz

Http://www.kernel.org/pub/linux/ker...4.21-23.src.rpm

3) install module-init-tools. It replaces depmod [/sbin/depmod] and other tools.

Tar-zxvf module-init-tools-3.0.tar.gz

Cd module-init-tools-3.0

./Configure -- prefix =/sbin

Make

Make install

/Generate-modprobe.conf/etc/modprobe. conf

4) install modutils-2.4.21-23.src.rpm. you may see the warning "user rusty and group rusty not existing. it doesn't matter. You only need to force the installation. if you do not perform these steps on Redhat 9 and Redhat 8, you will encounter problems in the "make modules_install" step.

Rpm-I modutils-2.4.21-23.src.rpm

Rpmbuild-bb/usr/src/redhat/SPECS/modutils. spec

Rpm-Fi/usr/src/redhat/RPMS/i386/modutils-2.4.21-23.i386.rpm

5) decompress the kernel source code and put the downloaded source code package under/usr/src. Then

Cd/usr/src

Tar xvfj linux-2.6.7.tar.bz2

Cd linux-2.6.7

Ii. Compilation Configuration

Please pay special attention to the configuration of several important modules in this section. run 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.

Iii. compilation process

Compile with the following command. It may take more than an hour to complete :-)

Make bzImage

Make modules

Make modules_install

Make install

Before running the new kernel, check the content of/boot/grub. conf. The following configuration can be used as a reference.

# 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 (2.4.20-8)

Root (hd0, 0)

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

Initrd/initrd-2.4.20-8.img

Iv. FAQs about Kernel running

1) RPM Problems

After you enter the compiled kernel, some RPM-related commands cannot be used and the following error occurs:

Rpmdb: unable to join the environment

Error: db4 error (11) from dbenv-> open: Resource temporarily unavailable

Error: cannot open Packages index using db3-Resource temporarily unavailable (11)

Error: cannot open Packages database in/var/lib/rpm

No packages

The solution is to run the "export LD_ASSUME_KERNEL = 2.2.25" command, or write it to/etc/bashrc.

2) Sound problems

The module name of the sound part has also changed. My laptop's original sound card driver is i810_audio and has now changed to snd-intel8x0. Therefore, add the following content to/etc/modprobe. conf:

Alias char-major-14 soundcore

Alias sound snd-intel8x0

Alias sound-slot-0 snd-intel8x0

Alias snd-card-0 snd-intel8x0

Alias sound-service-0-0 snd-mixer-oss

Alias sound-service-0-1 snd-seq-oss

Alias sound-service-0-3 snd-pcm-oss

Alias sound-service-0-8 snd-seq-oss

Alias sound-service-0-12 snd-pcm-oss

Install snd-intel8x0/sbin/modprobe -- ignore-install sound-slot-0 &&

{/Bin/aumix-minimal-f/etc/. aumixrc-L>/dev/null 2> & 1;/bin/true ;}

Remove snd-intel8x0

{/Bin/aumix-minimal-f/etc/. aumixrc-S>/dev/null 2> & 1;/bin/true ;};

/Sbin/modprobe-r -- ignore-remove sound-slot-0

Then run modprobe sound to load the sound module and run the following command to verify the sound Card Driver:

# Cat/proc/asound/cards

The result is as follows:

0 [SI7012]: ICH-SiS SI7012

SiS SI7012 at 0xdc00, irq 11

3) VMware Problems

Solution:

◆ Replace all "/proc/ksyms" in/usr/bin/vmware-config.pl with "/proc/kallsyms ". Use the "sed" command to achieve this goal.

◆ Re-run the script and use the kernel header file to compile the new kernel module. If an error occurs during compilation, enter/usr/lib/vmware/modules/sourceand use the following command to unpack vmnet.tar:

# Tar xvf vmnet.tar

◆ Enter the vmnet-only directory to modify the bridge. c file. Change "atomic_add (skb-> truesize, & sk-> wmem_alloc);" to "atomic_add (skb-> truesize, & sk-> sk_wmem_alloc );", change "protinfo" to "sk_protinfo" in a similar way ".

◆ Replace the vmnet-only command with vmmon.tar:

# Tar cvf vmmon.tar vmnet-only.

If the above operation still fails, the other solution is to download vmwar... unme.plat at http://ftp.cvut.cz/vmware.

4) USB Problems

Most USB modules used in the new 2.6.0 kernel have been renamed, so you need to modify the code for USB subsystem initialization in/etc/rc. sysinit. Change all "keybdev" in this file to "usbkbd", "mousedev" to "usbmouse", and "/proc/bus/usb" to "/sys/bus/usb ", and in/etc/init. d/halt. In addition, you must find "needusb storage" in/etc/rc. sysinit and make the following changes:

Needusbstorage =

If [$ usb = "1"]; then

Needusbstorage = 'lc _ ALL = C grep-e "^ I. * Cls = 08"/sys/bus/usb/devices 2>/dev/null'

Action $ "Initializing USB 1.1 host controller:" modprobe ohci-hcd 2>/dev/null

Action $ "Initializing usb hid interfa

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.