Linuxeditor's internal kernel, Src package, non-tar.gz package

Source: Internet
Author: User
Tags rpmbuild
Linux general technology-Linux programming and kernel information. RedHat Enterprise Edition since AS4 and since FC3, the rpm installation package of kernel-sourcecode is no longer provided separately, because RedHat does not consider it necessary to maintain a separate kernel-sourcecode package, because all source code packages should be included. in. src. in rpm instead of in rpm. Therefore, you can manually install these later versions of RedHat packages, or compile the kernel-source package through kernel-*. src. rpm. The following method can be used to optimize some parameters and code of the RedHat kernel. Therefore, it is advantageous to use the RedHat release, especially the Enterprise version.

However, many people still cannot tell the relationship between kernel, kernel development, kernel source code, and some packages, so they often make detours when compiling the kernel, at the same time, the RedHat official website does not provide clear instructions for obtaining the kernel-source, which makes many users unable to get the necessary information.

First, identify the content and purpose of each rpm package.

Kernel-*. rpm ------------- kernel Binary Package. If no binary package exists, the system cannot start. Kernel-sourcecode -*. rpm ------------------- kernel source code package, installed in/usr/src/linux-* kernel compilation), but the high version of RedHat Linux does not provide this rpm, for the reason, see the official Release Note, the ultimate goal of this article is to develop this package by ourselves.

Kernel-devel-*. rpm -------------- kernel development kit, installed in/usr/src/kernels for kernel module development. The organization is similar to the kernel source code package and contains some kernel source code. Note that many people mistakenly think that this is the kernel source code package and use it to compile the kernel directly. Of course, it is impossible to succeed. This package is only used for kernel module level-1 development, such as drivers. Although you can also make menuconfig make dep, make bzImage is impossible because the core source code is missing.

Kernel -*. src. rpm --------------- the source code package provided by RedHat for creating rpm is installed in/usr/src/redhat. You can use rpmbuild to build all the packages mentioned above from this package.

Now let's start with src. rpm compiles all the above packages. Other packages except the sourcecode package can be directly built by rpmwithout any modification. Only sourcecode is troublesome, follow the steps below. I will use the RedHat AS4 version as an example. The other versions are the same.

# First install src. rpm


Rpm-ivh kernel-2.6.9-5.EL.src.rpm


# Go to the corresponding directory and modify the spec File


Cd/usr/src/redhat/SPECS
Vi kernel-2.6.spec


# The main changes are as follows:

1. define buildsource 0 ------------ I changed this to 1 in line 1, which is why there is no source code package because no source code package is generated by default.

2, Requires: qt-devel, gtk2-devel readline-devel ncurses-devel ------- I'm in line 572, if you don't use X, comment out this sentence, in this way, the compiled package does not depend on some packages of X-window, because the Kernel configuration can make xconfig, so the default dependency is X-window. I have not installed X-window, therefore, this is removed.

3.

# If you only need sourcecode and not all rpm packages, modify the following lines when modifying the spec file:


48% ifarch noarch
49% define builddoc 1
50% define buildsource 0 ---------------- here 0 is changed to 1


# Save and exit


Touch/etc/beehive-root


# This command is not required. If not, the final compiled package will become kernel -*. *-root. rpm, with a root added, is said to mark the package compiler. If you touch this file, there will be no such problem. The name is the same as the official rpm.

Using rpmbuild-ba -- target = noarch./kernel-2.6.spec during compilation saves a lot of time by compiling only the soucecode and doc packages.

Rpmbuild-ba -- target = i686./kernel-2.6.spec


# Compile all the packages on the i686 platform so that all the packages described above will be generated, or change to rpmbuild-bb -- target = i686./kernel-2.6.spec to compile only non-src. rpm.

# All packages are generated under/usr/src/redhat/RPMS/i686.

Install the/usr/src/redhat/RPMS/i686/kernel-source-* rpm package, enter/usr/src/linux-*/and then make menuconfig; modify the configuration kernel; then make & make modules & make modules_install & make install; Modify/boot/grub. start conf from Kernel
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.