diff options
author | dougb <dougb@FreeBSD.org> | 2011-07-10 23:47:03 +0000 |
---|---|---|
committer | dougb <dougb@FreeBSD.org> | 2011-07-10 23:47:03 +0000 |
commit | 1a6a27e0a4142d309601b08425447cbb02c04fb5 (patch) | |
tree | a7a059daccfcbc53f50a94cb814178fbc157e4f5 /etc/rc.d/kld | |
parent | e45048555adb06b1123f059988723f8045e9a527 (diff) | |
download | FreeBSD-src-1a6a27e0a4142d309601b08425447cbb02c04fb5.zip FreeBSD-src-1a6a27e0a4142d309601b08425447cbb02c04fb5.tar.gz |
Make sure we load kernel modules from the same path as the running kernel
Diffstat (limited to 'etc/rc.d/kld')
-rwxr-xr-x | etc/rc.d/kld | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/etc/rc.d/kld b/etc/rc.d/kld index 946ec69..cd2fbab 100755 --- a/etc/rc.d/kld +++ b/etc/rc.d/kld @@ -41,11 +41,24 @@ kld_start() { [ -n "$kld_list" ] || return - local _kld + local _kernel_path _module_path _kld _path + + _kernel_path=`$SYSCTL_N kern.bootfile` + _kernel_path="${_kernel_path%/*}" + + _module_path=`$SYSCTL_N kern.module_path` + _module_path="${_module_path#*\;}" + _module_path="$_kernel_path `ltr $_module_path \; ' '`" echo 'Loading kernel modules:' for _kld in $kld_list ; do - load_kld -e ${_kld}.ko $_kld + for _path in $_module_path ; do + if [ -x "${_path}/${_kld}.ko" ]; then + load_kld -e ${_kld}.ko ${_path}/${_kld}.ko + continue 2 + fi + done + warn "${_kld}.ko not found in $_module_path" done } |