Linux2.4-> 2.6 Kernel upgrade guide

Source: Internet
Author: User
Article title: Linux2.4-2.6 Kernel upgrade guide. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

The Guide of Upgrading to linux kernel 2.6.x

The Guide of Upgrading to linux kernel 2.6.x

Author: Rongkai Zhan
Date: 2004-3-14

After the linux-2.6.x kernel is released, the brothers in the jar can't wait to upgrade the original 2.4.x kernel. however, because the system programs supporting 2.6.x kernel are not updated in time, the upgrade process may encounter many problems, therefore, I think it is necessary to share my experience with you at a moment:-) when XD encounters similar problems in the future, please read this article first, instead of posting blindly as soon as it comes up.

Ps, you are welcome to fix me.

1. back up important data

This is a good habit, so you don't have to say more about it :-)

2. download the latest 2.6.x kernel source code package

Of course this will go to the official website http://www.kernel.org or its mir ...? If you download the package, you 'd better not go to those unknown websites, because those source code packages may be maliciously manipulated. the latest linux-2.6.4.tar.bz2 source code package is about 33 MB. when downloading the image, you can have a coffee cup, and then click a cigarette ......

Unbind the source code package under the/usr/src/directory, and obtain the source code directory/usr/src/linux-2.6.4 /. before doing anything to the kernel, we recommend that you take a look at its README file and Documentation/Changes file, from which you will get a lot of useful information. this information will help you avoid unnecessary troubles in the subsequent upgrade process.

The Documentation/Changes provides minimum system software requirements for successful upgrade to the kernel-2.6.x, such as for kernel-2.6.4:

O Gnu C 2.95.3 # gcc -- version
O Gnu make 3.79.1 # make -- version
O binutils 2.12 # ld-v
O util-linux 2.10o # fdformat -- version
O module-init-tools 0.9.10 # depmod-V
O e2fsprogs 1.29 # tune2fs
O jfsutils 1.1.3 # fsck. jfs-V
O reiserfsprogs 3.6.3 # reiserfsck-V 2> & 1 | grep reiserfsprogs
O xfsprogs 2.6.0 # xfs_db-V
O pcmcia-cs 3.1.21 # cardmgr-V
O quota-tools 3.09 # quota-V
O PPP 2.4.0 # pppd -- version
0 isdn4k-utils 3.1pre1 # isdnctrl 2> & 1 | grep version
O nfs-utils 1.0.5 # showmount -- version
O procps 3.2.0 # ps -- version
O oprofile 0.5.3 # oprofiled -- version

For RH8/9 users, the above requirements are basically met. there are only two programs to be updated: the modutils toolkit and the mkinitrd program.

3. install the module-init-tools-3.0.tar.gz toolkit.

The module processing process of the linux-2.6.x kernel has changed (many of the work previously processed by modutils in the user state has been completed in the kernel ), therefore, the modutils toolkit under 2.4.x is no longer suitable for the new 2.6.x kernel and must be upgraded to the module-init-tools toolkit. the latest version of this toolkit is 3.0 (ps, the version of this toolkit from 0.9.15 to 3.0, the span is large... hoho ). you can download the module-init-tools-3.0.tar.gz source code package in two ways:

O Rusty's Linux Kernel Page: http://www.kernel.org/pub/linux/ker...ools-3.0.tar.gz
Http://www.kernel.org/pub/linux/uti...ools-3.0.tar.gz

Next, follow these steps to install the module-init-tools toolkit:

# Configure -- prefix =/
# Make moveold
# Make all install
#./Generate-modprobe.conf/etc/modprobe. conf

Command "make moveold" will change the system's original modutils tool program to "*. old" (for example, lsmod. old, etc.). NOTE! This is an important step. do not omit it. this will allow you to continue using the original linux-2.4.x system, because the new module-init-tools toolkit in The 2.4.x system is actually dependent on the original "*. old "program to load the kernel module. if you forget this step, you can first download and install the original modutils package, and then follow the steps above to repeat it.

The new module-init-tools tool kit does not use the original/etc/modules. the conf configuration file is used, but the new configuration file/etc/modprobe is used. conf. therefore, the command ". generate-modprobe.conf/etc/modprobe. conf "to generate a new configuration file/etc/modprobe. conf. however, the new configuration file has a BUG, which we will mention below.

4. update the mkinitrd program

The mkinitrd package depends on the device-mapper package, and the device-mapper package depends on the lvm2 package, so you need to download both the device-mapper-1.00.07-1.i386.rpm package and the lvm2-2.00.08-2.i386.rpm package.

5. configure, compile and install the linux-2.6.x kernel

The Makefile of the new kernel has been greatly changed. "make menuconfig" and "make xconfig" continue to exist, but "make xconfig" has been changed and the original Tcl/Tk language is no longer used, it is based on the QT library. "make gconfig" is added, which is based on the GTK Library. "make xconfig" and "make gconfig" are more powerful and easy to use than before. but unfortunately, they seem unstable ...... therefore, use my favorite "make menuconfig :-)

The configuration of the new kernel is as follows:

O for the "Loadable Module support" option, you must select the "Module unloading" and "Automatic kernel module loading" options.
O 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.
O for "Block Devices" configuration, you must select loopback and ramdisk support.
O for "Multi-device support (RAID and LVM)", select "device mapper ".
O for "Input device support", select "Keyboards" and "Mice.
O for "Graphics support", select the frame buffer support.
O for ALSA, select the "oss api emulation" option. The OSS does not need to be used.
O for USB, choose all options :-)
O for file systems, you can select the common ones. if you want to experience sysfs, you need to select sysfs support.

