Upgrade RedHat9.0 (Kernel2.4.20-8) to LinuxKernel2.6.15
Source: Internet
Author: User
Upgrade RedHat9.0 (Kernel2.4.20-8) to kernel2.6.15-Linux general technology-Linux programming and kernel information. For more information, see the following. Author: Kendiv
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
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. Do I manually install the new inner? Ystem. 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. 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;
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.