svn commit: r293033 - head/sys/conf

Dag-Erling Smørgrav des at FreeBSD.org
Fri Jan 1 03:59:11 UTC 2016


Author: des
Date: Fri Jan  1 03:59:09 2016
New Revision: 293033
URL: https://svnweb.freebsd.org/changeset/base/293033

Log:
  In the unload target, check that the module is loaded first.
  Add a reload target which unloads and then loads the module.

Modified:
  head/sys/conf/kmod.mk

Modified: head/sys/conf/kmod.mk
==============================================================================
--- head/sys/conf/kmod.mk	Fri Jan  1 03:12:51 2016	(r293032)
+++ head/sys/conf/kmod.mk	Fri Jan  1 03:59:09 2016	(r293033)
@@ -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)


More information about the svn-src-head mailing list