xref: /freebsd/libexec/rc/rc.d/kldxref (revision 61ba55bcf70f2340f9c943c9571113b3fd8eda69)
1#!/bin/sh
2#
3#
4
5# PROVIDE: kldxref
6# REQUIRE: mountcritlocal
7# BEFORE:  netif
8# KEYWORD: nojail
9
10. /etc/rc.subr
11
12rcvar="kldxref_enable"
13name="kldxref"
14desc="Generate hints for the kernel loader"
15stop_cmd=":"
16start_cmd="kldxref_start"
17
18kldxref_start() {
19	if [ -n "$kldxref_module_path" ]; then
20		MODULE_PATHS="$kldxref_module_path"
21	else
22		MODULE_PATHS=`sysctl -n kern.module_path`
23	fi
24	IFS=';'
25	for MODULE_DIR in $MODULE_PATHS; do
26		if checkyesno kldxref_clobber ||
27		    [ ! -f "$MODULE_DIR/linker.hints" ] &&
28		    [ `echo ${MODULE_DIR}/*.ko` != "${MODULE_DIR}/*.ko" ]; then
29			echo "Building $MODULE_DIR/linker.hints"
30			kldxref "$MODULE_DIR"
31		fi
32	done
33}
34
35load_rc_config $name
36run_rc_command "$1"
37