Notes for Linux-2.6.21.3 compilation process

Source: Internet
Author: User
Linux-2.6.21.3 compilation process notes-Linux general technology-Linux programming and kernel information, below is the details to read. MACHINE: dell 1950
System: RedHat RHEL5 (2.6.18-8. el5)

1. Download linux-2.6.21.3.tar.bz2 from www.kernel.org.

# Wget http://www.kernel.org/pub/linux/... ux-2.6.21.3.tar.bz2

2. decompress the package to/usr/src.

# Tar jxvf linux-2.6.21.3.tar.bz2-C/usr/src/linux-2.6.21.3; cd/usr/src/

3. Create a soft linux-2.6.21.3 for linux

# Ln-s/usr/src/linux-2.6.21.3/usr/src/linux; cd/usr/src/linux

4. Optimize and modify the kernel 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


5. Copy the. config file from the/usr/src/kernels/2.6.18-8. el5-i686/directory of the original RHEL5 to/usr/src/linux

# Cp/usr/src/kernel/2.6.18-8. e15-i686/. config/usr/src/linux

6. Switch to/usr/src/linux to start compiling the new kernel.

# Cd/usr/src/linux; make menuconfig

Save and exit without any changes.

Note: ext4 file system is added to the kernel after 2.6.19. You can select ext4 file system module in file systems.


7. Compile and install
Step: 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)
Make modules_install install


Note: You can use make modules_install install to install the new kernel during the first compilation and installation. to update or upgrade the kernel, you only need to use make modules_install, and use make install to run panic when loading the new kernel!


8. Modify/etc/grub. conf
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a/boot partition. This means that
# All kernel and initrd paths are relative to/boot/, eg.
# Root (hd0, 0)
# Kernel/vmlinuz-version ro root =/dev/sda3
# Initrd-version.img/initrd
# Boot =/dev/sda
Default = 0
Timeout = 5
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Title Red Hat Enterprise Linux Server (2.6.21.3)
Root (hd0, 0)
Kernel/vmlinuz-2.6.21.3 ro root = LABEL =/
Initrd/initrd-2.6.21.3.img
Title Red Hat Enterprise Linux Server (2.6.18-8. el5)
Root (hd0, 0)
Kernel/vmlinuz-2.6.18-8.el5 ro root = LABEL =/
Initrd/initrd-2.6.18-8.el5.img

9. reboot

10. After startup
# Uname-r
2.6.21.3

The kernel is compiled and installed successfully.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.