linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] builddeb: Support signing kernels with a Machine Owner Key
@ 2021-10-13 20:05 Matthew Wilcox (Oracle)
  2021-10-14  9:46 ` Ard Biesheuvel
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox (Oracle) @ 2021-10-13 20:05 UTC (permalink / raw)
  Cc: Matthew Wilcox (Oracle),
	Masahiro Yamada, Michal Marek, Nick Desaulniers, linux-kbuild,
	linux-kernel, efi, debian-kernel, linux-efi

If the config file specifies a signing key, use it to sign
the kernel so that machines with SecureBoot enabled can boot.
See https://wiki.debian.org/SecureBoot

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 scripts/package/builddeb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 91a502bb97e8..4fa6ff2b5cac 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -147,7 +147,15 @@ else
 	cp System.map "$tmpdir/boot/System.map-$version"
 	cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
 fi
-cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path"
+
+vmlinux=$($MAKE -s -f $srctree/Makefile image_name)
+if is_enabled CONFIG_MODULE_SIG; then
+	cert=$srctree/$(grep ^CONFIG_MODULE_SIG_KEY= include/config/auto.conf | cut -d\" -f2)
+	key=${cert%pem}priv
+	sbsign --key $key --cert $cert "$vmlinux" --output "$tmpdir/$installed_image_path"
+else
+	cp "$vmlinux" "$tmpdir/$installed_image_path"
+fi
 
 if is_enabled CONFIG_OF_EARLY_FLATTREE; then
 	# Only some architectures with OF support have this target
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-17 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 20:05 [PATCH] builddeb: Support signing kernels with a Machine Owner Key Matthew Wilcox (Oracle)
2021-10-14  9:46 ` Ard Biesheuvel
2021-11-04  9:28   ` Masahiro Yamada
2021-12-16 22:04     ` Matthew Wilcox
2021-12-17 15:29       ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).