Linux Kernel upgrade process

Source: Internet
Author: User
Tags posix

Since the development environment needs to be performed on the linux-2.6 kernel, I was prepared to upgrade the Linux system on my virtual machine. I didn't expect it to take two days to install the system repeatedly ~~), Finally, the Linux system is successfully upgraded from the 2.4.20-8 kernel to the 2.6.18 kernel.

 

Although there are many articles about Linux kernel upgrade on the Internet, the download link is either outdated or the download link is invalid, or the file cannot be clearly expressed. What's more, many articles have errors in the command line during the reprinting process. At the beginning, I upgraded these strategies, which wasted a lot of time.

 

Now, the upgrade is successful, and you are in a good mood. You can also write an "Upgrade Strategy! So I tried to reinstall a Linux system on the virtual machine, and made a perfect update. I recorded these steps while upgrading and wrote a Linux kernel upgrade record (not a memoir !), Share with you ~~!

 

First, the line with the # sign below is the command line to be entered, and all the command lines mentioned in this article are entered in the terminal. Next, let's start a wonderful Linux kernel upgrade journey!

 

I. Preparations

 

Start the Linux system and log on with the root user to enter the terminal mode.

 

1. view the Linux kernel version

# Uname-

If 2.6.x is displayed on the screen, it means that you have a 2.6 kernel and you don't need to look at the following. What should you do !~~~ If 2.4.x is displayed, congratulations, go through it and proceed to the next step.

 

2. Download the 2.6 kernel source code

: Http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.tar.bz2

 

3. Download the kernel upgrade Tool

