Debian 4.0 编译内核 2.6.27.6

 

 

1、如果安装Debian 4.0基本系统(不带GUI),执行如下命令(在超级用户下):

        apt-get install build-essential libncurses5-dev initrd-tools

    build-essential是编译内核要用到的工具。

    ncurse-dev是执行build menuconfig要用到的。

    initrd-tools是创建initrd要用的,如果使用SCSI硬盘,应该创建initrd,以便加载SCSI驱动。

2、下载内核并解压缩,进入相应目录(在普通用户下)

3、配置(在普通用户下)

        make menuconfig

4、删除以前编译的文件(在普通用户下)

       make clean

5、编译(在普通用户下)

        make

6、复制module(在超级用户下)

        make modules_install

7、复制内核 (在超级用户下)

       make install

8、生成initrd(在超级用户下)

       mkinitrd initrd.img-2.6.27.6 2.6.27.6

       mv initrd.img-2.6.27.6 /boot

9、编辑menu.lst,在文件末尾加入如下内容(在超级用户下)

 

       title       kernel 2.6.27.6 test

       root      (hd0,0)

       kernel    /boot/vmlinuz-2.6.27.6 root=/dev/sda1 ro

       initrd     /boot/initrd.img-2.6.27.6

       savedefault


   

       

 

注意事项:

1、2.6.x以后的内核不需要执行make dep了。

2、当我们编译了一个新的内核,不要忘了为我们的scsi设备做一个新的initrd镜像,否则可能出现如下错误:

    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

语法:

mkinitrd 文件名 内核的目录名

示例:

mkinitrd  initrd.img-2.6.27.6  2.6.27.6

说明:

initrd.img-2.6.27.6文件名可以自己任意取,但最好对应自己的内核版本号。

2.6.27.6是/lib/modules下的目录名,该目录是在执行make modules_install时生成的,对应内核的版本。


 

参考:

http://debian.linuxsir.org/book/reference/lyoo/ch-kernel.html

http://debian.linuxsir.org/book/faq/etony/ch-kernel.zh-cn.html

http://blog.chinaunix.net/u/27493/showart_401734.html 

http://www-128.ibm.com/developerworks/cn/linux/l-k26initrd/index.html

http://unixboy.javaeye.com/blog/157717

http://bbs.linuxsky.org/thread-3149-1-1.html 

http://blog.csdn.net/cfgxy/archive/2008/10/22/3123871.aspx 

 

posted @ 2008-11-15 21:11  h2appy  阅读(427)  评论(0编辑  收藏  举报