Linux configuration multi-kernel startup

Source: Internet
Author: User
Linux configuration multi-kernel startup-Linux general technology-Linux programming and kernel information. The following is a detailed description. I studied driver development under fedora, so I wanted to use a standard Linux kernel, so I tried to build multiple kernels on fedora. After one day of trying yesterday, I finally succeeded. The process is not complex. Here, we will give a summary, and we will provide other people with reference.

1. Download the kernel source code

Download the kernel source code from the linux official website http://www.kernel.org. I used linux2.6.20.

Put the downloaded file under/usr/src/kernels, and the kernels folder under usr/src of fedora8 is usually directly under/usr/src.

2. Configure the kernel

It is complicated to configure according to the actual situation of your pc, and most of them can be default. I am using a virtual machine. Several of the key settings refer to an article on the Internet, as shown below:

Configure the kernel options. It's a little tedious ,~~ Hope a success ~~.
# Cd linux-2.6.18 (to the/usr/src/linux-2.6.18 directory)
# Make mrproper (this command ensures that there is no incorrect. o file in the source code directory)
# Make menuconfig (Kernel configuration options)
In this case, a graphical interface is displayed, listing all Kernel configuration options. Some options also have sub-options. You can select them using the arrow keys and use the Y key to confirm them. After many tests, most of the options are selected by default. The following options must be selected (check each of the following options carefully; otherwise, compilation may be discarded ):
(1) In the Loadable Module support option, select "Module unloading" and "Automatic kernel module loading;
(2) Device Drivers ---> select "Loopback device support" in Block Devices ";
Choose "Device mapper support" at device Drivers ---> Multi-device support (RAID and LVM ";
Device Drivers ---> Graphics support, be sure to select "Support for frame buffer devices ";
Device Drivers ---> USB support ---> select "USB Mass Storage support" (if you want more USB support in the real environment, select all. I am in a virtual machine. I don't need it anymore)
Device Drivers --->; Network device support ---> Ethernet (10 or 100 Mbit) ---> <*> AMD PCnet32 PCI support
(3) File system ---> (the following nine options are selected for the ext2 and ext3 File system configurations)
Second extended fs support
Ext2 extended attributes
Ext2 POSIX Access Control Lists
Ext2 Security Labels
Ext3 journalling file system support
Ext3 extended attributes
Ext3 POSIX Access Control Lists
Ext3 Security Labels
JBB (ext3) debugging support
File system ---> DOS/FAT/NT Filesystems ---> select "NTFS file system support ";
Note:
Ext2 and ext3 file system configurations are important and necessary. If the Ext3 and Ext2 file support is directly compiled into the kernel, the machine will be taken away during reboot and the following error message will appear:
Kernel panic: no init found, try passing init = option to kernel .....
Or:
VFS: Cannot open root device "hdxy" or unknow-block (0, 0)
Please append a correct "root =" boot option
Kernel panic: VFS: Unable to mount root fs on unknown-block (0, 0)
Or:
Mount: error 19 mounting ext3
Fail troot: effect_root (/sysroot,/sysroot/initrd) failed: 2
Umount/initrd/proc fail: 2
Freeing unused kernel memory: 244 k freed
Kernel panic? Not syncing: No init found. Try passing init = option to kernel
(My machine encountered the third type of error after being restarted. I was so depressed that I had to re-install it ~~~ After following all the steps in this article, if you fail to enter the 2.6.18 kernel after you restart the Linux system, you will find that your error message is the above three types ~~~ Ha !)
(4) If you compile the kernel in vmware and the hard disk uses scsi, the following three options are required:
Device Drivers ---> <*> SCSI device support (If this option is not selected, the following two options cannot be selected)
Device Drivers ---> <*> SCSI device support ---> <*> SCSI disk support
Device Drivers ---> <8> SCSI device support ---> SCSI low-level drivers ---> <*>; BusLogic SCSI support

3. Compile the kernel and kernel module

Run the following command:

$ Make dep

$ Make clean

$ Make bzImge // This time is relatively long. You can wander outside and come back.

$ Make modules

$ Make modules_install

Some tutorials will continue with the "make install" command to automatically install the kernel to the specified location, whether it will overwrite the original kernel I have not verified, but after I perform this step, I cannot enter the system from the very beginning, so I'm depressed!

4. manually create a kernel Startup File

There are three main files: bzImage-version, initrd. img-version, and System. map-version.

For details about the creation process, see the previous article: Several kernel files started by the kernel have different makefiles in different kernels, so the file generation location is different.

Note that there are two sets of three files (multiple kernels) started by the kernel in the boot system. It is best to add the version to differentiate them.

5. Modify grub. conf or lilo

Add a kernel option according to the original grub. conf style.

OK. So far, there will be more kernel options after restart. You can change the kernel name in grub. conf.
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.