Compile and install Linux kernel 2.6.24

Source: Internet
Author: User
Compile and install the Linux kernel 2.6.24 -- general Linux technology-Linux programming and kernel information. For details, refer to the following section. I haven't compiled the kernel for a long time. Recently I want to get the driver. I checked that there are two folders under/usr/src, which are empty and do not have any kernel source code.

I used CentOS 5.1. In fact, the Red Hat series did not include the Linux kernel source code after the appearance of redora, so these headers won't be available at the moment when you have installed the system.

Of course, the following methods should apply no matter what version of linux is released.
Download www.kernel.org

Decompress the package to/usr/src:
Bzip2-dc linux-2.6.24.4.tar.bz2 | tar xvf-
Rename the folder linux-2.6.24.4 as: linux-kernel

Under any folder, write a shell file named a. sh with the following content:
#! /Bin/bash
Mkdir-p/home/name/build/kernel
Cd/usr/src/linux-kernel
Make mrproper
Make O =/home/name/build/kernel menuconfig
Make O =/home/name/build/kernel
Sudo make O =/home/name/build/kernel modules_install install


Then open a terminal and execute
Bash a. sh
In the shell file, "O =/home/name/build/kernel" indicates that the compilation configuration is carried out in the folder after "=". You can check it yourself.
In addition to Kernel configuration, you can skip the subsequent process.
In this process, a new kernel startup image is automatically generated and copied to the/boot directory without manual copying.

Then modify the grub. conf file to enable later systems to start with the new kernel:
Vim/etc/grub. conf
The content is as follows:
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a/boot partition. This means that
# All kernel and initrd paths are relative to/, eg.
# Root (hd0, 6)
# Kernel/boot/vmlinuz-version ro root =/dev/sda7
# Initrd/boot/initrd-version.img
# Boot =/dev/sda
Default = 2
Timeout = 5
Splashimage = (hd0, 6)/boot/grub/splash.xpm.gz
Hiddenmenu
Title CentOS (2.6.24.4)
Root (hd0, 6)
Kernel/boot/vmlinuz-2.6.24.4 ro root = LABEL =/rhgb quiet
Initrd/boot/initrd-2.6.24.4.img
Title CentOS (2.6.18-53. el5)
Root (hd0, 6)
Kernel/boot/vmlinuz-2.6.18-53.el5 ro root = LABEL =/rhgb quiet
Initrd/boot/initrd-2.6.18-53.el5.img
Title Windows XP
Rootnoverify (hd0, 0)
Chainloader + 1

Comment out this part:
Title CentOS (2.6.18-53. el5)
Root (hd0, 6)
Kernel/boot/vmlinuz-2.6.18-53.el5 ro root = LABEL =/rhgb quiet
Initrd/boot/initrd-2.6.18-53.el5.img
Change
# Title CentOS (2.6.18-53. el5)
# Root (hd0, 6)
# Kernel/boot/vmlinuz-2.6.18-53.el5 ro root = LABEL =/rhgb quiet
# Initrd/boot/initrd-2.6.18-53.el5.img

Modify default = 0 again. Here 0 corresponds to the first title, and so on.
Restart.

The output file for compiling the kernel is too large, that is,/home/name/build/kernel, which can be deleted at the end. Do not delete the driver.
Related Article

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.