]> www.infradead.org Git - users/willy/linux.git/commitdiff
builddeb: Support signing kernels with a Machine Owner Key
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Fri, 30 Apr 2021 12:54:45 +0000 (08:54 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 3 Oct 2021 10:56:47 +0000 (06:56 -0400)
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

index 91a502bb97e8ab05c3c901c1ec7e6c413a7c71e6..4fa6ff2b5cac19ee2f10f49cace1065b3ba006bb 100755 (executable)
@@ -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