当前位置:Linux教程 - 内核技术 - 内核技术 - 内核编译简法

内核技术 - 内核编译简法

内核编译简法
2004-04-23 15:18 pm
来自:Linux文档
现载:Www.8s8s.coM
地址:无名

具体如下:太多了,打了主要的部分。有些地方没有说明,看命令就明白了。
1、下载内核文件如:linux-2.4.18-3.tar.gz拷贝到/usr/src目录并解压缩。
# cd /usr/src
# tar zvxf linux-2.4.18-3.tar.gz
2、进入解压目录。(/usr/src/linux-2.4.18-3,视文件名而定)
# cd /usr/src/linux-2.4.18-3
# make mrproper
# make xconfig
3、进行选译,自己设定个性化的内核。完后点“save and exit”

4、进行编译。
# make dep
# make clean
# make bzImage (I要大写哟)
5、编译模块。
# make modules
# make modules_install
# depmod -a
6、编译完成,开始替换文件。
# cd /boot
# rm System.map
# rm vmlinuz
# mv /usr/src/linux-2.4.18-3/System.map System.map
# mv /usr/src/linux-2.4.18-3/arch/i386/boot/bzImage vmlinux
7.修改开机设定。
GRUB是 /boot/grub/grub.conf文件 lilo是/etc/lilo.conf文件
可以用命令
# mkinitrd /boot/initrd-2.4.18-3.img 2.4.18-3来生成initrd文件。
用GRUB来举例子说。(红色部分)
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,7)
# kernel /vmlinuz-version ro root=/dev/hda10
# initrd /initrd-version.img
#boot=/dev/hda
default=1
timeout=5
splashimage=(hd0,7)/grub/splash.xpm.gz
title Red Hat Linux (2.4.18-3)
root (hd0,7)
kernel /vmlinuz-2.4.18-3 ro root=/dev/hda10
initrd /initrd-2.4.18-3.img
title win xp
rootnoverify (hd0,0)
chainloader +1
重启计算机,完工。
附加说明:
内核编译好后在以下几个位置的。
1。bzImage文件 /usr/src/linux-2.4.18-3/arch/i386/boot目录
2。外挂模块 /usr/src/linux-2.4.18-3/arch/i386/lib目录
3。已安装的模块文件 /lib/modules/2.4.18-3目录
好了就打到这儿,手都打软了,有没有稿费给我哟。找冷风肯定不行了,只有找你2位了。哈哈----