In the unload target, check that the module is loaded first.
Add a reload target which unloads and then loads the module.
This commit is contained in:
parent
92a889c673
commit
93bffaf2cd
@ -28,6 +28,9 @@
|
||||
#
|
||||
# KMODUNLOAD Command to unload a kernel module [/sbin/kldunload]
|
||||
#
|
||||
# KMODISLOADED Command to check whether a kernel module is
|
||||
# loaded [/sbin/kldstat -q -n]
|
||||
#
|
||||
# PROG The name of the kernel module to build.
|
||||
# If not supplied, ${KMOD}.ko is used.
|
||||
#
|
||||
@ -56,10 +59,14 @@
|
||||
# unload:
|
||||
# Unload a module.
|
||||
#
|
||||
# reload:
|
||||
# Unload if loaded, then load.
|
||||
#
|
||||
|
||||
AWK?= awk
|
||||
KMODLOAD?= /sbin/kldload
|
||||
KMODUNLOAD?= /sbin/kldunload
|
||||
KMODISLOADED?= /sbin/kldstat -q -n
|
||||
OBJCOPY?= objcopy
|
||||
|
||||
.include <bsd.init.mk>
|
||||
@ -325,7 +332,11 @@ load: ${PROG}
|
||||
|
||||
.if !target(unload)
|
||||
unload:
|
||||
${KMODUNLOAD} -v ${PROG}
|
||||
if ${KMODISLOADED} ${PROG} ; then ${KMODUNLOAD} -v ${PROG} ; fi
|
||||
.endif
|
||||
|
||||
.if !target(reload)
|
||||
reload: unload load
|
||||
.endif
|
||||
|
||||
.if defined(KERNBUILDDIR)
|
||||
|
Loading…
x
Reference in New Issue
Block a user