From: Michael Kuhn Date: Tue, 31 Jul 2018 02:12:05 +0000 (-0400) Subject: LU-9087 build: add support for DKMS debs X-Git-Tag: 2.11.54~11 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=88252d0612e55ed21f36345006a7a39cda9886fb;hp=77fc116fb230f330761767e240882c2141b30c1a LU-9087 build: add support for DKMS debs This introduces a new package lustre-client-modules-dkms that uses DKMS to automatically recompile the client kernel modules on kernel upgrades. The package is only created if the dkms-debs target is used, otherwise the traditional kernel-specific package is created. Test-Parameters: trivial Change-Id: Ie9aeee29f7fd73938b148299d246c663a783ccd3 Signed-off-by: Michael Kuhn Reviewed-on: https://review.whamcloud.com/25328 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Gu Zheng Reviewed-by: Li Dongyang Reviewed-by: Oleg Drokin --- diff --git a/autoMakefile.am b/autoMakefile.am index aaa8328..d35d6e5 100644 --- a/autoMakefile.am +++ b/autoMakefile.am @@ -302,6 +302,34 @@ debs: undef.h ../lustre_$${VER}.tar.gz ../lustre-*-modules-$${KVERS}_$${VER}_*.deb \ debs/ +dkms-debs: undef.h + lversion=$$(echo @VERSION@ | tr '_' '-'); \ + cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \ + if [ "$$lversion" != "$$cversion" ]; then \ + echo -e "1i\nlustre ($$lversion-1) unstable; urgency=low\n\n * Automated changelog entry update\n\n -- Brian J. Murrell $$(date -R)\n\n.\nwq" | ed debian/changelog; \ + fi; \ + rm -rf debs; \ + export DEB_BUILD_PROFILES="client"; \ + export KERNEL_CFG="$(LINUX_CONFIG)"; \ + export KERNEL_SRC="$(LINUX)"; \ + echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \ + echo "Kernel Source: $${KERNEL_SRC}"; \ + echo "Kernel Config: $${KERNEL_CFG}"; \ + export BUILD_DKMS="true" && \ + dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \ + rc=$${PIPESTATUS[0]}; \ + [ $${rc} -gt 1 ] && exit $${rc}; \ + exit 0; \ + }; \ + VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \ + mkdir -p debs && \ + mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \ + ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \ + ../lustre-*-utils_$${VER}_*.deb \ + ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \ + ../lustre_$${VER}.tar.gz ../lustre-*-modules-dkms_$${VER}_*.deb \ + debs/ + if USES_DPKG EXTRA_DIST += debian/* endif diff --git a/debian/README.Debian b/debian/README.Debian index d417294..b10a73a 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -51,6 +51,28 @@ and Installation Howtos from Lustre. install lustre-source and build the module as described in 1.) - mount -t lustre mgsnode@tcp0:/spfs /mnt +#5. Building client modules with DKMS + + Lustre client-only kernel modules can built against non-patched, vanilla + kernels. This may be more convenient than installing the patched kernel + and server modules. + + Installing the lustre-client-modules-dkms package will automatically + build modules for all currently installed kernels using DKMS + (http://linux.dell.com/dkms/) for which you will need to have the relevant + linux-headers packages installed. When a new kernel is installed on the + machine, DKMS will automatically build a new set of Lustre client modules. + + You can also use DKMS to create a new deb containing the pre-built kernel + modules, suitable for installing on other machines which may not have a + full build environment. + + - dkms build -m lustre-client-modules -v -k + (repeat the above step for all required kernel versions) + - dkms mkdeb -m lustre-client-modules -v + - dkms mkdsc -m lustre-client-modules -v + + ########### Please have also a look into the official documentation for Lustre available at: diff --git a/debian/control b/debian/control index 3cd0238..00e6c5f 100644 --- a/debian/control +++ b/debian/control @@ -89,3 +89,16 @@ Description: Development files for the Lustre filesystem https://wiki.whamcloud.com/ . This package provides development libraries for the Lustre filesystem. + +Package: lustre-client-modules-dkms +Section: admin +Architecture: i386 powerpc ppc64el amd64 ia64 +Priority: optional +Depends: dkms, automake, libtool, linux-headers-generic | linux-headers | linux-headers-amd64 +Recommends: linux-image, lustre-utils +Provides: lustre-client-modules +Description: Lustre Linux kernel module (DKMS) + This package contains the loadable kernel modules for the patchless client + for the Lustre cluster filesystem. + . + These modules are compiled using DKMS. diff --git a/debian/control.main b/debian/control.main index 3cd0238..00e6c5f 100644 --- a/debian/control.main +++ b/debian/control.main @@ -89,3 +89,16 @@ Description: Development files for the Lustre filesystem https://wiki.whamcloud.com/ . This package provides development libraries for the Lustre filesystem. + +Package: lustre-client-modules-dkms +Section: admin +Architecture: i386 powerpc ppc64el amd64 ia64 +Priority: optional +Depends: dkms, automake, libtool, linux-headers-generic | linux-headers | linux-headers-amd64 +Recommends: linux-image, lustre-utils +Provides: lustre-client-modules +Description: Lustre Linux kernel module (DKMS) + This package contains the loadable kernel modules for the patchless client + for the Lustre cluster filesystem. + . + These modules are compiled using DKMS. diff --git a/debian/dkms.conf.in b/debian/dkms.conf.in new file mode 100644 index 0000000..6a8a1b6 --- /dev/null +++ b/debian/dkms.conf.in @@ -0,0 +1,69 @@ +# Lustre Linux kernel module (DKMS) +# Created by Guy Coates +# Updated by Michael Kuhn +# Copyright 2012 Genome Research Ltd. +# 2017-2018 Universität Hamburg + +PACKAGE_NAME="lustre-client-modules" +PACKAGE_VERSION="@UPVERSION@" + +# We need to run autogen.sh between builds, see Ubuntu bug #952817 +MAKE="sh autogen.sh && ./configure --with-linux=$kernel_source_dir --with-linux-obj=$kernel_source_dir --disable-server --disable-quilt --disable-dependency-tracking --disable-doc --disable-utils --disable-iokit --disable-snmp --disable-tests --enable-quota --with-kmp-moddir=updates && make" +CLEAN="make distclean || true" + +AUTOINSTALL="yes" +STRIP="no" + +# Module names +BUILT_MODULE_NAME[0]="fid" +BUILT_MODULE_NAME[1]="fld" +BUILT_MODULE_NAME[2]="lmv" +BUILT_MODULE_NAME[3]="lov" +BUILT_MODULE_NAME[4]="lustre" +BUILT_MODULE_NAME[5]="mdc" +BUILT_MODULE_NAME[6]="mgc" +BUILT_MODULE_NAME[7]="obdclass" +BUILT_MODULE_NAME[8]="obdecho" +BUILT_MODULE_NAME[9]="osc" +BUILT_MODULE_NAME[10]="ptlrpc" +BUILT_MODULE_NAME[11]="ko2iblnd" +BUILT_MODULE_NAME[12]="ksocklnd" +BUILT_MODULE_NAME[13]="libcfs" +BUILT_MODULE_NAME[14]="lnet" +BUILT_MODULE_NAME[15]="lnet_selftest" + +# Location of the modules in the source tree after build +BUILT_MODULE_LOCATION[0]="lustre/fid" +BUILT_MODULE_LOCATION[1]="lustre/fld" +BUILT_MODULE_LOCATION[2]="lustre/lmv" +BUILT_MODULE_LOCATION[3]="lustre/lov" +BUILT_MODULE_LOCATION[4]="lustre/llite" +BUILT_MODULE_LOCATION[5]="lustre/mdc" +BUILT_MODULE_LOCATION[6]="lustre/mgc" +BUILT_MODULE_LOCATION[7]="lustre/obdclass" +BUILT_MODULE_LOCATION[8]="lustre/obdecho" +BUILT_MODULE_LOCATION[9]="lustre/osc" +BUILT_MODULE_LOCATION[10]="lustre/ptlrpc" +BUILT_MODULE_LOCATION[11]="lnet/klnds/o2iblnd" +BUILT_MODULE_LOCATION[12]="lnet/klnds/socklnd" +BUILT_MODULE_LOCATION[13]="libcfs/libcfs" +BUILT_MODULE_LOCATION[14]="lnet/lnet" +BUILT_MODULE_LOCATION[15]="lnet/selftest" + +# Final destination of the modules under /lib/modules// +DEST_MODULE_LOCATION[0]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[1]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[2]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[3]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[4]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[5]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[6]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[7]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[8]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[9]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[10]="/updates/kernel/fs/lustre" +DEST_MODULE_LOCATION[11]="/updates/kernel/net/lustre" +DEST_MODULE_LOCATION[12]="/updates/kernel/net/lustre" +DEST_MODULE_LOCATION[13]="/updates/kernel/net/lustre" +DEST_MODULE_LOCATION[14]="/updates/kernel/net/lustre" +DEST_MODULE_LOCATION[15]="/updates/kernel/net/lustre" diff --git a/debian/lustre-client-modules-dkms.postinst b/debian/lustre-client-modules-dkms.postinst new file mode 100644 index 0000000..cb2fdf3 --- /dev/null +++ b/debian/lustre-client-modules-dkms.postinst @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +# Get the package version +package="lustre-client-modules" +version="$(dpkg-query -W -f='${Version}' "${package}-dkms" | sed -e 's/-[^-]*$//')" + +dkms add -m "${package}" -v "${version}" +dkms build -m "${package}" -v "${version}" && dkms install -m "${package}" -v "${version}" || true diff --git a/debian/lustre-client-modules-dkms.prerm b/debian/lustre-client-modules-dkms.prerm new file mode 100644 index 0000000..a1565f5 --- /dev/null +++ b/debian/lustre-client-modules-dkms.prerm @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +# Get the package version +package="lustre-client-modules" +version="$(dpkg-query -W -f='${Version}' "${package}-dkms" | sed -e 's/-[^-]*$//')" + +dkms remove -m "${package}" -v "${version}" --all || true diff --git a/debian/rules b/debian/rules index 237904a..902d4ab 100755 --- a/debian/rules +++ b/debian/rules @@ -17,6 +17,15 @@ DEB_BUILD_GNU_CPU = $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU) # whether to use module-assistant to build the kernel modules or not USE_MA = true +# Whether to build the DKMS packages +BUILD_DKMS ?= false + +ifeq ($(BUILD_DKMS),true) + DKMS_TARGET = binary-$(DKMS_PKG) +else + DKMS_TARGET = +endif + CFLAGS = -Wall -g ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 @@ -47,7 +56,7 @@ TOP_DIR:=$(shell pwd) # This is the Lustre version VERSION=$(shell sed -n -e '1s/.*(\(.*\)) .*/\1/p' debian/changelog) -UPVERSION=$(shell echo $VERSION | sed -e 's/-[^-]*$$//') +UPVERSION=$(shell echo $(VERSION) | sed -e 's/-[^-]*$$//') # KVER is set to LINUXRELEASE being by autoconf which is either # $(uname -r) or the version of the source specified by the user @@ -72,9 +81,11 @@ SOURCE_PKG=lustre-source ifneq (,$(findstring server,$(DEB_BUILD_PROFILES))) UTILS_PKG=lustre-server-utils MODS_PKG=lustre-server-modules + DKMS_PKG= else UTILS_PKG=lustre-client-utils MODS_PKG=lustre-client-modules + DKMS_PKG=lustre-client-modules-dkms endif #Build dir @@ -193,7 +204,7 @@ build-stamp: patch-stamp configure-stamp binary-arch: binary-$(UTILS_PKG) binary-$(DEV_PKG) \ binary-$(IOKIT_PKG) binary-$(TESTS_PKG) -binary-indep: binary-$(SOURCE_PKG) +binary-indep: binary-$(SOURCE_PKG) $(DKMS_TARGET) binary: binary-indep binary-arch @@ -303,6 +314,31 @@ binary-$(SOURCE_PKG): build-stamp dh_md5sums -p $(SOURCE_PKG) dh_builddeb -p $(SOURCE_PKG) +binary-$(DKMS_PKG): build-stamp + dh_testdir + dh_testroot + # Create /usr/src/lustre-client-modules- + dh_installdirs -p $(DKMS_PKG) usr/src/lustre-client-modules-$(UPVERSION) + # Copy the source + rsync -av --exclude='debian/$(DKMS_PKG)/*' --exclude='.git/' \ + --link-dest=$(PWD) \ + . debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION) + # Clean it up + $(MAKE) -C debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION) -f debian/rules clean + + # Put the DKMS configuration file in place + sed -e 's/[@]UPVERSION[@]/$(UPVERSION)/' debian/dkms.conf.in > debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)/dkms.conf + dh_install -p $(DKMS_PKG) + dh_installchangelogs -p $(DKMS_PKG) lustre/ChangeLog + dh_installdocs -p $(DKMS_PKG) + dh_compress -p $(DKMS_PKG) + dh_installdeb -p $(DKMS_PKG) + dh_strip -p $(DKMS_PKG) + dh_fixperms -p $(DKMS_PKG) + dh_gencontrol -p $(DKMS_PKG) + dh_md5sums -p $(DKMS_PKG) + dh_builddeb -p $(DKMS_PKG) + # if only we could use m-a for this, but this stupid "compliant.list" # thing fouls that up binary-kern-mods: @@ -433,7 +469,7 @@ clean: dpatch deapply-all -v -$(MAKE) distclean rm -rf debian/substvars debian/*.bak debian/*~ *~ *-stamp - ls -d debian/lustre-*-modules-* | grep -v _KVERS_ | xargs rm -f || true + ls -d debian/lustre-*-modules-* | grep -v _KVERS_ | grep -v dkms | xargs rm -f || true # only remove this if the clean was not called from kdist_clean if [ "$$MA_SOURCE_PKG" = "" ]; then \ rm -rf debian/m-a_root; \