现在的位置: 首页 > 综合 > 正文

RedHat9[kernel-2.4.20-8]编译kernel-2.6.10.readme

2019年04月21日 ⁄ 综合 ⁄ 共 2413字 ⁄ 字号 评论关闭

--Doing this for compilling the examples of LDD3.
--lovesid 2009.10.9
--
注:(注释),[First do this 可选]



一、准备工作:
1)
下载一份内核源代码linux-2.6.10.tar.gz
http://www.kernel.org/pub/linux/kernel/v2.6/

2)下载 module-init-tools-3.0.tar.gz" and "modutils-2.4.0-1.i386.rpm"
http://www.kernel.org/pub/linux/kernel/people/jcm/module-init-tools/attic/module-init-tools-3.0.tar.gz
http://www.kernel.org/pub/linux/utils/kernel/modutils/v2.4/modutils-2.4.0-1.i386.rpm

3)安装module-init-tools.
# tar -zxvf module-init-tools-3.0.tar.gz
# cd module-init-tools-3.0
# ./configure --prefix=/sbin
# make
# make install
# ./generate-modprobe.conf /etc/modprobe.conf

4)安装modutils-2.4.0-1.i386.rpm
# rpm -ivh  modutils-2.4.0-1.i386.rpm

5)解压缩内核源代码.把下载的源代码包放到目录/usr/src,然后
# cd /usr/src
# tar xvfj linux-2.6.10.tar.bz2
# cd linux-2.6.10

6)打补丁:linux-2.6-seg-5.patch
http://www.kernel.org/pub/linux/devel/binutils/linux-2.6-seg-5.patch
linux-2.6-seg-5.patch放到linux-2.6.10 目录:

# cd /usr/src/linux-2.6.10/
# patch –Np1 –i linux-2.6-seg-5.patch (-Np1 ,1 is number 1)
# source ./linux-2.6-seg-5.patch
(忽略出现的错误)

二、配置工作

# make menuconfig

使用i386默认配置 /usr/src/linux-2.6.10/arch/i386/defconfig

三、编译
[# make dep] 
[# make clean] 

# make bzImage
 
内核编译成功后,会在/usr/src/linux/arch/i386/boot目录中生成一个新内核的映像文件bzImage.
# make modules  (
编译可加载模块)
# make modules_install  (
安装可加载模块)
 
安装成功后,系统会在/lib/modules目录下生成一个2.6.10子目录,里面存放着新内核的所有可加载模块.

ATTENTION:下一步解决
make install
的时候可能会出现如下错误信息:No module BusLogic found for kernel 2.4.20
        mkinitrd failed
方法:
# vim /sbin/mkinitrd

 

...

for n in $scsimodules; do
# for now allow scsi modules to come from anywhere. There are some
# RAID controllers with drivers in block/
findmodule $n
done

...

 

change to

 

#for n in $scsimodules; do

# for now allow scsi modules to come from anywhere. There are some
# RAID controllers with drivers in block/
#findmodule $n
# done

 

 

# make install  (安装新内核)

[四、初始化新内核](因为已经自动做好了下面几步。# ls -l /boot)

# cp  /usr/src/linux-2.6.10/arch/i386/boot/bzImage   /boot/vmlinuz-2.6.10    
# cp  /usr/src/linux-2.6.10/System.map   /boot/System.map-2.6.10    
# cd  /boot
# rm –rf  System.map 
# ln –s System.map-2.6.10  System.map    
# new-kernel-pkg --mkinitrd --depmod --install 2.6.10

 

五、修改grub.conf
# df  (
查看根目录分区:例如 /dev/hda2)
# vim /boot/grub/grub.conf 
做两处修改:
[(1)
default=1改为default=0]
(2)
kernel行的“LABEL=/”换成根目录所在的分区(/dev/hda2)

default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.6.10)
        root (hd0,0)
        kernel /vmlinuz-2.6.10 ro root=/dev/hda2
        initrd /initrd-2.6.10.img
title Red Hat Linux (2.4.20-8)
        root (hd0,0)
        kernel /vmlinuz-2.4.20-8 ro root=LABEL=/
        initrd /initrd-2.4.20-8.img
六、
# reboot

 

 

 

 

抱歉!评论已关闭.