Upgrade Red Hat 9.0 (kernel 2.4.20-8) to Linux kernel 2.6.15 (most comprehensive)

Source: Internet
Author: User


Author: kendiv
Prepared on: 2006/02/01

***********************************
1. install necessary tools
***********************************
1. Install module-init-tools-3.2.tar.gz
: Http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/

Installation Method:
# Tar zxvf module-init-tools-3.2.tar.gz
# Cd modules-init-tools-3.2
#./Configure -- prefix =/
# Make moveold
# Make all install
#./Generate-modprobe.conf/etc/modprobe. conf

2. Upgrade mkinitrd
: I have not upgraded mkinitrd. Search in Goole.

Note:
If the loading module does not provide information that is incompatible with the kernel version, you do not need to re-download the mkinitrd program to compile the module to generate initrd. Because 2.6 is different from 2.4, not every module is changed,
If the module you are using is not changed, you do not need to do anything.

Specific:
1) if you do not use lvm2 or LVM for volume management, you do not need to download the new version of mkinitrd.
2) if you do not use the new module in 2.6 or the new module has been compiled into the kernel, it means that the initrd. IMG used in 2.4 does not change, even initrd. IMG does not need to be generated.

Initrd. IMG is loaded into the memory by bootload, And the ext3 compilation module can be started in initrd. According to my understanding, ext3 does not need to be compiled into the kernel, but in practice,
If it is not compiled into the kernel, the following error occurs:
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.
This can be solved by recreating initrd. IMG. In grub. conf, root = lable =/must be changed to an absolute Partition Number, because initrd. IMG is not generated.

To install the latest mkinitrd, note that the new mkinitrd requires lvm2 and device-mapper.
Install with rpm-IVH -- nodeps mkinitrd-4.1.18-2.i386.rpm

Use rpm-IVH -- nodeps lvm2-2.00.25-1.01.i386.rpm when installing the lvm2-2.00.25-1.01.i386.rpm

3. Install the hotplug tool. If this tool is not available, the USB mouse cannot be used even if the OK button is displayed on the start. The 2.6.15 kernel can use hotplug-2004_09_23.tar.gz.
: Http://www.kernel.org/pub/linux/utils/kernel/hotplug/

Installation Method:
# Tar zxvf hotplug-2004_09_23.tar.gz
# Cd hotplug-2004_09_23
# Make install

4. download the latest kernel source code
: Http://www.kernel.org/pub/linux/kernel/

***********************************
2. Prepare the kernel source code tree
***********************************
1. After downloading the tarball package, copy the kernel tarball package to the/usr/src directory. If the package is in the current directory, run the following command:
# Cp linux-2.6.0.tar.gz/usr/src

2. Go to the/usr/src directory and unbind the tarball package,
# Cd/usr/src
# Tar xvzf linux-2.6.0.tar.gz

By default (using Intel x86 CPU series), the following step can be omitted.
3. Link/usr/include/ASM,/usr/inlude/Linux,/usr/include/SCSI to the corresponding directory under/usr/src/Linux/include.
# Cd/usr/include
# Rm-rf asm Linux
# Ln-S/usr/src/Linux/include/asm-i386 ASM (if you use another CPU such as PPC, you need to connect to the appropriate directory)
# Ln-S/usr/src/Linux/include/Linux
# Ln-S/usr/src/Linux/include/SCSI

4. If you have downloaded the patch package, install the patch. You can also run the scripts/patch-kernel script file to automatically patch the patch (prepare the patch package) or # zcat patch-2.6.0.gz | patch-P1 (I'm lazy without patching ).

5. Modify the kernel source code. (upgrade 2.6 to optimize the kernel. You can change the source code)

1) Modify/usr/src/Linux/include/Linux/posix_types.h
Set the maximum number supported by fd_set
# DEFINE _ fd_setsize 1024 --->; 65536

2) Modify/usr/src/Linux/include/Linux/fs. h
Set the maximum number of opened files (number of TCP connections)
# Define inr_open 1024 --->; 65536
# Define nr_file 8192 --->; 65536
# Define nr_reserved_files 10 --->; 128

3) Modify/usr/src/Linux/include/NET/tcp. h
Set the timeout time to 1 second.
# Define tcp_timewait_len (60 * Hz) 60 --->; 1 * Hz
Set the number of semi-join retries in the backlog queue. Each time, the corresponding time is spent, which is essentially to reduce the retry time.
# Define tcp_synack_retries 5 --->; 3

