Upgrade the Linux kernel to 2.6.24-general Linux technology-Linux programming and kernel information. For more information, see the following section. Preface
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. the Linux system was successfully upgraded from the 2.4.20-8 kernel to the 2.6.24 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!
I. Preparations
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. 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.24.tar.bz2
3. Download the kernel upgrade Tool
(1 download module-init-tools-3.2.tar.bz2
Http://www.kernel.org/pub/linux/... t-tools-3.2.tar.bz2
(2) download mkinitrd-4.1.18-2.i386.rpm
Http://ayo.freshrpms.net/fedora/... d-4.1.18-2.i386.rpm
(3) download lvm2-2.00.25-1.01.i386.rpm
Http://ayo.freshrpms.net/fedora/... 00.25-1.01.i386.rpm
(4) download device-mapper-1.00.19-2.i386.rpm
Http://ayo.freshrpms.net/fedora/...-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.piaoyang.org/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 source code package 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.24.tar.bz2 (unzip new kernel)
# Ln-s linux-2.6.24 linux (regenerate linux folder)
6. Install module-init-tools
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 ,~~ I hope a success.
# Cd linux-2.6.24 (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
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.24 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. Note: skip this step if the kernel has never been compiled)
# Make bzImage (case sensitive. This step truly compiles 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.24 sub-directory 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 copy the BusLogic. o file directly:
# 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. This step if stuck, the following can not be carried out, if reading this document still does not solve the problem, come to my online message book for help, into the http://www.piaoyang.org, click "message book" can, I will see your help information in time.
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.24/arch/i386/boot/bzImage/boot/vmlinuz-2.6.24
# Cp/usr/src/linux-2.6.24/System. map/boot/System. map-2.6.24
# Cd/boot (enter the boot directory)
# Rm? Rf System. map (delete the original connection)
# Ln? S System. map-2.6.24 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.24 (at this time, a initrd-2.4.24.img will be generated under your/boot, and your grub. conf file 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. 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.24)
Root (hd0, 0)
Kernel/vmlinuz-2.6.24 ro root = LABEL =/
Initrd/initrd-2.6.24.img
Make two changes:
(1) Change "default = 1" to "default = 0" (if you do not change it, you can also change it, but 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.24)
Root (hd0, 0)
Kernel/vmlinuz-2.6.24 ro root =/dev/hda2
Initrd/initrd-2.6.24.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 now. Check the upgraded 2.6 kernel.
Postscript:
Linux Kernel upgrades and compilation are a long topic, with countless articles related to the Internet. Then, there were no articles that allowed me to successfully upgrade. After two days of experience, I deeply felt that the first upgrade and compilation of the Linux kernel is really a huge task for new users like me. Fortunately, without patience, after comparing multiple articles and thinking about it, the correct update and compilation were successful. To sum up the feelings of these two days, it is "pain, happy "! If you still fail to follow these steps, I can tell you two things: first, do not doubt that there is a problem with my steps, because it is not just me, my colleague also succeeded once according to my document; second, you can go to my message book http://www.piaoyang.org/guestbook to leave a message for me, I will try my best to answer your questions. In this example, I hope to provide you with some help.
This article is original and the first blog to be published. The author's email is piaoyang168 # 163.com. please respect copyright. repost this article and keep our description.
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