Re: Thijs Kinkhorst 2012-10-19 <201210191444.39967.th...@uvt.nl> > Here's a patch to extend dkms to also build 'pure binary' deb packages which > can be installed on hosts without requiring gcc and friends to be present. > The > use cases can be found in this bug log. It can be dropped in the > debian/patches dir directly. > > This works for me with one module, so I'm submitting it here. It may of > course > be open to improvement or a different way of implemneting this that the dkms > maintainers may prefer.
Here's an improved verion of the patch that builds _$DEB_BUILD_ARCH.deb files instead of _all.deb, and makes the .deb depend on the kernel version needed. Previously, the module .deb files had the kernel version in the package name, not sure if that should also be done here - I haven't touched that in the patch. Christoph -- c...@df7cb.de | http://www.df7cb.de/
Description: mkbmdeb: support for lean binary package with only the built modules Creates a Debian binary package containing just the binary modules in the /lib/modules installation path. This package does not depend on dkms and does not require a toolchain to be installed on the target host. Useful if you want to have a package to install on hosts identical to the build system without installing the full toolchain on them. Author: Thijs Kinkhorst <th...@debian.org> Bug-Debian: http://bugs.debian.org/554843 --- a/dkms +++ b/dkms @@ -119,7 +119,7 @@ show_usage() { echo $"Usage: $0 [action] [options]" echo $" [action] = { add | remove | build | install | uninstall | match | autoinstall" - echo $" | mkdriverdisk | mktarball | ldtarball | mkrpm | mkkmp | mkdeb | status }" + echo $" | mkdriverdisk | mktarball | ldtarball | mkrpm | mkkmp | mkdeb | mkbmdeb | status }" echo $" [options] = [-m module] [-v module-version] [-k kernel-version] [-a arch]" echo $" [-d distro] [-c dkms.conf-location] [-q] [--force] [--all]" echo $" [--templatekernel=kernel] [--directive='cli-directive=cli-value']" @@ -2809,6 +2809,8 @@ preproc_file() local date_str="$(date -R)" echo "modifying $1..." sed -e "s/DEBIAN_PACKAGE/$debian_package/g" \ + -e "s/DEBIAN_BUILD_ARCH/$debian_build_arch/g" \ + -e "s/KERNEL_VERSION/$kernelver/g" \ -e "s/MODULE_NAME/$module/g" \ -e "s/MODULE_VERSION/$module_version/g" \ -e "s/DATE_STAMP/$date_str/" "$1" > "$1.dkms-pp" @@ -2865,6 +2867,7 @@ make_debian() make_common_test "mk${create_type}" debian_package=${module//_/-} + debian_build_arch=$(dpkg-architecture -qDEB_BUILD_ARCH) # Read the conf file read_conf_or_die "$kernelver" "$arch" @@ -2937,7 +2940,16 @@ make_debian() die 7 $"There was a problem creating your ${create_type}." echo $"" echo $"DKMS: mk${create_type} completed." - invoke_command "mv '$temp_dir/${debian_package}-dkms_${module_version}_all.deb' '$deb_basedir'" "Moving built files to $deb_basedir" + invoke_command "mv '$temp_dir/${debian_package}-dkms_${module_version}_${debian_build_arch}.deb' '$deb_basedir'" "Moving built files to $deb_basedir" + ;; + bmdeb) + export KVER="$kernelver" + export KARCH="$arch" + invoke_command "dpkg-buildpackage -rfakeroot -d -b -us -uc 1>/dev/null" "Building binary package" || \ + die 7 $"There was a problem creating your ${create_type}." + echo $"" + echo $"DKMS: mk${create_type} completed." + invoke_command "mv '$temp_dir/${debian_package}-dkms-bin_${module_version}_${debian_build_arch}.deb' '$deb_basedir'" "Moving built files to $deb_basedir" ;; esac popd > /dev/null 2>&1 @@ -3397,7 +3409,7 @@ die_is_fatal="yes" [ -x /sbin/weak-modules ] && weak_modules='/sbin/weak-modules' [ -x /usr/lib/module-init-tools/weak-modules ] && weak_modules='/usr/lib/module-init-tools/weak-modules' -action_re='^(remove|(auto|un)?install|match|mk(driverdisk|tarball|rpm|deb|dsc|kmp)|build|add|status|ldtarball)$' +action_re='^(remove|(auto|un)?install|match|mk(driverdisk|tarball|rpm|deb|bmdeb|dsc|kmp)|build|add|status|ldtarball)$' # Parse command line arguments while (($# > 0)); do @@ -3506,6 +3518,7 @@ for action_to_run in $action; do mktarball) make_tarball;; mkrpm) make_rpm;; mkdeb) make_debian "deb";; + mkbmdeb) make_debian "bmdeb";; mkdsc) make_debian "dsc";; mkkmp) have_one_kernel && make_kmp;; status) show_status;; --- a/Makefile +++ b/Makefile @@ -81,6 +81,10 @@ install-debian: install install-doc chmod +x $(ETC)/template-dkms-mkdeb/debian/postinst chmod +x $(ETC)/template-dkms-mkdeb/debian/prerm chmod +x $(ETC)/template-dkms-mkdeb/debian/rules + mkdir -p -m 0755 $(ETC)/template-dkms-mkbmdeb/debian + install -p -m 0664 template-dkms-mkbmdeb/Makefile $(ETC)/template-dkms-mkbmdeb/ + install -p -m 0664 template-dkms-mkbmdeb/debian/* $(ETC)/template-dkms-mkbmdeb/debian/ + chmod +x $(ETC)/template-dkms-mkbmdeb/debian/rules rm $(DOCDIR)/COPYING* rm $(DOCDIR)/sample* --- a/dkms.8 +++ b/dkms.8 @@ -262,6 +262,18 @@ load this tarball, build and install mod not want your debian package to contain any prebuilt binaries, be sure to specify .B \-\-source\-only in the mkdeb command. +.SY mkbmdeb +.OP module/module\-version +.OP -k kernel/arch +.YS +.IP "" 4 +Creates a Debian binary package containing just the binary modules in the /lib/modules +installation path. This package does not depend on dkms and does not require a toolchain +to be installed on the target host. Useful if you want to have a package to install on +hosts identical to the build system without installing the full toolchain on them. +It uses a template debian directory found in +.I /etc/dkms/template\-dkms\-mkbmdeb +as the basis for the package. .SY mkdsc .OP module/module\-version .OP -k kernel/arch --- /dev/null +++ b/template-dkms-mkbmdeb/Makefile @@ -0,0 +1,18 @@ +#/usr/bin/make +SRC = $(DESTDIR)/usr/src +SHARE = $(DESTDIR)/usr/share/$(NAME)-dkms + +all: + +clean: + +install: + +#tarball, possibly with binaries +ifeq ("$(wildcard $(NAME)-$(VERSION).dkms.tar.gz)", "$(NAME)-$(VERSION).dkms.tar.gz") + tar zxvf "$(NAME)-$(VERSION).dkms.tar.gz" + install -d "$(DESTDIR)/lib/modules/$(KVER)/updates/dkms/" + install -m 644 dkms_main_tree/$(KVER)/$(KARCH)/module/*.ko "$(DESTDIR)/lib/modules/$(KVER)/updates/dkms/" + rm -rf dkms_main_tree/ dkms_binaries_only/ +endif + --- /dev/null +++ b/template-dkms-mkbmdeb/debian/copyright @@ -0,0 +1,2 @@ + +This copyright has not been completed by the author of this package. --- /dev/null +++ b/template-dkms-mkbmdeb/debian/README.Debian @@ -0,0 +1,5 @@ +MODULE_NAME DKMS module for Debian + +This package was automatically generated by the DKMS system, +for distribution on Debian based operating systems. + --- /dev/null +++ b/template-dkms-mkbmdeb/debian/compat @@ -0,0 +1 @@ +7 --- /dev/null +++ b/template-dkms-mkbmdeb/debian/changelog @@ -0,0 +1,6 @@ +DEBIAN_PACKAGE-dkms-bin (MODULE_VERSION) stable; urgency=low + + * Automatically packaged by DKMS. + + -- Dynamic Kernel Modules Support Team <pkg-dkms-ma...@lists.alioth.debian.org> DATE_STAMP + --- /dev/null +++ b/template-dkms-mkbmdeb/debian/rules @@ -0,0 +1,57 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +DEB_NAME=DEBIAN_PACKAGE +NAME=MODULE_NAME +VERSION=MODULE_VERSION + +configure: configure-stamp +configure-stamp: + dh_testdir + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + $(MAKE) + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + -$(MAKE) clean + dh_clean + +install: build + dh_testdir + dh_testroot + dh_prep + dh_installdirs + $(MAKE) DESTDIR=$(CURDIR)/debian/$(DEB_NAME)-dkms-bin NAME=$(NAME) VERSION=$(VERSION) install + +binary-arch: build install + +binary-indep: build install + dh_testdir + dh_testroot + dh_link + dh_strip + dh_compress + dh_installmodules + dh_installdocs + dh_installchangelogs + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure --- /dev/null +++ b/template-dkms-mkbmdeb/debian/control @@ -0,0 +1,13 @@ +Source: DEBIAN_PACKAGE-dkms-bin +Section: misc +Priority: optional +Maintainer: Dynamic Kernel Modules Support Team <pkg-dkms-ma...@lists.alioth.debian.org> +Build-Depends: debhelper (>= 7), dkms +Standards-Version: 3.8.1 + +Package: DEBIAN_PACKAGE-dkms-bin +Architecture: DEBIAN_BUILD_ARCH +Depends: ${misc:Depends}, linux-image-KERNEL_VERSION +Description: DEBIAN_PACKAGE binary drivers for linux-image-KERNEL_VERSION + This package contains DEBIAN_PACKAGE drivers for the KERNEL_VERSION Linux kernel, + built from DEBIAN_PACKAGE-dkms for the DEBIAN_BUILD_ARCH architecture.
signature.asc
Description: Digital signature