Add 2.4 kernel for Linux operating systems with 2.6 kernel

Source: Internet
Author: User

 

I. i386 Linux operating system startup process
BiOS power-on self-check --> load the interrupt vector to a memory unit of 1024 bytes --> execute int h soft interrupt vector call, load and start the boot program stored in the hard disk MBR, the final identifier of the MBR with the system disk is 55aah. The MBR boot program loads and starts the boot program stored in the active partition PBR --> BIOS loads the kernel and initrd (memory disk initialized by bootload, before the Linux kernel starts, bootload will load the initrd file in the storage medium to the memory, and the kernel will access the initrd File System in the memory before accessing the real root file system) --> jump to the execution kernel (the kernel header has a self-extracting program) --> execute initrd --> load the file system and start the first process init. Of course, if we directly compile SCSI and ext3 into the kernel during kernel compilation, we do not need to set initrd. Otherwise, initrd is required. Otherwise, the system prompts "VFS: unable
To mounting root FS ".
In addition, for a Multi-OS, it is actually a multi-kernel operating system. For example, if the 2.6 kernel is to be installed in this article, the startup process is slightly different. That is, grub is used to select multiple kernels. Use software such as bootloader to replace the boot program in MBR or the boot program in PBR, such as ntboot loader in windows and Lilo and grub in Linux. Windows ntboot loader is generally used to install multiple Windows systems on one machine. Lilo or grub is used to install multiple Linux systems on one machine or install both Linux and Windows systems. Modify grub. conf in the local machine to replace the boot program in PBR.

Ii. kernel Installation
1. Prepare and install related tools
Because the processing process of the 2.6 kernel module has changed, the modutils toolkit under the Linux 2.4 kernel is no longer suitable for the Linux 2.6 kernel. You need to download the latest versions of module-init-tools and modutils. For example module-init-tools-3.2.2.tar.bz2 and modutils-2.4.5-1.src.rpm
Address:
Http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/
Http://www.kernel.org/pub/linux/utils/kernel/modutils/v2.4/
Install modutils-since the source code package is downloaded, You have to convert it into a modutils RPM package and then install it.
# Rpm-e -- nodeps modutils (Force uninstall the original modutils RPM package)
# Mv modutils-2.4.5-1.src.rpm/usr/src/RedHat/(move the source code package to the/usr/src/RedHat Directory)
# Cd/usr/src/RedHat/specs (go to the standard file directory)
# Rmpbuild -- BB modutils. SPEC (generates a binary RPM package)
# CD ../RPMS/i386 (transfer to the location of the generated binary RPM package)
# Rpm-IVH modutils *. RPM (install the generated modutils-2.4.5-1.i386.rpm and modutils-debuginfo-2.4.5-1.i386.rpm binary RPM package) as follows
Install module-init-tools, which replaces depmod [/sbin/depmod] and other tools. Run the following command:
# Tar-jxvf module-init-tools-3.2.2.tar.bz2
# Cd module-init-tools-3.2.2
#./Configure -- prefix =/sbin
# Make
# Make install
/Generate-modprobe.conf/etc/modprobe. conf

Because we have to create initrd here, to install mkinitrd, We need to download a newer version of mkinitrd, and mkinitrd depends on the package device-mapper, device-mapper depends on lvm2. Therefore, you need to download lvm2, device-mapper, and mkinitrd.
:
Http://down1.chinaunix.net/distfiles/LVM2.2.02.51.tgz

Http://down1.chinaunix.net/distfiles/device-mapper.1.02.28.tgz
Http://down1.chinaunix.net/distfiles/mkinitrd-4.2.0.3.tar.bz2
Their installation is similar to installing module-init-tools.

2. kernel-related operations
Download Kernel
Click the Version Download link and change the download source address on the download tool.
Http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.6.15.5.tar.bz2
Decompress the kernel
# Cp linux-2.6.15.5.tar.bz2/usr/src
# Cd/usr/src
# Tar-jxvf linux-2.6.15.5.tar.bz2
# Ln-s linux-2.6.15.5 linux-2.6
# Cd linux-2.6
Compile the kernel
# Make mrproper (this command ensures that there is no incorrect. o file in the source code directory)
# Make menuconfig (Kernel configuration options)

Important configurations:
* For the "Code maturity level options" option, you must select "prompt for development and/or incomplete code/drivers"

