[v2,1/2,disco,linux-signed] UBUNTU: support recompression of signed kernels

Message ID 20190125175725.6696-5-dann.frazier@canonical.com
State New
Headers show
Series
  • Add support for UEFI signed kernels on arm64
Related show

Commit Message

dann frazier Jan. 25, 2019, 5:57 p.m.
From: Seth Forshee <seth.forshee@canonical.com>

BugLink: https://bugs.launchpad.net/bugs/1804481

Our arm64 generic kernels are compressed, but they must be
decompressed for signing. The kernel build will indicate that a
signed kernel image should be recompressed by adding GZIP=1 into
a <kernel-image>.vars file in the signing tarball. Add support
for reading the contents of this file and compressing the kernel
image when GZIP=1.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
[ dannf: Use maximum gzip compression to match unsigned build ]
Signed-off-by: dann frazier <dann.frazier@canonical.com>
---
 debian/rules | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Patch

diff --git a/debian/rules b/debian/rules
index b9afe67a162e..20b16d7da826 100755
--- a/debian/rules
+++ b/debian/rules
@@ -42,8 +42,16 @@  override_dh_auto_build:
 		cd "$(src_version)" || exit 1;					\
 		for s in *.efi.signed; do					\
 			[ ! -f "$$s" ] && continue;				\
-			chmod 600 "$$s";					\
 			base=$$(echo "$$s" | sed -e 's/.efi.signed//');		\
+			(							\
+				vars="$${base}.efi.vars";			\
+				[ -f "$$vars" ] && . "./$$vars";		\
+				if [ "$$GZIP" = "1" ]; then			\
+					gzip -9 "$$s";				\
+					mv "$${s}.gz" "$$s";			\
+				fi;						\
+			);							\
+			chmod 600 "$$s";					\
 			ln "$$s" "../SIGNED/$$base";				\
 		done;								\
 		for s in *.opal.sig; do						\