***********************************
Iii. customized kernel
***********************************
Clear the source code tree before preparing the kernel. If you have not entered the/usr/src/linux-2.6.0 directory, go to this directory with the command below:
# Make clean
# Make mrproper (this step is used to ensure that there is no correct. o file and file dependency in the original code directory. This step is not required for the just-unlocked tarball package)

Note: You can use make help to view help information.

Then you can use the following four commands to configure the kernel:
# Make gconfig (supported by the GTK Development Library)
# Make xconfig (supported by the QT Development Library)
# Make config
# Make menuconfig (recommended)

Configure core options
# Make menuconfig
Basically, you can keep the default options, but note that the ext2 and ext3 file systems must be compiled into the kernel. Otherwise, an error occurs when you upgrade the kernel and restart it:
Kernel panic: No init found. Try passing init = option to Kernel

The ext2 and ext3 file systems are configured as follows: (select all)
File systems --->
<*> 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

Note:
If you are an ext3 file system, you can directly compile the support for ext3 and ext2 files into the kernel when customizing the Kernel configuration file. Otherwise, the machine will crash when you enable the new kernel, the error message is as follows:
Kernel panic: No init found, try passing init = option to kernel ......
Or:
Kernel panic: VFS: Unable to mount root FS on unknown-block (0, 0)
You can directly compile the support for ext3 and ext2 file systems into the kernel to solve this problem. You can also select the "module unloading" option. Otherwise, you will not be able to uninstall in the new kernel Environment
Kernel module (the rmmod command cannot be used ).

***********************************
4. Compile the kernel and modules
***********************************
After the kernel is configured, compile:
# Make Dep (this step is not required to compile the 2.6 kernel)

# Make-JN (N indicates the process of simultaneous compilation, which can speed up compilation. N is determined by your configuration, and my configuration is 15-25)

Note: This command has completed make bzimage and make modules. The generated bzimage Kernel File is in the arch/i386/boot directory, and the file storage location varies depending on the CPU core.

Note: This step takes 30 minutes or longer depending on the machine configuration.

***********************************
5. Compile and load modules and install new kernels
***********************************
If you have set the loadable modules When configuring the kernel, You need to compile these modules so that you can use the insmod command to load them in the future.
# Make modules-j25
# Make modules_install (install the kernel module to/lib/modules/2. x. x)
# Make install (copy the mkinitrd command and kernel (bzimage) and system. map)

After the installation is complete, check the/boot directory. The file name is different. For GRUB boot, The make install command has automatically modified the boot options for you and the Lilo Command needs to be manually modified, rewrite the Boot Record.

***********************************
6. Modify the corresponding file to adapt to the 2.6 kernel
***********************************
1. the USB device name of kernel 2.6 is different from that of kernel 2.4. So we need to change it.

The/etc/modprobe. conf configuration file generated when the module-init-Tools Package is installed still uses the USB-OHCI name.

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

2. You need to change the most important file/etc/rc. sysconfig. This is an ln connection. The file is in/etc/rc. d /.

# Vi/etc/rc. sysinit

Change/proc/ksyms to the following (Note: Hotplug support is configured)

Ksyms =/proc/ksyms

Changed:

Ksyms =/proc/kallsyms

3. Change all mount-F-T usbdevfs to mount-F-T usbfs. I can view only two of them.

4. I don't know why to create a/sys system, but you are prompted that the drivers file cannot be found using the default/proc/bus/USB. Dizzy.
# Mkdir/sys

6. Modify the RC. sysconfig File

Add in Mount-F/proc
Mount-F/sys

7. # Mount/proc (done here so volume labels can work with fsck)
Action $ "mounting proc filesystem:" Mount-n-t proc/proc
Action $ "mounting sysfs filesystem:" Mount-n-t sysfs/sys
Join the above line

8. Modify fstab
# Add VI/etc/fstab as follows
None/sys sysfs defaults 0 0
.

9. Modify/etc/init. d/halt as follows:
Awk '$2 ~ /^/$ | ^/Proc | ^/dev/{next}
Change
Awk '$2 ~ /^/$ | ^/Proc | ^/sys | ^/dev/{next}

10. Change needusbstorage = to the following

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 2>/dev/null
Action $ "Initializing USB mouse:" modprobe mousedev 2>/dev/null
Fi