* For the "loadable module support" option, you must select the "module unloading" and "automatic kernel module loading" options.

* For the "Processor type and features" option, you must select the "preemptible kernel" option, which is one of the important reasons that 2.6.x kernel is better than 2.4.x kernel.

* For the configuration of "device drivers --> Block devices", you must select "loopback device support" and "ramdisk support.

* For "device drivers --> multi-Device Support (raid and LVM)", select "device mapper support ".

* For "device drivers --> input device support", remember to select "keyboards, Sun XT Newton" and "mice.

* For "device drivers --> graphics support --> console display driver support", select "framebuffer console support.

* For details about "sound --> sound card support, advanced Linux sound architecture -->" ALSA, You must select the "Oss API emulation" option. The OSS does not need to be used.

* For USB, select all options. * for "yes" and "M" for "M ".
* File system. You must 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

* 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) --->
<*> Ethernet (10 or 100 Mbit)
<*> RealTek RTL-8139 C + PCI Fast Ethernet Adapter support (experimental)
<*> RealTek RTL-8139 PCI Fast Ethernet Adapter support
<*> Amd pcinet32 PCI support

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

* Ramdisk size
Device Drivers ---> block device-> default ramdisk must be an integer multiple of 1024. The default value is 4096. We change it to 12288.

Note: If you use VMWare for compilation, pay attention to the following points:
If you re-compile the kernel in VMware and the hard disk uses SCSI, the following options are required:
Device Drivers ---> SCSI device support ---> <*> SCSI disk support
Device Drivers ---> SCSI device support ---> SCSI low-level drivers ---> <*> buslogic SCSI support

Configuration part from the csdn blog, reprinted please indicate the source: http://blog.csdn.net/LUOPING198410/archive/2009/08/24/4480119.aspx

# Make Dep (create the dependent file required for compilation. Note: skip this step if the kernel has never been compiled)
# Make clean (clear the target file compiled by the kernel. Note: skip this step if the kernel has never been compiled)
# Make bzimage (generate the gzip compression kernel bzimage, located in the/usr/src/linux-2.6/ARCH/i386/boot directory)

3. Compile and install the kernel module
# Make modules (compile the kernel module)
# Make modules_install (install the kernel module, and install the kernel module in the/lib/modules/2.6.15.5 directory)

4. Modify the script and configuration file for differences between the 2.6 kernel and the 2.4 kernel.
# Gedit/etc/modules. conf
Comment out the line "alias SCSI hostadapter buslogic,
That is, # Alias SCSI hostadapter buslogic
Save/etc/modules. conf and exit
Because the "alias SCSI hostadapter buslogic" line cannot be found in the configuration, you can skip this step.

