定制CentOS 内核 3.X编译 Custom kernel compilation on Centos 6.x

This procedure explains how to install a kernel 3.4.x on Centos 6.X.

Install required packages:
yum install ncurses-devel rpm-build
Get the kernel sources:
cd /usr/src
wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.4.47.tar.xz
tar xJf linux-3.4.47.tar.xz
cd linux-3.4.47
Configure the kernel:
cp /boot/config-2.6.32-220.el6.x86_64 .config
make oldconfig
make menuconfig
Compile the new kernel:
make -j 8 rpm
The kernel package will be available here: /root/rpmbuild/RPMS/x86_64/.

Install the new kernel:
cd /root/rpmbuild/RPMS/x86_64/
rpm -iv –replacefiles kernel-3.4.47-2.x86_64.rpm
the option –replacefiles might be required, because the kernels install files in /lib/firmware.
Create the new initrd archive:
mkinitrd /boot/initrd-3.4.47.img 3.4.47
Update the boot loader:
vi /boot/grub/menu.lst
then add the directives below:

title CentOS (3.4.47)
root (hd0,0)
kernel /vmlinuz-3.4.47 ro root=/dev/mapper/vg_system-lv_root rd_NO_LUKS KEYBOARDTYPE=pc rd_NO_MD quiet SYSFONT=latarcyrheb-sun16 rhgb crashkernel=auto rd_LVM_LV=vg_system/lv_swap rd_LVM_LV=vg_system/lv_root rd_NO_DM pcie_aspm=off
initrd /initrd-3.4.47.img

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注