Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ CentOS How quickly customize kernel binary RPM package     - Computer security protection remove local and remote system log files (Linux)

- Shell Scripting Interview Questions (Programming)

- The YUM package management under Linux (Linux)

- Linux RAID Set RAID 10 or 0 + 1 (Linux)

- iscsiadm command usage (Linux)

- How Linux Log Analysis (Linux)

- CentOS 7 install Hadoop-cdh-2.6 (Server)

- Supervisor Installation and Configuration (Server)

- Debugging with GDB tool Go (Programming)

- Ubuntu users to install the system indicator SysPeek 0.3 (Linux)

- Linux Tutorial: Open multiple tabs in the GNOME terminal in Ubuntu 15.04 (Linux)

- Android using shape drawable material production (Programming)

- RHEL6.4 one key installation Redmine (Linux)

- Linux --- manual release system cache (Linux)

- The direct insertion sort algorithm (Programming)

- Android thread mechanism --AsyncTask (Programming)

- Nginx is used to build the cache module srcache_nginx (Server)

- CentOS install Memcached (Server)

- When Linux virtual machine to another copy of the operating system, a static IP NAT mode Invalid (Linux)

- JDK installation and configuration environment variable under linuxb (Linux)

 
         
  CentOS How quickly customize kernel binary RPM package
     
  Add Date : 2016-10-23      
         
         
         
  As more and more Linux server, underlying kernel version you want to keep the unity we need specialized custom binary packages to manage and easy to upgrade. RedHat-based course is to use rpmbuild do custom managed.

Today we divided two parts (root and ordinary users) to explain how to make the kernel binary rpm packages.

Building the host system environment conventions:

OS: CentOS release 6.6

Arch: i686

One, rpm package simple customization

Note: Here we first have to set aside at least 20GB of space for temporary files.

1, rpm pre-production environment to prepare:

yum -y groupinstall "Development Tools"
yum -y install ncurses-devel qt-devel
yum -y install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed xmlto
yum -y install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel
yum -y install newt-devel python-devel zlib-devel bc
2. Prepare the kernel source code components

cd / usr / src
wget -c https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.19.1.tar.xz
tar -Jxvf linux-3.19.1.tar.xz
ln -s linux-3.19.1 linux
cd linux
make oldconfig # verify and update the configuration .config configuration file (if you want to modify some small place on the basis of the original kernel configuration)
make menuconfig # simple graphical kernel configuration management
3. At this point, we can begin to compile a new kernel rpm package

make rpm # generated automatically rpmtree, kernel.spec file, automatically compiles, generates all rpm package components, including debug package.
This time we wait, or a cup of tea or something.

Well, we find some precompiled kernel rpm package.

cd / root / rpmbuild / RPMS / `uname -m` /
tree RPMS /
RPMS /
 i386
 kernel-3.19.1-2.i386.rpm
 kernel-devel-3.19.1-2.i386.rpm
 kernel-headers-3.19.1-2.i386.rpm
1 directory, 3 files
4, install the new kernel

rpm -Uvh kernel - * -. rpm
5, reboot, verify the kernel version

uname -a
Two, rpm package depth customization

1, we first created rpm of "production workshop" (I think this is some of the image may be more).

yum install rpmdevtools # rpm tool to quickly create a production workshop
useradd -m builder # Create a temporary user to create RPM packages, if an error occurs, the builder does not destroy the existing system environment.
su - builder
rpmdev-setuptree # Create "workshop production"
It will generate the following directory structure in the builder user's home directory:

tree -L 1 ~ / rpmbuild /
rpmbuild /
 BUILD
 RPMS
 SOURCES
 SPECS
 SRPMS
2, preparation before compiling

At this point we need to collect the package with the new kernel source package into the / home / builder / rpmbuild / SOURCES directory

su - builder
cd ~ / rpmbuild / SOURCES
wget -c https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.19.1.tar.xz
# Note: rpmbuild is done by building source packages before gzip decompression work, it is required to convert the compressed .tar.gz package format.
# Here do not record
cp / boot / config-`uname -r`. # existing kernel configuration file config-`uname -r` copied to the SOURCES directory
Switch to the SPECS directory, generate kernel.spec:

tar Jxvf ../ SOURCES / linux-3.19.1.tar.xz -C.
bash ../linux-3.19.1/scripts/package/mkspec> ./ kernel.spec
rm -rf linux-3.19.1
# Here we need to use the manual source package provides a script file generated kernel.spec
# Remember after generation after kernel.spec, clean out the linux-3.19.1 folder
vim kernel.spec # can do the depth of customization based on individual circumstances
At this point, our preparation work is substantially complete, the directory structure and contents are as follows:

tree rpmbuild / -a
rpmbuild /
 BUILD
 RPMS
 SOURCES
& Nbsp; & nbsp; config-`uname -r`
& Nbsp; & nbsp; linux-3.19.1.tar.gz
SPECS
& Nbsp; & nbsp; kernel.spec
SRPMS
5 directories, 3 files
3, well, now we start compiling the kernel binary rpm package:

rpmbuild -bb --with baseonly --without debug --without debuginfo --target = `uname -m` kernel.spec
rpmbuild parameters:

(1) --with < option> specified compile a particular kernel, alternative option has baseonly, smponly and xenonly like.

(2) --without < option> specified remove some functional modules, optional option has xen, smp, up, pae, kdump, debug and debuginfo like. Wherein, debug options eliminate kernel debugging code, debuginfo option would prohibit the establishment of kernel-debuginfo packages.

After completion, go to ~ / rpmbuild / RPMS / `uname -m` / directory Get rpm installation package.
     
         
         
         
  More:      
 
- How to install Linux Go Language (Linux)
- To delete the directory and all specified files under the Mac (Linux)
- Why is better than Git SVN (Linux)
- Lua study notes under ubuntu (Linux)
- Elaborate .NET Multithreading: Thread Pool (Programming)
- ethtool implementation framework and application in Linux (Linux)
- Linux, Chrome browser font settings beautification (Linux)
- Slow update statement Performance Analysis (Database)
- To configure parameter configuration and software installation and uninstallation under Linux (Linux)
- Debian 8 Jessie install LAMP server tutorial (Server)
- Linux ps command (Linux)
- Linux environment variable settings and save places (Linux)
- Difference Redhat5 and 6 YUM source configuration (Linux)
- Oracle Database ORA-01555 snapshot too old (Database)
- numpy and SciPy installation under Python for scientific computing package (Linux)
- Use SecureCRT to transfer files between Linux and Windows (Linux)
- Java implementation heap sort (large root heap) (Programming)
- Use Pylint regulate your Python code (Programming)
- C # DateTime structure common method (Programming)
- Linux Command Tutorial: Ubuntu apt-get command (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.