# Mkdir/sys
# Gedit/etc/rc. sysinit
1) Find the row "Mount-F/proc" and add the following content to it:
If ["$ kernelver" = "2.6"]; then
Mount-F/sys
Fi
2) Find the row "Action $" mounting proc filesystem: "Mount-n-t proc/proc" and add the following content to it:
If ["$ kernelver" = "2.6"]; then
Action $ "mounting sysfs filesystem:" Mount-n-t sysfs/sys"
Fi
3) modify the/etc/fstab file system list and add the following content to it:
None/sys sysfs defaults 0 0
4) modify the halt_get_remaining function in the/etc/init. d/halt script
Awk '$2 ~ /^ \/$ | ^ \/Proc | ^ \/dev/{next}
Change
Awk '$2 ~ /^ \/$ | ^ \/Proc | ^ \/sys | ^ \/dev/{next}
Because the kernel symbol file/proc/ksyms is named/proc/kallsyms, you must modify the startup script/etc/rc. sysinit. Add the following content to its header:
Uname = 'uname-R'
Kernelver =$ {uname: 0: 3}
If ["$ kernelver" = "2.6"]; then
Ksyms =/proc/kallsyms
Else
Ksyms =/proc/ksyms
Fi
Then, replace/proc/ksyms in the RC. sysinit file with $ ksyms variable reference (you can use gedit to open the file to find and replace it)
The USB driver module of Linux 2.6 was renamed. In terms of host controller, USB-OHCI was changed to Ochi-HCD, and USB-uhci was changed to uhci-HCD. Therefore, you need to modify the configuration file/etc/modprobe. conf (this configuration file is not found in this operation, so it is not omitted)
In addition, the module name that supports the USB keyboard is changed from keybdev to usbkbd, and the module name that supports the USB mouse is changed from mousedev to submouse. Therefore, modify the startup script file/etc/rc. sysinit:
Uname = 'uname-R'
Kernelver =$ {uname: 0: 3}
If ["$ kernelver" = "2.6"]; then
Ksyms =/proc/kallsyms
Keybdev_name = usbkdb
Mousedev_name = usbmouse
Else
Ksyms =/proc/ksyms
Keybdev_name = keybdev
Mousedev_name = mousedev
Fi
Change the keybdev and mousedev fields in the/etc/rc. sysinit script to $ keybdev_name and $ mousedev_name.
Next, modify the following content in the script/etc/rc. sysinit:
Needusbstorage =
If [$ USB = "1"]; then
Needusbstorage = 'lc _ all = C grep-e "^ I. * CLS = 08"/proc/bus/USB/Devices 2>/dev/null'
Lc_all = C grep 'hid '/proc/bus/USB/drivers | action $ "Initializing USB hid interface:" modprobe hid 2>/dev/null
Fi
Action $ "Initializing USB keyboard:" modprobe $ keybdev_name 2>/dev/null
Action $ "Initializing USB mouse:" modprobe $ mousedev_name 2>/dev/null
Fi
Changed:
Needusbstorage =
If [$ USB = "1"]; then
If ["$ kernelver" = "2.6"]; then
Needusbstorage = 'lc _ all = C grep-e "^ I. * CLS = 08"/sys/bus/USB/Devices 2>/dev/null'
Lc_all = C grep 'hid '/sys/bus/USB/drivers | action $ "Initializing USB hid interface:" modprobe hid 2>/dev/null
Else
Needusbstorage = 'lc _ all = C grep-e "^ I. * CLS = 08"/proc/bus/USB/Devices 2>/dev/null'
Lc_all = C grep 'hid '/proc/bus/USB/drivers | action $ "Initializing USB hid interface:" modprobe hid 2>/dev/null
Fi
Action $ "Initializing USB keyboard:" modprobe $ keybdev_name 2>/dev/null
Action $ "Initializing USB mouse:" modprobe $ mousedev_name 2>/dev/null
Fi

5. Install the kernel
# Grub-install/dev/SDA
# Make install
Make install mainly completes the following tasks:
Copy the generated kernel image and kernel symbol table to the/boot directory. After the kernel is compiled, the bzimage file is generated in the source directory ARCH/i386/boot/, which is copied to the/boot directory and renamed to the vmlinuz-2.6.15.5. A kernel symbol table is also generated in/linux-2.6/, which is copied to the/boot directory and renamed to system. Map-2.6.15.5. Then create the soft connection file vmlinuz and system. Map under the/boot/directory, connect to the vmlinuz-2.6.15.5 and system. Map-2.6.15.5 respectively.
Generate a initrd-2.6.15.5.img under the/boot/directory.
Configure the boot program grub
Note: configure the boot program in/boot/GRUB/grub. in the conf file, do not change the "Ro root = label =/" after the kernel/vmlinux-2.6.0 item to "Ro root =/dev/sda1 ", otherwise, the machine will crash when you enable the new kernel. The error message is as follows: Kernel panic: No init found, try passing init = option to kernel ...... or: Kernel panic: VFS: Unable to mount root FS on unknown-block (0, 0 ). If you are an ext3 file system, you can directly compile the support for ext3 and ext2 files into the kernel when customizing the Kernel configuration file. Otherwise, the machine will crash when you enable the new kernel, the error message is as follows: Kernel
Panic: No init found, try passing init = option to kernel... Or: Kernel panic: VFS: Unable to mount root FS on unknown-block (0, 0 ).

 

Note: The Startup Process of the embedded operating system is different. Start uboot first. uboot is divided into two phases. The kernel is loaded in the second phase. zimage is generated during compilation, run # mkimage-N 'linux-2.6.25.8 '-A arm-O Linux-T kernel-C none-A 0x30008000-E 0x30008040-D zimage. bin bzimage. bin. Generate the compressed kernel image of the leading file. Therefore, the bzimage. Bin kernel is loaded. After decompression, start the kernel and load the file system. That is, uboot --> bzimage --> File System (init, boot animation, QT ). It does not need initrd-xxx.img, grub and so on.

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.