(1 download module-init-tools-3.2.tar.bz2

Http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/module-init-tools-3.2.tar.bz2

(2) download mkinitrd-4.1.18-2.i386.rpm

Http://ayo.freshrpms.net/fedora/linux/3/i386/RPMS.core/mkinitrd-4.1.18-2.i386.rpm

(3) download lvm2-2.00.25-1.01.i386.rpm

Http://ayo.freshrpms.net/fedora/linux/3/i386/RPMS.core/lvm2-2.00.25-1.01.i386.rpm

(4) download device-mapper-1.00.19-2.i386.rpm

Http://ayo.freshrpms.net/fedora/linux/3/i386/RPMS.core/device-mapper-1.00.19-2.i386.rpm

 

(2.6.18 kernel and the four upgrade tools I have backup, if the above is invalid, please leave your mailbox in http://www.fly2.cn/guestbook, I will send you)

 

Ii. Configuration

 

Okay, the 2.6 kernel and four upgrade tools have been downloaded. (no more than one. If the download is not complete, please do not try the following steps. The upgrade will not succeed ), go back to the Linux system to start configuration.

 

4. Copy the downloaded kernel and four upgrade tools to the/usr/src folder. I don't need to teach you how to copy it ~~~~ It won't be copied to hit the wall !~~ Haha!

 

5. After the copy is completed, start to decompress the new kernel. Execute the following commands in sequence:

# Cd/usr/src (go to the/usr/src directory. If it is already in the/usr/src directory, do not execute this command)

# Rm-RF Linux (delete the Linux folder. It is worth mentioning that if the kernel has never been compiled before, there is no such folder, and this command line can be skipped)

# Tar jvxf linux-2.6.18.tar.bz2 (unzip new kernel)

# Ln-s linux-2.6.18 Linux (regenerate Linux folder)

 

6. Install the module-init-tools toolkit.

In the/usr/src directory, execute the following commands in sequence:

# Tar jvxf module-init-tools-3.2.tar.bz2 (extract module-init-tools)

# Cd module-init-tools-3.2 (by the/usr/src directory to enter the module-init-tools directory)

#./Configure -- prefix =/

# Make moveold

# Make all install

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

 

7. install three other upgrade tools

Go back to the/usr/src directory and execute the following three commands to install the other three upgrade tools:

# Rpm-IVH -- nodeps mkinitrd-4.1.18-2.i386.rpm (note that -- nodeps parameters must be added here, the same below)

# Rpm-IVH -- nodeps lvm2-2.00.25-1.01.i386.rpm.

# Rpm-IVH -- nodeps device-mapper-1.00.19-2.i386.rpm.

 

If you do not update the above upgrade packages, the following error will be prompted during kernel Compilation:

Mkinitrd failed

Make [1]: *** [install] Error 1

Make: *** [install] Error 2

 

8. Configure 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, you must select "module unloading" and "automatic kernel module loading;

(2) The loopback device support must be selected in device drivers ---> Block devices;

Choose device drivers ---> multi-Device Support (raid and LVM) to choose device mapper support ";

Device Drivers ---> graphics support ", be sure to select" Support for frame buffer devices ";

Device Drivers --->; USB support ---> choose "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 ";

File Systems --> miscellaneous filesystems ---> <*> compressed ROM file system support (cramfs)

 

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. If I couldn't get into the system and got depressed, I had to reinstall it ~~~)

 

(4) 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

 

Iii. Compilation

 

OK. The complicated configuration work has been completed. At this point, all preparations before compilation have been completed!

9. start compiling ...... :

In the/usr/src/linux-2.6.18 directory, execute the following command to compile. It takes some time to compile the program. Please wait for a cup of tea!

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

# Make bzimage (case sensitive. This step is used to compile the kernel)

After the kernel is compiled, an image file bzimage of the new kernel is generated in the/usr/src/Linux/ARCH/i386/boot directory. If you use make zimage to compile a large kernel, the system will prompt you to use the make bzimage command to compile it. Therefore, I will use make bzimage to compile it directly.

# Make modules)

# Make modules_install (installable module)

After the installation is successful, the system will generate a 2.6.18 subdirectory under the/lib/modules Directory, which stores all the loaded modules of the new kernel.

# Make install (new kernel installation)

 

Note: The following error message may appear during make install:

No module buslogic found for Kernel 2.4.12

Mkinitrd failed

This problem occurs only in the SCSI hard drive + VMware + RedHat architecture, because buslogic is compiled into the kernel rather than a module (even if the buslogic module of the 2.4 kernel is statically compiled into the kernel ). The solution is to directly copy the buslogic. o file:

# Cp/usr/src/linux-2.6.18/Drivers/SCSI/buslogic. O/lib/modules/2.6.18/kernel/Drivers/SCSI

But don't forget, run make install after the copy.

(If you select the buslogic module to m-module mode when making menuconfig, this prompt will not appear .)

 

4. Start a new kernel

10. Copy the new kernel and system. Map files to the/boot directory and execute the following commands in sequence:

# Cp/usr/src/linux-2.6.18/ARCH/i386/boot/bzimage/boot/vmlinuz-2.6.18

# Cp/usr/src/linux-2.6.18/system. MAP/boot/system. Map-2.6.18

# Cd/boot (enter the boot directory)

# Rm-RF system. Map (delete the original connection)

# Ln-S system. Map-2.6.18 system. Map (reconnect)

 

11. Modify the grub startup Manager

If there is no error, modify the grub configuration file (do not tell me the Lilo you are using)

In the/boot directory, run the following command:

# New-kernel-PKG -- mkinitrd -- depmod -- install 2.6.18 (at this time, a initrd-2.4.12.img is generated under your/boot and your grub. conf has been changed accordingly)

 

# DF (check the partition where the root directory is located and use it in the next step. Note that the root partition is the 50 m partition of boot from time to time, which is generally your largest partition, that is, "/". Do not make a mistake. My name is/dev/hda2)

 

# Vi/GRUB/grub. conf

Go to the grub. conf file and find the following information:

Default = 1

Timeout = 10

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

Title Red Hat Linux (2.6.18)

Root (hd0, 0)

Kernel/vmlinuz-2.6.18 Ro root = label =/

Initrd/initrd-2.6.18.img

Make two changes:

(1) Change default = 1 to default = 0 (if not changed, the system will enter the 2.4 kernel by default after restart)

(2) Replace "label =/" of the kernel row with the partition of the root directory (as shown in the previous step)

This step is very important. The modification error may cause the system to be inaccessible. I will list the modified grub. conf file. If it is not clear, you can modify it as follows:

Default = 0

Timeout = 10

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

Title Red Hat Linux (2.6.18)

Root (hd0, 0)

Kernel/vmlinuz-2.6.18 Ro root =/dev/hda2

Initrd/initrd-2.6.18.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

 

12, OK, all done! Restart and check the upgraded 2.6 kernel!

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.