1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

Make sure we load kernel modules from the same path as the running kernel

This commit is contained in:
Doug Barton 2011-07-10 23:47:03 +00:00
parent 2e32165ce0
commit c2d900ef50
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223917

View File

@ -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
}