FreeBSD内核定制

系统 Linux
接下来的大部分是操作系统核心相关的东东,如文件系统,进程调度等,大部分我都是直接保留,注释掉了ipv6 相关的选项以及与FreeBSD4兼容的选项,因为我在FreebSD.org上看到的amd64 架构是从FreeBSD5.3 开始的......

首先复制配置文件:

#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纵向对比测试
责任编辑:赵宁宁 来源: chinaitlab
相关推荐

2010-08-09 09:33:41

Debian 6.0内核变动

2011-01-14 15:30:44

2017-02-28 17:18:34

Linux驱动技术内核定时器

2022-09-22 11:09:14

芯昇科技

2009-12-04 19:23:48

SolarisLinuxFreeBSD

2018-04-23 10:52:12

Linux内核 微软

2009-12-11 17:31:57

2017-03-12 11:42:21

Linux致远电子内核源码

2010-01-18 10:03:37

FreeBSD porFreeBSD

2015-07-21 11:43:14

CentosRPM

2011-02-23 14:05:57

2009-04-07 15:39:55

LinuxDebianFreeBSD Ker

2010-12-31 09:23:44

FreeBSD

2014-07-16 09:51:16

FreeBSD

2010-09-16 15:11:58

FreeBSD PPP

2017-08-25 09:50:42

数据库MySQL内核优化

2022-06-21 08:00:00

FreeBSD 12FreeBSD 13架构

2023-10-16 21:57:00

FreeBSDLinux

2011-03-02 10:39:19

FreebsdPureftpd

2010-01-18 10:07:07

Freebsdbash
点赞
收藏

51CTO技术栈公众号