免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3414 | 回复: 2
打印 上一主题 下一主题

Debian 安装安装安装内核 [复制链接]

论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-04-28 21:17 |只看该作者 |倒序浏览
本帖最后由 renxiao2003 于 2010-04-29 09:08 编辑

1、到www.kernel.org上下载内核源码,目前最新的版本是2.6.34-rc5。
   如果需要将内核编译成deb包,需要kernel-package fakeroot,用下面的命令安装
   apt-get install kernel-package fakeroot   (需要root身份用户)
2、将下载的文件放到/usr/src下,解压
   tar -jxvf kernel-2.6.34-rc5.tar.bz2
    解压后生成一个目录kernel-2.6.34-rc5,然后进入这个目录。
3、使用正在运行的配置文件:
   make oldconfig
     然后进行修改:
   make menuconfig
    生成新内核:
   make-kpkg clean
     make-kpkg --initrd --append-to-version=new --revision=1.0 kernel-image

     在运行make menuconfig时,可能会遇到“'make menuconfig' requires the ncurses libraries”这个错误,没关系,安装需要的包:
   apt-get install libncurses*
4、安装新内核
seabird-debian:/usr/src# dpkg -i linux-image-2.6.18lilin_1.0_i386.deb
选中了曾被取消选择的软件包 linux-image-2.6.18lilin。
(正在读取数据库 ... 系统当前总共安装有 119841 个文件和目录。)
正在解压缩 linux-image-2.6.18lilin (从 linux-image-2.6.18lilin_1.0_i386.deb) ...
Done.
正在设置 linux-image-2.6.18lilin (1.0) ...
Running depmod.
Finding valid ramdisk creators.
Using mkinitramfs-kpkg to build the ramdisk.
Running postinst hook script /sbin/update-grub.
You shouldn't call /sbin/update-grub. Please call /usr/sbin/update-grub instead!
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.18lilin
Found kernel: /boot/vmlinuz-2.6.18-6-686
Found kernel: /boot/vmlinuz-2.6.18-5-686
Found kernel: /boot/vmlinuz-2.6.18-4-686
Updating /boot/grub/menu.lst ... done

seabird-debian:/usr/src#

注意红色的那一行,按提示自己运行一下
seabird-debian:/usr/src# update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.18lilin
Found kernel: /boot/vmlinuz-2.6.18-6-686
Found kernel: /boot/vmlinuz-2.6.18-5-686
Found kernel: /boot/vmlinuz-2.6.18-4-686
Updating /boot/grub/menu.lst ... done
seabird-debian:/usr/src#

好了,新的kernel已经添加到启动列表了,reboot,你就可以使用新内核了!

PS:2010-04-28晚上终于把内核编译成功并安装上了。也正常。在kernel-2.6.34-rc5中已经不用运行update-grub这个了。

注意:上述命令都需要以root身份运行!
参考:http://blog.sina.com.cn/s/blog_40e5d1fb0100ek92.html
http://blog.csdn.net/ytu_cyc/archive/2009/09/22/4581522.aspx

论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
2 [报告]
发表于 2010-04-28 22:57 |只看该作者
编译的最后可能会遇到如下错误:
  1. This is kernel package version 11.015.
  2. echo "The UTS Release version in include/linux/version.h"; echo "           \"\" "; echo "does not match current version:"; echo "           \"2.6.34-rc5wangcc\" "; echo "Please correct this."; exit 2
  3. The UTS Release version in include/linux/version.h
  4.            ""
  5. does not match current version:
  6.            "2.6.34-rc5wangcc"
  7. Please correct this.
  8. make[1]: *** [debian/stamp/install/linux-image-2.6.34-rc5wangcc] 错误 2
  9. make[1]: Leaving directory `/usr/src/linux-2.6.34-rc5'
  10. make: *** [kernel-image] 错误 2
复制代码
修改方法:
  1. trying to change /usr/share/kernel-package/ruleset/misc/version_vars.mk

  2. UTS_RELEASE_HEADER=$(call doit,if [ -f include/linux/utsrelease.h ]; then \
  3.                                                            echo include/linux/utsrelease.h; \
  4.                                                     else \
  5.                                                            echo include/linux/version.h ; \
  6.                                                     fi)

  7.                                                 TO

  8. UTS_RELEASE_HEADER=$(call doit,if [ -f include/generated/utsrelease.h ]; then \
  9.                                                            echo include/generated/utsrelease.h; \
  10.                                                     else \
  11.                                                            echo include/generated/version.h ; \
  12.                                                     fi)
复制代码

论坛徽章:
59
2015七夕节徽章
日期:2015-08-24 11:17:25ChinaUnix专家徽章
日期:2015-07-20 09:19:30每周论坛发贴之星
日期:2015-07-20 09:19:42ChinaUnix元老
日期:2015-07-20 11:04:38荣誉版主
日期:2015-07-20 11:05:19巳蛇
日期:2015-07-20 11:05:26CU十二周年纪念徽章
日期:2015-07-20 11:05:27IT运维版块每日发帖之星
日期:2015-07-20 11:05:34操作系统版块每日发帖之星
日期:2015-07-20 11:05:36程序设计版块每日发帖之星
日期:2015-07-20 11:05:40数据库技术版块每日发帖之星
日期:2015-07-20 11:05:432015年辞旧岁徽章
日期:2015-07-20 11:05:44
3 [报告]
发表于 2010-04-28 23:08 |只看该作者
有意思,不过已经不新鲜了
威海之水 发表于 2010-04-28 21:32



    我写这个,只是给自己留着的啊!也是自己第一次编译安装。呵呵。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP