Install and compile the Linux kernel upgrade Tool

Source: Internet
Author: User
Tags apache php gz file php mysql

Linux upgrades are quite common, So I studied the Linux upgrades and shared them with you here. I hope they will be useful to you. I am timid, so I am afraid to experience the painful feeling after the Windwos crash, so I am upgrading from Linux 2.4.20Linux to Linux 2.6.18 under VMware, below are some of my experiences and experiences. I will share them with you ~~

I. Because the Linux upgrade does not use any acceleration tool in CERNET

Internet access is really slow, so I want to share a folder with Windows under the Linux upgrade to use some of the previous good stuff! To do this, you need to take the following steps:

1. mount/dev/cdrom/mnt/cdrom

2. install VM tools in the vm menu

3. there will be two files in/mnt/cdrom, one is the rpm file and the other is the * .tar.gz file. Install the rpm file and decompress the file * .tar.gz with tar. If the file is read-only, then an error will be prompted, and you can take the test and decompress it.

4. After decompression, there will be a file named install *. pl, and some prompts will appear when you execute it directly. Press ENTER

5. After the vm tools are installed, go to the setting VM and set the common directory ~~

6. /mnt/kgfs will show up. After the content in the shared directory you just set is set, you can see some files for Linux kernel upgrade in Windows!

Ii. Upgrade the kernel in Linux (this is our focus). The following is the strategy. I have tried it myself. This is absolutely true:

I. Preparations,

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 Linux to upgrade the system and log on with the root user to enter terminal mode.

1. Check the Linux kernel version.

# Uname-a if 2.6.x is displayed on the screen, it indicates that your kernel is 2.6 and you do not need to read 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/linuxupgrade /kernel/v2.6/linuxupgrade -2.6.18.tar.bz2

3. Download the kernel Linux upgrade Tool
(1 download module-init-tools-3.2.tar.bz2
Http://www.kernel.org/pub/linuxupgrade/... 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 Linux upgrade tools I have backup, if the above failure, please leave your mailbox, I will send you)

Ii. Configuration

All right, the 2.6 kernel and four Linux upgrade tools have been downloaded. (no more than one tool can be downloaded. If not, please do not try the following steps. The Linux upgrade will not succeed ), next, go back to the Linux system to start configuration.

4. Copy the downloaded kernel source code package and four Linux 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 upgrade (delete the Linux upgrade folder. It is worth mentioning that if the kernel has never been compiled before, there is no such text
Folder. This command line can be skipped)
# Tar jvxf linuxlinuxupgrade -2.6.18.tar.bz2 (unzip the new kernel)
# Ln-s Linux upgrade-2.6.18 Linux upgrade (regenerate the Linux upgrade 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. confv

7. install three other Linux upgrade tools
Go back to the/usr/src directory and run the following three commands to install the other three Linux 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 Linux 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 upgrade-2.6.18 (go to the/usr/src/Linux upgrade-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 moduleloading;

(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
For more USB support, 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, the following error message is displayed: 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 ~~~ If you follow all the steps in this article and restart Linux to upgrade the system, if you cannot enter the 2.6.18 kernel unfortunately, 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 upgrade-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. 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 upgrade/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 usually only occurs in the SCSI hard disk + VMWARE + REDHAT architecture, because BusLogic is compiled
The kernel is not a module (even if the Buslog ic module of the 2.4 kernel is statically compiled into the kernel ).

The solution is to directly convert BusLogic. o file copy: # cp/usr/src/Linux upgrade-2.6.18/drivers/scsi/BusLogic. o/lib/modules/2.6.18/kernel/drivers/scsi. Do not forget to copy the file and run make install. 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 upgrade-2.6.18/arch/i386/boot/bzImage/boot/vmlinuz-2.6.18
# Cp/usr/src/Linux upgrade-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) and run the following command in the/boot directory: # new-kernel-pkg -- mkinitrd -- depmod -- install 2.6.18 (at this time your/boot will generate a initrd-2.4.18.img and your grub. the conf file has also been changed) # 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 to enter the grub. conf file and find the following information:
Default = 1
Timeout = 10
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Title Red Hat Linux upgrade (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 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 upgrade (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 upgrade (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 the system and check the 2.6 kernel after Linux upgrade ~~~~ In fact, it is not difficult to do this. The key is to be careful and patient!

  1. Upgrade the Linux system from Fedora 10 to Fedora 12
  2. Measure the test taker's knowledge about the Linux update and installation configuration input method.
  3. Upgrade apache php mysql in earlier versions of Linux
  4. Linux Kernel configuration Compilation
  5. Linux system startup depth analysis 1)

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.