diff options
author | des <des@FreeBSD.org> | 2016-01-01 03:59:09 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2016-01-01 03:59:09 +0000 |
commit | 5dae47235cba4cdfc25c77a1ba375c5addd3406b (patch) | |
tree | f286105c6e5eb7531ea10a4318d7d809770d1dc0 /sys/conf | |
parent | d39cfcb9d357836f28878ce601581e7c0271a9cb (diff) | |
download | FreeBSD-src-5dae47235cba4cdfc25c77a1ba375c5addd3406b.zip FreeBSD-src-5dae47235cba4cdfc25c77a1ba375c5addd3406b.tar.gz |
In the unload target, check that the module is loaded first.
Add a reload target which unloads and then loads the module.
Diffstat (limited to 'sys/conf')
-rw-r--r-- | sys/conf/kmod.mk | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 50000c5..819a955 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -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) |