1. install the dependency package: [root @ CentOS5 ~] # Yum-yinstallwgetmakegccperlncurses-devel2. download kernel version: [root @ CentOS5 ~] # Wgethttps: // www. ke
1. install the dependency package:
[Root @ CentOS5 ~] # Yum-y install wget make gcc perl ncurses-devel
2. download the kernel version:
[Root @ CentOS5 ~] # Wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.7.tar.gz
3. move the kernel to the corresponding directory and decompress it:
[Root @ CentOS5 ~] # Music linux-3.8.7.tar.gz/usr/src/
[Root @ CentOS5 ~] # Cd/usr/src
[Root @ CentOS5 src] # tar-zxvf linux-3.8.7.tar.gz
4. switch the directory:
[Root @ CentOS5 src] # cd linux-3.8.7
5. clear environment variables:
[Root @ CentOS5 linux-3.8.7] # make mrproper
6. in menu mode, select the kernel module to be compiled:
[Root @ CentOS5 linux-3.8.7] # make menuconfig
7. make sure everything is up to date:
[Root @ CentOS5 linux-3.8.7] # make clean
8. edit. config:
[Root @ CentOS5 linux-3.8.7] # vi. config
Add the following content:
CONFIG_SYSFS_DEPRECATED_V2 = y
CONFIG_SYSFS_DEPRECATED = y
Save and exit;
9. edit hid-example.c:
[Root @ CentOS5 linux-3.8.7] # vi/usr/src/linux-3.8.7/samples/hidraw/hid-example.c
Move the following three rows in the row 13-15 to the row 33:
13 # include
14 # include
15 # include
29 # include
30 # include
31 # include
32 # include
33 # include
10. edit input. h:
[Root @ CentOS5 linux-3.8.7] # vi/usr/include/linux/input. h
Line 647
# Define BUS_PCI 0x01
# Define BUS_ISAPNP 0x02
# Define BUS_USB 0x03
# Define BUS_HIL 0x04
# Define BUS_BLUETOOTH 0x05
/* Add the following line */
# Define BUS_VIRTUAL 0x06
# Define BUS_ISA 0x10
# Define BUS_I8042 0x11
# Define BUS_XTKBD 0x12
# Define BUS_RS232 0x13
# Define BUS_GAMEPORT 0x14
# Define BUS_PARPORT 0x15
# Define BUS_AMIGA 0x16
# Define BUS_ADB 0x17
# Define BUS_I2C 0x18
# Define BUS_HOST 0x19
# Define BUS_GSC 0x1A
/* Add the following two actions */
# Define BUS_ATARI 0x1B
# Define BUS_SPI 0x1C
11. generate a new kernel:
[Root @ CentOS5 linux-3.8.7] # make bzImage
12. Compile the kernel module:
[Root @ CentOS5 linux-3.8.7] # make modules
13. installation module:
[Root @ CentOS5 linux-3.8.7] # make modules_install
14. installation:
[Root @ CentOS5 linux-3.8.7] # make install
15. restart:
[Root @ CentOS5 linux-3.8.7] # reboot
**************************************** *************************
Others:
# Make localmodconfig streamline the kernel and only compile the lsmod loaded modules for streamlining the kernel configuration.
# Make-jn bzImage n indicates the number of CPU cores used to compile the kernel host. for example, if the CPU of my host is 1 2 cores, n = 2 can increase the compilation speed.
# Make INSTALL_MOD_STRIP = 1 modules_install add this parameter to reduce the size of the compiled module.