FreeBSD内核定制 freebsd内核原理
创始人
2024-06-21 03:10:21
0

首先复制配置文件:

#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、读光盘等等都没有问题
 

【编辑推荐】

  1. FreeBSD ports加速
  2. FreeBSD 8.0操作系统正式版发布
  3. FreeBSD 8.0/7.2纵向对比测试

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
Windows恶意软件20年“... 在Windows的早期年代,病毒游走于系统之间,偶尔删除文件(但被删除的文件几乎都是可恢复的),并弹...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...
德国电信门户网站可实时显示全球... 德国电信周三推出一个门户网站,直观地实时提供其安装在全球各地的传感器网络检测到的网络攻击状况。该网站...
着眼MAC地址,解救无法享受D... 在安装了DHCP服务器的局域网环境中,每一台工作站在上网之前,都要先从DHCP服务器那里享受到地址动...
为啥国人偏爱 Mybatis,... 关于 SQL 和 ORM 的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行...