After the kernel is prepared, you can compile it directly. The "make dep" step has been explicitly required.

# Make bzImage
# Make modules
# Make modules_install
# Make install

The above command "make install" will: (1) copy the compressed kernel image to the/boot directory and create the corresponding System. map symbolic link; (2) modify the configuration file of bootloader; (3) call the mkinitrd program to create the initrd image of the kernel. for GRUB. add the following similar configuration lines to the conf configuration file:

Title Red Hat Linux (2.6.4)
Root (hd0, 1)
Kernel/boot/vmlinuz-2.6.4 ro root = LABEL =/
Initrd/boot/initrd-2.6.4.img

Unfortunately, the new kernel does not recognize the "root = LABEL =/" startup parameter. if you restart the new kernel now, the kernel panic error will occur. therefore, you must remove the "root = LABEL =/" startup parameter and then click OK.

By now, you can restart the machine and start it with kernel-2.6.4. of course, most of you will not succeed, either without a mouse or without a keyboard :-)

6. support for Hotplug

Of course, you must first configure HOTPLUG support during kernel configuration. then, because/proc/ksyms is renamed to/proc/kallsyms, you must modify the startup script/etc/rc. sysinit. to be compatible with the original linux-2.4.x system, you can add the following lines:

#
# ----- KERNEL 2.6.x support ------
# This is for compatibility between kernel-2.4.x and kernel-2.6.x
#
UNAME = 'uname-R'
KERNELVER =$ {UNAME: 0: 3}
If ["$ KERNELVER" = "2.6"]; then
#
# This is kernel-2.6.x
#
KSYMS =/proc/kallsyms
Else
#
# This is kernel-2.4.x
#
KSYMS =/proc/ksyms
Fi

Then, set rc. in the sysinit file, replace the/proc/ksyms with the "$ KSYMS" variable reference. after the configuration, you must also download the hotplug user-mode auxiliary toolkit: http://www.kernel.org/pub/linux/uti...4_03_11.tar.gz. after unlocking this package, you can simply "make install. it will generate the/etc/hotplug/configuration directory.

7. experience sysfs

First, create the directory/sys:

# Mkdir/sys

Then, follow these steps to modify the startup script/etc/rc. sysinit file:

O find the row mount-f/proc, and add it below:

If ["$ KERNELVER" = "2.6"]; then
Mount-f/sys
Fi

O find the row: action $ "Mounting proc filesystem:" mount-n-t proc/proc, and add this line below it:

#
# Mount/sys for kernel-2.6.x
#
If ["$ KERNELVER" = "2.6"]; then
Action $ "Mounting sysfs filesystem:" mount-n-t sysfs/sys
Fi

Next, add the following line to the/etc/fstab file:

None/sys sysfs defaults 0 0

Finally, modify the halt_get_remaining function in the/etc/init. d/halt script:

Set:
Awk '$2 ~ /^ \/$ | ^ \/Proc | ^ \/dev/{next}
Changed:
Awk '$2 ~ /^ \/$ | ^ \/Proc | ^ \/sys | ^ \/dev/{next}

8. support for USB devices

The name of the USB driver module of the linux-2.6.x has changed, so a lot of problems caused by this ......, the kernel module name for the host controller corresponding to the USB-2.0 is still ehci-hcd, the kernel module name for the host controller corresponding to the USB-1.1 has been changed from usb-ohci to ochi-hcd, the kernel module name corresponding to the general USB host controller has been changed from usb-uhci to uhci-hcd.

Unfortunately, the/etc/modprobe. conf configuration file generated when the module-init-tools package is installed still uses the usb-ohci name. for example:

Alias usb-controller usb-ohci
Alias usb-controller1 ehci-hcd

Therefore, you need to change it:

Alias usb-controller ohci-hcd
Alias usb-controller1 ehci-hcd

If this is not done, then the machine using the USB-1.1 host controller will not have the corresponding driver module when starting the kernel.

The module name that supports the USB keyboard is changed from keybdev to usb kbd, and the module name that supports the USB mouse is changed from mousedev to USB mouse. therefore, we must modify the startup script/etc/rc. sysinit file. at the same time, to be compatible with the original 2.4.x system, we define two variables at the beginning of the script:

#
# ----- KERNEL 2.6.x support ------
# This is for compatibility between kernel-2.4.x and kernel-2.6.x
#
UNAME = 'uname-R'
KERNELVER =$ {UNAME: 0: 3}
If ["$ KERNELVER" = "2.6"]; then
#
# This is kernel-2.6.x
#
KSYMS =/proc/kallsyms
KEYBDEV_NAME = usbkbd
MOUSEDEV_NAME = usbmouse
Else
#
# This is kernel-2.4.x
#
KSYMS =/proc/ksyms
KEYBDEV_NAME = keybdev
MOUSEDEV_NAME = mousedev
Fi

Then, change the keybdev and mousedev in the/etc/rc. sysinit script file to $ KEYBDEV_NAME and $ MOUSEDEV_NAME. change the needusb storage part in the script file/etc/rc. sysinit from:

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

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 usbhid 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

Okay. so far, we should be able to restart the machine. please try the latest kernel-2.6.4 :-)

9. others

O for questions about failure to use RPM commands on linux-2.6.x systems, see [2] and [6].
For more information about the sound card, see [2] and [6].
O for questions about running vmware on linux-2.6.x systems, see references [2] and [6].

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.