[root@vhost data]# tar -jxvf linux-2.6.35.4.tar.bz2
[root@vhost data]# mv linux-2.6.35.4 /usr/src
[root@vhost data]# cd /usr/src/linux-2.6.35.4
#配置内核参数,选择自己所需的模块
[root@vhost linux-2.6.35.4]# make menuconfig
#编译安装内核
[root@vhost linux-2.6.35.4]# make
[root@vhost linux-2.6.35.4]# make modules
[root@vhost linux-2.6.35.4]# make modules_install
[root@vhost linux-2.6.35.4]# make install
[root@vhost linux-2.6.35.4]# vi /boot/grub/grub.conf
default=0
#将新的内核配置文件复制到/boot目录。
[root@vhost linux-2.6.35.4]# cp /usr/src/linux-2.6.35.4/.config /boot/config-2.6.35.4
[root@vhost linux-2.6.35.4]# reboot
[root@vhost /]# uname -r
2.6.35.4
一、启动报错
mount: could not find filesystem ‘/dev/root’
setuproot: moving /dev failed: No such file or directory
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
switchroot: mount failed: No such file or directory
Kernel panic – not syncing: Attempted to kill init!
执行完make menuconfig后,修改/usr/src/linux-2.6.35.4/.config
将#CONFIG_SYSFS_DEPRECATED_V2 is not set
默认被注释掉的,将其改为y。即修改为
CONFIG_SYSFS_DEPRECATED_V2=y
再接着编译安装内核
insmod: error inserting '/lib/dm-region-hash.ko' : -1 File exists
1、解压initrd文件
[root@vhost ~]# cp /boot/initrd-2.6.35.4.img /tmp
[root@vhost ~]# cd /tmp/
[root@vhost tmp]# ls
initrd-2.6.35.4.img
[root@vhost tmp]# mkdir newinitrd
[root@vhost tmp]# cd newinitrd/
[root@vhost newinitrd]# zcat ../initrd-2.6.35.4.img |cpio -i
11282 blocks
释放之后看到如下内容
[root@vhost newinitrd]# ls
bin dev etc init lib proc sbin sys sysroot
echo "Loading dm-region-hash.ko module"
insmod /lib/dm-region-hash.ko
echo "Loading dm-region-hash.ko module"
insmod /lib/dm-region-hash.ko
[root@vhost newinitrd]# find .|cpio -c -o > ../initrd
11282 blocks
[root@vhost newinitrd]# cd ..
[root@vhost tmp]# gzip -9 < initrd > initrd.img
[root@vhost tmp]# ls
initrd-2.6.35.4.img initrd initrd.img newinitrd
[root@vhost tmp]# mv /boot/initrd-2.6.35.4.img /boot/initrd-2.6.35.4.img.bak
[root@vhost tmp]# mv initrd.img /boot/initrd-2.6.35.4.img
[root@vhost tmp]# reboot
这样“insmod: error inserting '/lib/dm-region-hash.ko' : -1 File exists” 就不会有了