[Pkg-dkms-maint] Bug#554843: bullding pure binary deb packages: patch

Thijs Kinkhorst thijs at uvt.nl
Fri Oct 19 12:44:35 UTC 2012


tags 554843 +patch
thanks

Hi,

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.



Cheers,
Thijs

-- 
Thijs Kinkhorst <thijs at uvt.nl> – LIS Unix

Universiteit van Tilburg – Library and IT Services • Postbus 90153, 5000 LE
Bezoekadres > Warandelaan 2 • Tel. 013 466 3035 • G 236 • http://www.uvt.nl
-------------- next part --------------
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 <thijs at debian.org>
Bug-Debian: http://bugs.debian.org/554843

--- dkms-2.2.0.3.orig/dkms
+++ dkms-2.2.0.3/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']"
@@ -2939,6 +2939,15 @@ make_debian()
 	    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"
 	    ;;
+	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}_all.deb' '$deb_basedir'" "Moving built files to $deb_basedir"
+	    ;;
     esac
     popd > /dev/null 2>&1
 
@@ -3397,7 +3406,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 +3515,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;;
--- dkms-2.2.0.3.orig/Makefile
+++ dkms-2.2.0.3/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*
 
--- dkms-2.2.0.3.orig/dkms.8
+++ dkms-2.2.0.3/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
+++ dkms-2.2.0.3/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
+++ dkms-2.2.0.3/template-dkms-mkbmdeb/debian/copyright
@@ -0,0 +1,2 @@
+
+This copyright has not been completed by the author of this package.
--- /dev/null
+++ dkms-2.2.0.3/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
+++ dkms-2.2.0.3/template-dkms-mkbmdeb/debian/compat
@@ -0,0 +1 @@
+7
--- /dev/null
+++ dkms-2.2.0.3/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-maint at lists.alioth.debian.org>  DATE_STAMP
+
--- /dev/null
+++ dkms-2.2.0.3/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
+++ dkms-2.2.0.3/template-dkms-mkbmdeb/debian/control
@@ -0,0 +1,11 @@
+Source: DEBIAN_PACKAGE-dkms-bin
+Section: misc
+Priority: optional
+Maintainer: Dynamic Kernel Modules Support Team <pkg-dkms-maint at lists.alioth.debian.org>
+Build-Depends: debhelper (>= 7), dkms
+Standards-Version: 3.8.1
+
+Package: DEBIAN_PACKAGE-dkms-bin
+Architecture: all
+Depends: ${misc:Depends}
+Description: DEBIAN_PACKAGE driver in DKMS format (binary drivers only).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.alioth.debian.org/pipermail/pkg-dkms-maint/attachments/20121019/1a30a23e/attachment.pgp>


More information about the Pkg-dkms-maint mailing list