源码论坛,商业源码下载,尽在锦尚中国商业源码论坛

标题: FreeBSD内核定制 [打印本页]

作者: 88513539    时间: 2011-6-26 12:58
标题: FreeBSD内核定制
FreeBSD内核定制 首先复制配置文件:
  #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、读光盘等等都没有问题
www.47tao.com
作者: hungchia    时间: 2011-7-20 13:15
桐乡外卖网 http://www.txwaimai.com
嘉兴外卖网 http://www.jxwaimai.com   
嘉兴交友网 http://www.jxyuan.com
绵阳房产网 http://www.myfcw.cn  
禾城主机   http://www.cn0573.net
嘉兴QQ群   http://qqun.cn0573.net  
桐乡做网站 http://im.cn0573.net
作者: hungchia    时间: 2011-7-22 00:35
桐乡外卖网 http://www.txwaimai.com
嘉兴外卖网 http://www.jxwaimai.com   
嘉兴交友网 http://www.jxyuan.com
绵阳房产网 http://www.myfcw.cn  
禾城主机   http://www.cn0573.net
嘉兴QQ群   http://qqun.cn0573.net  
桐乡做网站 http://im.cn0573.net




欢迎光临 源码论坛,商业源码下载,尽在锦尚中国商业源码论坛 (https://bbs.52jscn.com/) Powered by Discuz! X3.3