Download source code
Linux Kernel is always evolving. The latest kernel Kernel2.6.0 officially supports USB2.0, and the most significant change in kernel module File suffix is *. o *. ko and so on. We can download the tarball source code package from www.kernel.org.
Preparations
We all know that we need to upgrade the "module-init-tools" Package first. Otherwise, when you install the kernel module file, the system will prompt you: Warning: you may need to install module-init-tools See http://www.codemonkey.org.uk/post-h..4.21-23.src.rpm.
Go to the download directory and install:
# Rpm-e -- nodeps modutils forcibly uninstall the original modutilsRPM package)
# Rpm-ivh modutils-2.4.21-23.src.rpm Install the source code package to the/usr/src/redhat Directory) # Cd/usr/src/redhat/SPECS to enter the standard file directory) # Rpmbuild -- bb modutils. spec to generate a binary RPM package) # Cd ../RPMS/i386 transfer to the location of the generated binary RPM package) # Rpm-ivh modutils *. rpm just generated two [modutils-2.4.21-23.i386.rpm With the modutils-debuginfo-2.4.21.23.i386.rpm] binary RPM package, install it together !) |
Because it is on the RedHat9.0 platform, RedHat users may encounter some problems. I will slowly say that in addition to the above upgrades, there is also a file/etc/rc. d/rc. sysinit) may be defective because the/proc/ksyms file is no longer available in the new kernel Kernel2.6.0). The command to open the file is as follows:
# Vi/etc/rc. d/rc. sysinit
Find: if! LC_ALL = C grep-iq nomodules/proc/cmdline 2>/dev/null & [-F/proc/ksyms]; then USEMODULES = yfi Replace with: if! LC_ALL = C Grep-iq nomodules/proc/cmdline 2>/dev/null; ThenUSEMODULES = yfi |
That is to say, remove "& [-f/proc/ksyms]". It is best to back up the file before saving it to avoid deletion errors. This file is the initial script of the system and is very important ), in this way, the kernel can load the module. Of course, the iptable firewall can be started. Otherwise, the red "failed" of the firewall when it is started in the new kernel is very eye-catching. Check whether the content in/proc/sys/kernel/modprobe in the new kernel is/sbin/modprobe. You can also manually inject the command: # echo "/sbin/modprobe">/proc/sys/kernel/modprobe ). Start to construct the new kernel.
I. Prepare source code
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
|
3. If you have downloaded the patch package, you can also run the scripts/patch-kernel script file to automatically patch the patch to prepare the patch package) or # zcat patch-2.6.0.gz | patch-p1.
Ii. customized kernel
Customized kernel is a great learning and requires a lot of hardware knowledge, especially the 2.6.0 kernel. If you load it from the 2.4.N configuration file, it is true that many people are in trouble. I'm re-configuring file X Window server), please clean up the source code tree before preparing the kernel, if you have not entered the/usr/src/linux-2.6.0 directory, please enter this directory, the command is as follows:
# Make mrproper (this step is not required for the unlocked tarball package)
# Make gconfig (supported by the Gtk Development Library) Or make config or make xconfig (requires support from the Qt Development Library) |
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). I didn't know it at first. After compiling it several times, the system always gives me a cold bench, finally, the support for Ext3 and Ext2 file systems is directly compiled into the kernel to solve this problem, and the "Module unloading" option is also selected. Otherwise, you Cannot uninstall the kernel module rmmod command in the new kernel environment ).
3. Compile the kernel and modules
Customized Kernel configuration file/usr/src/linux-2.6.0 /. config) Later, the exciting moment is coming. Compile the kernel and module, # make (this command has completed the work of make bzImage and make modules ), bzImage kernel files are stored in the arch/i386/boot directory. The file storage location varies depending on your CPU. I am an Intel CPU.
Note: When I was on the RedHat7.2 platform, I encountered an error message that could not be compiled. The error message is as follows:
/tmp/cc2Hu7sH.s:3: Error: Unknown pseudo-op:
`.incbin'make[1]: *** [usr/initramfs_data.o] Error 1make: *** [usr] Error 2, |
This problem can be solved only when 9.0 is reinstalled. Note: The make command ran for 27 minutes on my 1.6 GHz MB machine.
Iv. Installation modules and kernel files
# Make modules_install install
The preceding commands can be divided into make modules_install and make install, and make modules_install to install the kernel module to/lib/modules/2.6.0. Make install to complete the mkinitrd command and kernel bzImage) and System. for details about copying map files, see the/boot directory. The file names are different. For GRUB boot tool, the make install command has automatically modified the boot options for you and must be manually modified for LILO, rewrite the Boot Record.
Note: The "make modules_install install" command runs for only 30 seconds on my 1.6 GHz and M machines, which is very fast.
V. Postscript
The final task is to restart the system # shutdown-r now). Check your labor results. I almost forgot one more point. It may be very important to you. After entering the new kernel, I found that the rpm command was unavailable. It turned out to be a Bug of RPM, especially for users of RH9, open the/etc/profile file and run the following command:
# Add the following statement to the end of the vi/etc/profile file)
If ['uname-R' = "2.6.0"]; Thenexport 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.
Possible problems and countermeasures when using the new kernel:
1. The new kernel cannot be started at all. solution: it is very difficult to reconfigure the kernel.) Maybe there are very few root boot records ).
2. The new kernel module cannot be loaded, which may lead to many problems. For example, if the firewall cannot work, the disk cannot be mounted and the vfat and ntfs file systems cannot be mounted. The solution is as follows: upgrade module-init-tools Package I am modutils-2.4.21-23. src. rpm package), RedHat users may need to modify/etc/rc. d/rc. sysinit file.
3. The RedHat user rpm command cannot be used. Solution: declare the variable in the global configuration file.
Related Articles]
- How to delete the old kernel of Ubuntu Linux
- Compiling process of Linux kernel modules and drivers
- Significance and application of network parameters in Linux Kernel