免费注册 查看新帖 |

Chinaunix

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

FreeBSD内核定制 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-01-02 22:25 |只看该作者 |倒序浏览

                首先复制配置文件:
#cd /usr/src/sys/amd64/conf
#mkdir /root/kernel
#cp GENERIC /root/kernel/MY_KERNEL_CONF
#ln -s /root/kernel/MY_KERNEL_CONF
这样作的好处是更新源代码之后如果像要重新编译内核,就不会需要重新弄一个配制文件了。
第二步是准备硬件清单
#dmesg > hardware
#vi hardware
就可以查看机器的硬件配制了
接下来开始修改配置文件
vi MY_KERNEL_CONF
其中我的改动有:
ident    GENERIC    =>        ident    MY_KERNEL
这个是内核的名字,以此来与之前的内核相区分
接下来的大部分是操作系统核心相关的东东,如文件系统,进程调度等,大部分我都是直接保留,注释掉了ipv6 相关的选项以及与FreeBSD4兼容的选项,因为我在FreebSD.org上看到的amd64 架构是从FreeBSD5.3 开始的
到后面就是根据硬件配制清单定制驱动,根据需求删减
配制完毕后开始编译
#cd /usr/src
#make buildkernel KERNCONF=MY_KERNEL_CONF
很不幸在链接时报错退出:
linking kernel.debug
umass.o(.text+0xcf): In function `umass_detach':
/usr/src/sys/dev/usb/storage/umass.c:2825: undefined reference to `xpt_bus_deregister'
umass.o(.text+0xf3):/usr/src/sys/dev/usb/storage/umass.c:2828: undefined reference to `cam_sim_free'
umass.o(.text+0xd6c): In function `umass_std_transform':
/usr/src/sys/dev/usb/storage/umass.c:3613: undefined reference to `xpt_done'
u9):/usr/src/sys/dev/usb/storage/umass.c:2689: undefined reference to `cam_sim_alloc'
umass.o(.text+0x2b54):/usr/src/sys/dev/usb/storage/umass.c:2711: undefined reference to `xpt_bus_register'
umass.o(.text+0x2db0):/usr/src/sys/dev/usb/storage/umass.c:2770: undefined reference to `xpt_periph'
umass.o(.text+0x2db5):/usr/src/sys/dev/usb/storage/umass.c:2770: undefined reference to `xpt_create_path'
umass.o(.text+0x2ec9):/usr/src/sys/dev/usb/storage/umass.c:2702: undefined reference to `cam_simq_free'
umass.o(.text+0x2f2d):/usr/src/sys/dev/usb/storage/umass.c:2779: undefined reference `xpt_free_path'
umass.o(.text+0x308d): In function `umass_cam_action':
/usr/src/sys/dev/usb/storage/umass.c:2849: undefined reference to `xpt_done'
umass.o(.text+0x317b):/usr/src/sys/dev/usb/storage/umass.c:3131: undefined reference to `xpt_done'
umass.o(.text+0x31ca):/usr/src/sys/dev/usb/storage/umass.c:2900: undefined reference to `xpt_done'
umass.o(.text+0x329b):/usr/src/sys/dev/usb/storage/umass.c:3121: undefined reference to `xpt_done'
umass.o(.text+0x3324):/usr/src/sys/dev/usb/storage/umass.c:2936: undefined reference to `xpt_done'
umass.o(.text+0x33b2):/usr/src/sys/dev/usb/storage/umass.c:3095: more undefined references to `xpt_done' fo.o(.text+0x35be):/usr/src/sys/dev/usb/storage/umass.c:3073: undefined reference to `xpt_done'
umass.o(.text+0x3819):/usr/src/sys/dev/usb/storage/umass.c:3004: undefined reference to `xpt_done'
umass.o(.text+0x39bf):/usr/src/sys/dev/usb/storage/umass.c:2994: undefined reference to `xpt_done'
umass.o(.text+0x3a07):/usr/src/sys/dev/usb/storage/umass.c:2982: undefined reference to `xpt_done'
umass.o(.text+0xdfa):/usr/src/sys/dev/usb/storage/umass.c:3325: more undefined references to `xpt_done' follow
*** Error code 1
Stop in /usr/
GOOGLE找到答案,原来是我在配置文件里含入了
device umass
却没有按照后面的注释含入
device    scbus
device    da
解决方法是直接将umass 也给它注释掉
重新build,成功!
# make installkernel KERNCONF=MY_KERNEL_CONF
搞定,重启
察看内核版本:
uname -i
$ uname -i
MY_KERNEL
然后上网、登录SSH、VNC、读光盘等等都没有问题
恩,应该是说明我的内核编译成功了~~
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/105027/showart_2137857.html

论坛徽章:
0
2 [报告]
发表于 2010-01-23 21:37 |只看该作者
偶是把v4  v5  scsi  raid wifi的東西都去掉了。
還有眾多的定制品牌驅動,只要本機沒有的硬件, 都#掉。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP