From 9662934bd9ab7ec8ebdecbf970a384c34617deac Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 28 Jul 2010 14:30:17 -0700 Subject: [PATCH 1/2] Add uninstall Makefile targets Extend the Makefiles with an uninstall target to cleanly remove a package which was installed with 'make install'. Additionally, ensure a 'depmod -a' is run as part of the install to update the module dependency information. --- Makefile.am | 2 +- module/Makefile.in | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 6984d5bd0b..3689d1f8f9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,7 +34,7 @@ distclean-local:: if CONFIG_KERNEL install-data-local: destname=zfs-$(ZFS_META_VERSION)/$(LINUX_VERSION); \ - instdest=$(DESTDIR)/${prefix}/src/$$destname; \ + instdest=$(DESTDIR)/usr/src/$$destname; \ echo "${ZFS_META_VERSION}" >$$instdest/zfs.release; \ for instfile in $(noinst_HEADERS) module/$(LINUX_SYMBOLS); do \ $(INSTALL) -D $$instfile $$instdest/$$instfile; \ diff --git a/module/Makefile.in b/module/Makefile.in index cc8047a9ed..489119ab3f 100644 --- a/module/Makefile.in +++ b/module/Makefile.in @@ -16,16 +16,29 @@ clean: if [ -f Module.markers ]; then $(RM) Module.markers; fi modules_install: + # Install the kernel modules $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \ INSTALL_MOD_PATH=$(DESTDIR) \ INSTALL_MOD_DIR=addon/zfs $@ find ${DESTDIR}/lib/modules/ -name 'modules.*' | xargs ${RM} + sysmap=${DESTDIR}/boot/System.map-@LINUX_VERSION@; \ + if [ -f $$sysmap ]; then \ + depmod -ae -F $$sysmap @LINUX_VERSION@; \ + fi # Install the required headers in to the kernel source destname=zfs-@ZFS_META_VERSION@/@LINUX_VERSION@; \ - instdest=$(DESTDIR)/@prefix@/src/$$destname; \ + instdest=$(DESTDIR)/usr/src/$$destname; \ (find . -mindepth 3 -name '*.h' | xargs -Ihdr sh -c \ "DEST=hdr && install -D hdr $$instdest/\$${DEST#*/*/*/}") || exit 1 +modules_uninstall: + # Uninstall the kernel modules + $(RM) -R ${DESTDIR}/lib/modules/@LINUX_VERSION@/addon/zfs + # Uninstall the required headers from the kernel source + destname=zfs-@ZFS_META_VERSION@/@LINUX_VERSION@; \ + instdest=$(DESTDIR)/usr/src/$$destname; \ + $(RM) -R $$instdest + distdir: distfiles=`find . -name '*.c' -o -name '*.h'`; \ for distfile in $$distfiles; do \ @@ -36,5 +49,6 @@ distdir: distclean maintainer-clean: clean install: modules_install +uninstall: modules_uninstall all: modules check: From 1510a95acd0901a8e3df8eed36dd4b156e31f0fd Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 28 Jul 2010 15:02:27 -0700 Subject: [PATCH 2/2] Add splat module to zfs.sh script The splat module is only needed for the spl regression tests. But if we add it to MODULES then 'zfs.sh -u' will be able to unload it if needed, The downside if 'zfs.sh' will always load it but it's overhead is minimal and in a production setting you'll always be doing a 'modprobe zfs' anyway so this is really just for testing. --- config/zfs-build.m4 | 1 + scripts/common.sh.in | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index 58540c349f..7ae1ac90d3 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -74,6 +74,7 @@ KERNEL_MODULES=( \\ SPL_MODULES=( \\ \${SPLBUILD}/spl/spl.ko \\ + \${SPLBUILD}/splat/splat.ko \\ ) ZFS_MODULES=( \\ diff --git a/scripts/common.sh.in b/scripts/common.sh.in index 75e5a51a58..bb602474b0 100644 --- a/scripts/common.sh.in +++ b/scripts/common.sh.in @@ -11,7 +11,7 @@ SCRIPT_CONFIG=.script-config if [ -f "${basedir}/../${SCRIPT_CONFIG}" ]; then . "${basedir}/../${SCRIPT_CONFIG}" else -MODULES=(zlib_deflate spl zavl znvpair zunicode zcommon zfs) +MODULES=(zlib_deflate spl splat zavl znvpair zunicode zcommon zfs) fi PROG=""