From owner-freebsd-current Fri Mar 14 16: 9:27 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A023D37B404 for ; Fri, 14 Mar 2003 16:09:24 -0800 (PST) Received: from sccrmhc01.attbi.com (sccrmhc01.attbi.com [204.127.202.61]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3E77343F93 for ; Fri, 14 Mar 2003 16:09:23 -0800 (PST) (envelope-from crist.clark@attbi.com) Received: from blossom.cjclark.org (12-234-89-252.client.attbi.com[12.234.89.252]) by sccrmhc01.attbi.com (sccrmhc01) with ESMTP id <2003031500092200100j9p8se>; Sat, 15 Mar 2003 00:09:22 +0000 Received: from blossom.cjclark.org (localhost. [127.0.0.1]) by blossom.cjclark.org (8.12.6/8.12.3) with ESMTP id h2F09Leq069515 for ; Fri, 14 Mar 2003 16:09:21 -0800 (PST) (envelope-from crist.clark@attbi.com) Received: (from cjc@localhost) by blossom.cjclark.org (8.12.6/8.12.6/Submit) id h2F09K2A069514 for current@freebsd.org; Fri, 14 Mar 2003 16:09:20 -0800 (PST) X-Authentication-Warning: blossom.cjclark.org: cjc set sender to crist.clark@attbi.com using -f Date: Fri, 14 Mar 2003 16:09:20 -0800 From: "Crist J. Clark" To: current@freebsd.org Subject: Create linker.hints at boot Message-ID: <20030315000920.GA69495@blossom.cjclark.org> Reply-To: cjc@freebsd.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline User-Agent: Mutt/1.4i X-URL: http://people.freebsd.org/~cjc/ Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="kldxref_rc.patch" 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" --C7zPtVaVf+AK4Oqc-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message