Linux kernel compilation

xiaoxiao2021-03-06  19

Recently, some parameters that Linux comes must be modified because of work needs. This must recompile the Linux kernel, so refer to some kernel compilation documents written by the online brothers, and recompiled the kernel of RedHat 9, and now write the kernel compilation process Under, I hope to be useful to everyone.

First, prepare for the Linux version: redhat9 comes with Linux-2.4.20-8

# CD / usr / src / # ln -s linux-2.4.20-8 Linux

Vi / usr / src / linux / makefile Modify Extraversion to your own specific version number to identify with the original version. Such as: -8custom_kunp1

Second, modify the kernel source code 1, set the maximum number of FD_SET supported A, modify /usr/include/bits/typesizes.h #define __fd_setsize 1024 ---> 65536 b, modify / usr / src / linux / include / Linux / POSIX_TYPES.H #define __fd_setsize 1024 ---> 65536

2, modification /usr/src/linux/include/linux/fs.h Set the maximum number of open 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 a, set Timeout's time for 1 second #define tcp_timewait_len (60 * hz) 60 ---> 1 * Hz B, set The number of retry times in the backlog queue, each time will spend the corresponding time, essentially resell the retry time #define tcp_synack_retries 5 ---> 3

4, to ensure that there is no incorrect .o file in the Linux directory. # CD / usr / src / linux # make mrproper

Third, Make Menuconfig

Use the following command to read the result of the configured data to take effect: # make dep # make Clean

Fourth, start compiling kernels and modules a, kernel: # make bzimage // generated / usr / src / linux / arch / i386 / boot / bzimage

B, module: # Make Modules // Time is longer, about 20 minutes # make modules_install // Generate /Lib/Modules/2.4.20-8CUSTOM_KUNP1 ("2.4.20" "- 8CUSTOM_KUNP1")

c, generate mirror files, generated under / boot CD / boot # mkinitrd 2.4.20-8custom_kunp1.img 2.4.20-8custom_kunp1 d, mobile bzimage to boot directory # mv / usr / src / linux / arch / I386 / BOOT / BZIMAGE BZIMAGE-KUNP1

V. Modify GRUB

转载请注明原文地址:https://www.9cbs.com/read-41548.html

New Post(0)