summaryrefslogtreecommitdiffstats
path: root/debian/signing_templates/rules.real
diff options
context:
space:
mode:
Diffstat (limited to 'debian/signing_templates/rules.real')
-rw-r--r--debian/signing_templates/rules.real94
1 files changed, 94 insertions, 0 deletions
diff --git a/debian/signing_templates/rules.real b/debian/signing_templates/rules.real
new file mode 100644
index 000000000..d445e2672
--- /dev/null
+++ b/debian/signing_templates/rules.real
@@ -0,0 +1,94 @@
+SHELL := bash -e
+
+export DH_OPTIONS
+
+BUILDDEB_ARGS := -Zxz $(if $(filter pkg.linux.quick,$(DEB_BUILD_PROFILES)),-z0)
+
+build-indep:
+
+build_image:
+
+binary_image: DH_OPTIONS = -p$(PACKAGE_NAME)
+binary_image: KERNEL_VERSION = $(ABINAME)$(LOCALVERSION)
+binary_image: IMAGE_PACKAGE_NAME = linux-image-$(KERNEL_VERSION)-unsigned
+binary_image: PACKAGE_DIR = debian/$(PACKAGE_NAME)
+binary_image: SIGNATURE_DIR = debian/signatures/$(IMAGE_PACKAGE_NAME)
+binary_image:
+ mkdir -p $(PACKAGE_DIR)/boot
+ rsync -a $(patsubst %,/boot/%-$(KERNEL_VERSION),config System.map $(IMAGE_INSTALL_STEM)) \
+ $(PACKAGE_DIR)/boot/
+ if [ -f $(SIGNATURE_DIR)/boot/vmlinuz-$(KERNEL_VERSION).sig ]; then \
+ sbattach --attach $(SIGNATURE_DIR)/boot/vmlinuz-$(KERNEL_VERSION).sig \
+ $(PACKAGE_DIR)/boot/vmlinuz-$(KERNEL_VERSION); \
+ echo >> debian/$(PACKAGE_NAME).substvars 'signed:Description=The kernel image and modules are signed for use with Secure Boot.'; \
+ else \
+ echo >> debian/$(PACKAGE_NAME).substvars 'signed:Description=The modules are signed.'; \
+ fi
+ mkdir -p $(PACKAGE_DIR)/lib/modules/$(KERNEL_VERSION)
+ rsync -a $(addprefix /lib/modules/$(KERNEL_VERSION)/,modules.builtin modules.builtin.modinfo modules.order) \
+ $(PACKAGE_DIR)/lib/modules/$(KERNEL_VERSION)/
+ find $(SIGNATURE_DIR)/lib/modules/$(KERNEL_VERSION) -name '*.sig' -printf '%P\n' | \
+ debian/sign-file-attach \
+ $(SIGNATURE_DIR)/lib/modules/$(KERNEL_VERSION) \
+ /lib/modules/$(KERNEL_VERSION) \
+ $(PACKAGE_DIR)/lib/modules/$(KERNEL_VERSION)
+# Copy any device tree files
+ if [ -d /usr/lib/linux-image-$(KERNEL_VERSION) ]; then \
+ mkdir -p $(PACKAGE_DIR)/usr/lib/linux-image-$(KERNEL_VERSION); \
+ rsync -a /usr/lib/linux-image-$(KERNEL_VERSION)/ \
+ $(PACKAGE_DIR)/usr/lib/linux-image-$(KERNEL_VERSION)/; \
+ fi
+# Copy bug scripts but change the info file to refer to the right package
+ mkdir -p $(PACKAGE_DIR)/usr/share/bug/$(PACKAGE_NAME)
+ rsync -a /usr/share/bug/$(IMAGE_PACKAGE_NAME)/ \
+ $(PACKAGE_DIR)/usr/share/bug/$(PACKAGE_NAME)/
+ sed -i -e 's/^PACKAGE_NAME=.*/PACKAGE_NAME=$(PACKAGE_NAME)/' \
+ -e 's/^PACKAGE_VERSION=.*/PACKAGE_VERSION=$(PACKAGE_VERSION)/' \
+ $(PACKAGE_DIR)/usr/share/bug/$(PACKAGE_NAME)/info
+ dh_install
+ dh_installchangelogs
+ ln -sf linux-image.NEWS debian/$(PACKAGE_NAME).NEWS
+ dh_installdocs
+ dh_lintian
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+# Copy most package relations and description from unsigned package
+ for field in Depends Suggests Recommends Breaks; do \
+ echo >> debian/$(PACKAGE_NAME).substvars "unsigned:$$field=$$(dpkg-query -f '$${'$$field'}' -W $(IMAGE_PACKAGE_NAME))"; \
+ done
+ echo >> debian/$(PACKAGE_NAME).substvars "unsigned:DescriptionShort=$$(dpkg-query -f '$${Description}' -W $(IMAGE_PACKAGE_NAME) | head -n 1)"
+ echo >> debian/$(PACKAGE_NAME).substvars "unsigned:DescriptionLong=$$(dpkg-query -f '$${Description}' -W $(IMAGE_PACKAGE_NAME) | tail -n +2 | sed -rz 's/\$$/$${}/g; s/^ //; s/\n \.?/$${Newline}/g')"
+ dh_gencontrol -- $(GENCONTROL_ARGS)
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+build_meta:
+
+binary_meta:
+ dh_testdir
+ dh_prep
+ dh_bugfiles
+ dh_installdocs --link-doc=$(INSTALLDOCS_LINK_DOC)
+ dh_lintian
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol -- $(GENCONTROL_ARGS)
+ dh_md5sums
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+build_udeb:
+
+binary_udeb: export KW_DEFCONFIG_DIR=/usr/share/linux-support-$(ABINAME)/installer
+binary_udeb: export KW_CONFIG_DIR=/usr/share/linux-support-$(ABINAME)/installer
+binary_udeb:
+ dh_testdir
+ dh_prep
+ kernel-wedge install-files $(ABINAME)
+ kernel-wedge check $(PACKAGE_NAMES)
+ dh_fixperms
+ dh_gencontrol -- $(GENCONTROL_ARGS)
+ dh_builddeb -- $(BUILDDEB_ARGS)
+
+.PHONY: build_% binary_%