2.0 将下载的源程序解压到 /usr/src 内
二、下载工具
2.0 下载 build-essential:apt-get install build-essential
2.1 下载 libqt3-header:apt-get install libqt3-header
2.2 下载 gcc:apt-get install gcc
备注:如果不下载,后面的 make xconfig 将提示:没有规则可以创建
三、配置并编译
进入 /usr/src 目录,以下操作都是在该目录下进行:
3.0 make xconfig 配置 linux 内核信息,如果需要在嵌入式中装 linux 这点很重要。
3.1 make clean(当源被重新编译需要执行)
3.2 make
3.3 make modules_install
3.4 cp /arch/i386/boot/bzImage /boot/vmlinuz-
3.5 cp System.map /boot/System.map
3.6 mkinitramfs -o /boot/initrd.img-
3.7 修改/boot/grub/grub.cfg
Reboot
四、遇到问题
4.0 ‘No rule to make target `xxx‘.’和
“没有规则可以创建目标** ”解释为:
This means that make decided it needed to build a target, but then couldn’t find any instructions in the makefile on how to do that, either explicit or implicit (including in the default rules database).
If you want that file to be built, you will need to add a rule to your makefile describing how that target can be built. Other possible sources of this problem are typos in the makefile (if that filename is
wrong) or a corrupted source tree (if that file is not supposed to be built, but rather only a prerequisite).
4.1 bzImage (中间 I 是大写的 i,不是小写的 L)很多人都写错了
4.2 如果发现自己的 /boot/grub 内没有 menu.lst,修改 grub.conf也是一样的
4.3 重启后遇到“Could not load /lib/modules/2.6.39.4/modules.dep ”但实际进去看后,该文件存在,这是因为 initrd.img- 没有生成好,删除原来的文件 initrd.img-update-initrdramfs –c –k 2.6.39.4 重新生成
4.4 中间“make xconfig”提示“没有规则创建 xconfig”,这是因为
libqt3-header 没有安装,需要先更新源文件服务器,apt-get update 更新源文件,再下载即可
4.5 mkinitrd 是 RedHat 独有的,在编译其他内核时,应该采用 mkinitramfs
命令
五、参考