summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/wic.py
diff options
context:
space:
mode:
authorKristian Klausen <kristian@klausen.dk>2021-09-28 14:44:16 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-04 15:03:53 +0100
commitb8c0f073f6a282f89fba7711ec168d0638749300 (patch)
treee5ab029e59753092968248f5d339d3b0dda83f1f /meta/lib/oeqa/selftest/cases/wic.py
parent75b79d5c056b5abb44c546af773e3431d4c09476 (diff)
downloadpoky-b8c0f073f6a282f89fba7711ec168d0638749300.tar.gz
wic/bootimg-efi: Add Unified Kernel Image option
"A unified kernel image is a single EFI PE executable combining an EFI stub loader, a kernel image, an initramfs image, and the kernel command line. [...] Images of this type have the advantage that all metadata and payload that makes up the boot entry is monopolized in a single PE file that can be signed cryptographically as one for the purpose of EFI SecureBoot."[1] This commit adds a create-unified-kernel-image=true option to the bootimg-efi plugin for creating a Unified Kernel Image[1] and installing it into $BOOT/EFI/Linux/ with a .efi extension per the the Boot Loader Specification[1][2]. This is useful for implementing Secure Boot. systemd-boot is the only mainstream bootloader implementing the specification, but GRUB should be able to boot the EFI binary, this commit however doesn't implement the necessary changes to the GRUB config generation logic to boot the Unified Kernel Image. [1] https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images [2] https://systemd.io/BOOT_LOADER_SPECIFICATION/ (From OE-Core rev: b0573f240525df561ddef6e47cb285b217d38487) Signed-off-by: Kristian Klausen <kristian@klausen.dk> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/wic.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index dc7b9e637e..5fc8e65142 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -1158,6 +1158,35 @@ class Wic2(WicTestCase):
1158 out = glob(self.resultdir + "%s-*.direct" % wksname) 1158 out = glob(self.resultdir + "%s-*.direct" % wksname)
1159 self.assertEqual(1, len(out)) 1159 self.assertEqual(1, len(out))
1160 1160
1161 @only_for_arch(['i586', 'i686', 'x86_64'])
1162 def test_efi_plugin_unified_kernel_image_qemu(self):
1163 """Test efi plugin's Unified Kernel Image feature in qemu"""
1164 config = 'IMAGE_FSTYPES = "wic"\n'\
1165 'INITRAMFS_IMAGE = "core-image-minimal-initramfs"\n'\
1166 'WKS_FILE = "test_efi_plugin.wks"\n'\
1167 'MACHINE_FEATURES:append = " efi"\n'
1168 self.append_config(config)
1169 self.assertEqual(0, bitbake('core-image-minimal core-image-minimal-initramfs ovmf').status)
1170 self.remove_config(config)
1171
1172 with runqemu('core-image-minimal', ssh=False,
1173 runqemuparams='ovmf', image_fstype='wic') as qemu:
1174 # Check that /boot has EFI bootx64.efi (required for EFI)
1175 cmd = "ls /boot/EFI/BOOT/bootx64.efi | wc -l"
1176 status, output = qemu.run_serial(cmd)
1177 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1178 self.assertEqual(output, '1')
1179 # Check that /boot has EFI/Linux/linux.efi (required for Unified Kernel Images auto detection)
1180 cmd = "ls /boot/EFI/Linux/linux.efi | wc -l"
1181 status, output = qemu.run_serial(cmd)
1182 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1183 self.assertEqual(output, '1')
1184 # Check that /boot doesn't have loader/entries/boot.conf (Unified Kernel Images are auto detected by the bootloader)
1185 cmd = "ls /boot/loader/entries/boot.conf 2&>/dev/null | wc -l"
1186 status, output = qemu.run_serial(cmd)
1187 self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output))
1188 self.assertEqual(output, '0')
1189
1161 def test_fs_types(self): 1190 def test_fs_types(self):
1162 """Test filesystem types for empty and not empty partitions""" 1191 """Test filesystem types for empty and not empty partitions"""
1163 img = 'core-image-minimal' 1192 img = 'core-image-minimal'