Perhaps it would be a good idea to build a linker.hints file with
kldxref(8) at boot time. At least, I can't think of any really good
reasons why _not_ to do it.

Personally, I like it because when I buildworld and installworld
CURRENT/RELENG_5 on RELENG_4, the linker.hints file is not built. This
prevents the kernel from automatically loading the nfsclient.ko when I
try to mount something. A mild annoyance, but why not just auto
generate one the first time I boot the CURRENT/RELENG_5 box?

I made a quick rc-ng script to do this and two rc.conf knobs. I think
the rest is pretty self-explanitory. Anyone have any opinions on
whether or not to add this, and whether it should default on or off?
I'm inclined to adding it, default OFF (simply for POLA sake), and
perhaps later turning it to default ON once the idea settles in?

Also, what's the best way/is there a way to figure out the boot
directory rather than hardwire /boot/kernel?

This is my first stab at rc-ng for a long while, so please be gentle
if I've not handled that the best way. Patches attached.
-- 
Crist J. Clark                     |     [EMAIL PROTECTED]
                                   |     [EMAIL PROTECTED]
http://people.freebsd.org/~cjc/    |     [EMAIL PROTECTED]
Index: etc/defaults/rc.conf
===================================================================
RCS file: /ncvs/src/etc/defaults/rc.conf,v
retrieving revision 1.169
diff -u -r1.169 rc.conf
--- etc/defaults/rc.conf        8 Mar 2003 09:50:11 -0000       1.169
+++ etc/defaults/rc.conf        14 Mar 2003 23:04:09 -0000
@@ -28,6 +28,8 @@
 apmd_enable="NO"       # Run apmd to handle APM event from userland.
 apmd_flags=""          # Flags to apmd (if enabled).
 devd_enable="NO"       # Run devd, to trigger programs on device tree changes.
+kldxref_enable="NO"    # Build a linker.hints file with kldxref(8).
+kldxref_clobber="NO"   # Overwrite old linker.hints at boot.
 pccard_enable="NO"     # Set to YES if you want to configure PCCARD devices.
 pccard_mem="DEFAULT"   # If pccard_enable=YES, this is card memory address.
 pccard_beep="2"                # pccard beep type.
Index: etc/rc.d/network1
===================================================================
RCS file: /ncvs/src/etc/rc.d/network1,v
retrieving revision 1.145
diff -u -r1.145 network1
--- etc/rc.d/network1   12 Feb 2003 04:26:10 -0000      1.145
+++ etc/rc.d/network1   15 Mar 2003 00:04:42 -0000
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: network1
-# REQUIRE: atm1 ipfilter mountcritlocal pccard serial sppp sysctl tty
+# REQUIRE: atm1 ipfilter kldxref mountcritlocal pccard serial sppp sysctl tty
 # KEYWORD: FreeBSD
 
 . /etc/rc.subr
Index: etc/rc.d/kldxref
===================================================================
RCS file: etc/rc.d/kldxref
diff -N etc/rc.d/kldxref
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ etc/rc.d/kldxref    15 Mar 2003 00:04:12 -0000
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# $FreeBSD:$
+#
+
+# PROVIDE: kldxref
+# REQUIRE: root
+# BEFORE:  network1
+# KEYWORD: FreeBSD
+
+. /etc/rc.subr
+
+rcvar="kldxref_enable"
+name="kldxref"
+stop_cmd=":"
+start_cmd="kldxref_start"
+
+kldxref_start () {
+       KERNDIR=/boot/kernel
+       if [ ! -f "$KERNDIR/linker.hints" ] || checkyesno kldxref_clobber; then
+               echo "Building $KERNDIR/linker.hints"
+               kldxref "$KERNDIR"
+       fi
+}
+
+load_rc_config $name
+run_rc_command "$1"

Reply via email to