In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to customize and compile a Linux kernel of your own". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to customize and compile a Linux kernel of your own.
One compilation mode
There are many ways to compile the kernel. Download the kernel source code of the desired version from kernel.org.
Such as: linux-2.6.32-rc1.tar.bz2, download the kernel source code to the / home/user/ directory, enter the download directory, and extract the package.
# cd / home/user/
# tar-xjvf linux-2.6.32-rc1.tar.bz2
Prepare the compilation environment
Before you start, first make sure that the following software package has been installed (when compiling Puhua 4.0, directly installing all CD3 can guarantee this condition).
* rpmdevtools
* yum-utils
The fedora system can be installed using the following command:
# yum install yum-utils rpmdevtools
1. Generate a directory tree for the rpmbuild command to work, which can be done by the following command, or you can build the directory tree manually.
Command to create:
# rpmdev-setuptree
This command will generate the following directory structure under the / usr/src/rpmbuild/ directory (if this location does not exist, it may be under the current user directory).
# tree / usr/src/rpmbuild/
Rpmbuild/
| |-BUILD |
| |-RPMS |
| |-SOURCES |
| |-SPECS |
`- SRPMS
The above part is the environment establishment of rpmbuild. Rpm
3. Install the dependent components required by the kernel source package (you can skip this step here)
Su-c 'yum-builddep kernel-.src.rpm'
4. Install the kernel source code to the system. The default directory is / usr/src/neoshine:
Rpm-Uvh kernel-.src.rpm
Three configuration kernel (generate config configuration file)
The following describes how to unlock the source code package and modify, configure and repackage the source code
1. Unpack the source code package and put all the patches to the BUILD directory
Cd ~ / rpmbuild/SPECS
Rpmbuild-bp-target= `uname-m`kernel.spec
The kernel source code will be found here:
/ usr/src/neoshine/rpmbuild/BUILD/kernel-/linux-. Directory
Configure kernel source code
1. Enter the kernel source code:
Cd ~ / rpmbuild/BUILD/kernel-2.6.$ver/linux-2.6.$ver.$arch/
two。 Copy the / boot/config* configuration file to the source directory, and the config file can also be a kernel configuration file that has been configured or backed up elsewhere:
Cp / boot/config2.6- 2.6.$ver.$arch .config
3. First check the new options in the kernel configuration:
Make oldconfig
4. Customize kernel functions, turn off initrd support options, and execute graphical kernel configuration tools:
Make menuconfig
Note: find the initial RAM system and RAM disk (initramfs and initrd) support item under the generic setup option and cancel the compilation. At the same time, make sure that the driver corresponding to the file system and the driver corresponding to the memory of the system have been compiled into the kernel (otherwise the system will not be able to boot).
5. Change the first line of the .config file to the following (note: without this line, subsequent compilations will report an error)
# i386
6. Copy .config to SOURCES/:
Cp .config.. / SOURCES/config-$arch
Fourth, compile a new kernel
1. Let's start preparing to compile the new kernel package.
Open SPEC/kernel.spec
Vim SPEC/kernel.spec
By changing the following lines, you can customize your own kernel extension (such as fc10):
% define buildid.
The next step is to generate a new kernel rpm package, which requires compiling the kernel source package
Generate a new kernel source package using the following command
Rpmbuild-bb-with baseonly-without debuginfo-target= `uname-m`kernel.spec
Parameter description: bb means only binary packages are compiled, that is, no source code package is generated. Without debuginfo means no debugging information is available.
Target= `uname-r` means to generate a kernel package corresponding to the current platform
If the above command completes successfully, a new kernel installation package will be generated in the BUILD/i686 directory
5. Install a new kernel
Rpm-ivh kernel-$ver-$arch.rpm
This step automatically installs the kernel to the boot directory, installs the corresponding kernel module to the / lib/modules/ directory, and generates the grub boot menu for the new kernel.
Modify the grub boot menu to the following format
Title new kernel
Kernel / boot/vmlinuz-$ver-$arch root=/dev/sdax (hdax)
Note that do not use uuid to specify the file system (the root partition may not be mounted and cause the kernel to panic), and do not add and display related parameters (when the kernel does not support the corresponding settings, you will only see a black screen).
Thank you for your reading, the above is the content of "how to customize and compile your own Linux kernel". After the study of this article, I believe you have a deeper understanding of how to customize and compile your own Linux kernel. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.