Changed:
Needusbstorage =
If [$ USB = "1"]; then
Needusbstorage = 'lc _ all = C grep-e "^ I. * CLS = 08"/sys/bus/USB/Devices 2>/dev/null'
Action $ "Initializing USB hid interface:" modprobe usbhid 2>/dev/null
Action $ "Initializing USB keyboard:" modprobe usbkbd 2>/dev/null
Action $ "Initializing USB mouse:" modprobe usbmouse 2>/dev/null
Fi

Reboot should be completed! I hope it will be OK at startup.

Supplement:
***********************************
7. Manually install the new kernel and system. Map
***********************************
1. Copy the new kernel and system. Map files to the/boot directory.
# Cp/usr/src/linux-2.6/ARCH/i386/boot/bzimage/boot/vmlinuz-2.6.15-10custom
# Cp/usr/src/linux-2.6/system. MAP/boot/system. map-2.6.15-10custom
# Cd/boot
# Rm-F system. Map (delete the original connection)
# Ln-S system. map-2.6.15-10custom system. Map (reconnect)

***********************************
8. Configure lilo
***********************************
1. Configure the/etc/Lilo. conf file and add the following lines to the file:
Image =/boot/vmlinuz-2.6.15-10custom
Label = Linux-custom
Initrd =/boot/initrd-2.6.15-10.img
Read-Only
Root =/dev/hda3 (this is related to your specific configuration)
Change default = Linux to default = Linux-custom.

2. Make the new configuration take effect
#/Sbin/lilo

***********************************
9. Configure grub to use the 2.6 I/O Scheduler
***********************************
Before setting, we will first introduce the 2.6 I/O scheduler.
2.6 The four I/O schedulers are no-op I/O schedory, anticipatory I/O schedory, deadline I/O schedory, and cfq I/O scheduler.
In this document, NS, As, DS, and CFQ are referred to respectively.

NS is a simplified scheduling program that only performs the most basic merging and sorting. The relationship with the desktop system is not very great, mainly used in some special software
In the hardware environment, these software and hardware generally have their own scheduling mechanism with little requirements for Kernel support, which is suitable for some embedded system environments. As a desktop user, we generally do not choose it.

As is the default I/O scheduler in the current kernel. It has very good performance, and it is quite noticeable in 2.5. In the comparison test with the 2.4 kernel, more than 2.4 items are measured in minutes.
The completed task is completed in seconds. Because of this, it becomes the default I/O scheduler in the current 2.6 beta version. However, it also has vulnerabilities, which are large and complex,
In some special cases, especially in database systems with very large data throughput, it will become slower.

DS improves the performance of AS. It is still in the testing stage, but it is stable. Currently, the performance is almost as good as that of. In addition, it is smaller than,
It is a promising scheduler and is worth a try :)

CFQ allocates the same bandwidth to all tasks in the system and provides a fair working environment, which is suitable for desktop environments. In fact, it has a good performance in testing,
Mplayer xmms and other multimedia players work very well with it, And playback is smooth and there is almost no frame jump caused by access to the disk. If you want to listen to music and watch movies in Linux, try it.

Now, let's talk about how to set the parameter format: Elevator = scheduler name.

Modify/boot/GRUB/grub. conf and add elevator = deadline

Example: kernel/boot/vmlinuz-2.6.10-bk4 Ro root =/dev/your root partition elevator = deadline

***********************************
Possible problems and countermeasures when using the new kernel
***********************************
1. The RedHat user RPM command cannot be used. Solution: declare the variable in the global configuration file.
This is a bug in RPM. Especially for rh9 users, open the/etc/profile file and run the following command:
# Vi/etc/profile (Add the following sentence at the end of the file)
If ['uname-R' = "2.6.0"]; then
Export ld_assume_kernel = 2.2.5
Fi
That is, add a global environment variable to the system, or directly type # export ld_assume_kernel = 2.2.5.

2. The new kernel cannot be started at all. Solution: reconfigure the kernel (learning a lot). Maybe it is related to the root Boot Record (rarely );

3. the new kernel module cannot be loaded, which may cause many problems. For example, the firewall cannot work, and the disk cannot be mounted, the vfat and NTFS file systems. The solution is to upgrade the module-init-Tools Package,
The RedHat user may need to modify the/etc/rc. d/rc. sysinit file;

********** ****************

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.