uefi secureboot with Unified Kernel Image (UKI)
cover uefi secureboot with Unified Kernel Image (UKI)
Change uefi-secureboot to use UKI which extends secure boot coverage from kernel to initramfs and kernel command line. Tested on qemu with qemuarm64-secureboot and genericarm64 machines:
$ kas build ci/qemuarm64-secureboot.yml:ci/uefi-secureboot.yml:ci/testimage.yml $ kas build ci/genericarm64.yml:ci/uefi-secureboot.yml:ci/testimage.yml
Mikko Rapeli (4):
qemuarm64-secureboot.conf: append to WKS_FILE_DEPENDS uefi-secureboot.yml: remove duplicate distro features uefi-secureboot.yml: switch to Unified Kernel Image (UKI)
linux-yocto: remove signing
ci/uefi-secureboot.yml | 20 ++++++++++++++++--- .../conf/machine/qemuarm64-secureboot.conf | 2 +- .../linux/linux-yocto-uefi-secureboot.inc | 10 ---------- 3 files changed, 18 insertions(+), 14 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/4 qemuarm64-secureboot.conf: append to WKS_FILE_DEPENDS
Various classes add dependencies so don't overwrite them.
--- meta-arm/conf/machine/qemuarm64-secureboot.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta-arm/conf/machine/qemuarm64-secureboot.conf +1 -1
@@ -18,7 +18,7 @@ QB_KERNEL_ROOT = "/dev/vda2" IMAGE_FSTYPES += "wic wic.qcow2" WKS_FILE ?= "qemuarm64.wks" -WKS_FILE_DEPENDS = "trusted-firmware-a" +WKS_FILE_DEPENDS:append = " trusted-firmware-a" IMAGE_BOOT_FILES = "${KERNEL_IMAGETYPE}" MACHINE_FEATURES += "optee-ftpm"
Signature · 1 line
2.43.0
PATCH 2/4 uefi-secureboot.yml: remove duplicate distro features
In reply to Mikko RapeliSetting INIT_MANAGER to "systemd" already sets needed feature flags. Appending to them only causes sstate cache invalidation and recompilations.
--- ci/uefi-secureboot.yml | 2 -- 1 file changed, 2 deletions(-)
ci/uefi-secureboot.yml +0 -2
@@ -29,8 +29,6 @@ local_conf_header: # Use systemd as the init system INIT_MANAGER = "systemd" - DISTRO_FEATURES:append = " systemd" - DISTRO_FEATURES_NATIVE:append = " systemd" IMAGE_INSTALL:append = " systemd systemd-boot util-linux coreutils"
Signature · 1 line
2.43.0
PATCH 3/4 uefi-secureboot.yml: switch to Unified Kernel Image (UKI)
In reply to Mikko RapeliUnified Kernel Image includes kernel and initrd which both are signed with UEFI secure boot. This brings secure boot closer to userspace.
Use core-image-initramfs-boot to find the real rootfs and boot systemd init there. No need to hard code rootfs via qemuboot/runqemu variables.
--- ci/uefi-secureboot.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
ci/uefi-secureboot.yml +17 -1
@@ -32,4 +32,20 @@ local_conf_header: IMAGE_INSTALL:append = " systemd systemd-boot util-linux coreutils" - TEST_SUITES:append = " uefi_secureboot" + TEST_SUITES:append = " uefi_secureboot uki" + + IMAGE_CLASSES += "uki" + + IMAGE_CLASSES += "sbsign" + UKI_SB_KEY = "${SBSIGN_KEY}" + UKI_SB_CERT = "${SBSIGN_CERT}" + QB_KERNEL_ROOT = "" + IMAGE_BOOT_FILES:remove = "Image" + + INITRAMFS_IMAGE = "core-image-initramfs-boot" + # not for initramfs image recipe + IMAGE_CLASSES:remove:pn-core-image-initramfs-boot = "uki" + IMAGE_CLASSES:remove:pn-core-image-initramfs-boot = "sbsign" + IMAGE_CLASSES:remove:pn-core-image-initramfs-boot = "testimage" + IMAGE_FEATURES:remove:pn-core-image-initramfs-boot = "ssh-server-dropbear" + CORE_IMAGE_EXTRA_INSTALL:remove:pn-core-image-initramfs-boot = "ssh-pregen-hostkeys"
Signature · 1 line
2.43.0
PATCH 4/4 linux-yocto: remove signing
In reply to Mikko RapeliRemove secure boot signature from kernel image.
It's signed as part of uki image now which signs
kernel, initramfs etc.
--- .../linux/linux-yocto-uefi-secureboot.inc | 10 ---------- 1 file changed, 10 deletions(-)
meta-arm/recipes-kernel/linux/linux-yocto-uefi-secureboot.inc +0 -10
@@ -1,14 +1,4 @@ KERNEL_FEATURES += "cfg/efi-ext.scc" -inherit sbsign - -# shell variable set inside do_compile task -SBSIGN_TARGET_BINARY = "$KERNEL_IMAGE" - -do_compile:append() { - KERNEL_IMAGE=$(find ${B} -name ${KERNEL_IMAGETYPE} -print -quit) - do_sbsign -} - RRECOMMENDS:${PN} += "kernel-module-efivarfs" RRECOMMENDS:${PN} += "kernel-module-efivars"
Signature · 1 line
2.43.0