To compile the linux module on the X86 platform, the original operating system is not equipped with the kernel source code. Therefore, the kernel cannot be compiled, and the kernel module cannot be tested. According to a lot of information, I decided to upgrade the linux kernel version. The upgrade is successful. The method is summarized as follows:
I. Environment
Red Hat Enterprise 5: Enter the root user in linux
# Uname-r
2.6.18-53. el5
Ii. Upgrade process
1) download the kernel
Before upgrading to www.kernel.org to see if there is any latest kernel, so far the latest is 2.6.30, is: http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.tar.bz2
2) Copy linux-2.6.30.tar.bz2 to the/usr/src directory, decompress the following command to get the folder linux-2.6.30
Tar xjvf linux-2.6.30.tar.bz2
3) make mrproper
This step can be omitted if it is the first compilation.
4) copy the original config file to the linux-2.6.30 directory
# Linux-2.6.30/cd/usr/src/
# Cp/boot/config-2.6.18-53.el5. config
5) make menuconfig
Select Load an Alternate Configuration File and import the. config File to simplify or add functions.
Note: There are two Kernel configuration methods: one is directly placed into the kernel *; the other is compiled into the module M; the two methods have their own advantages; directly compiled into the kernel, for example, when a device starts, the module does not need to be loaded; when compiled into a module, the module supported by the kernel of the device needs to be loaded; however, it is not feasible to directly compile everything into the kernel. The kernel size will increase and the system load will be too heavy. When compiling the kernel, it is best to include the most important data into the kernel. If you do not understand anything else, you 'd better use the default value.
6) Compile the kernel
Make bzImage
7) Compile the kernel module
Make modules
8) install the kernel module
Make modules_install
(PS: copy the compiled kernel module from the kernel source code directory to/lib/modules)
9) Create an init ramdisk.
Mkinitrd initrd-2.6.30 2.6.30
(PS: 2.6.30 must be available under/lib/modules)
10) cp arch/x86/boot/bzImage/boot/vmlinuz-2.6.30
(PS: the name of the vmlinuz-2.6.30 can be obtained at Will)
11) cp initrd-2.6.30/boot/
12) vi/etc/grub. conf
(PS: It mainly refers to copying the part of the source kernel and then modifying it. The main part is the title, kernel, and initrd)
13) reboot