diff options
author | Maxim Uvarov <maxim.uvarov@linaro.org> | 2022-10-05 08:55:03 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-10-26 12:28:37 +0100 |
commit | 5b0de8447e5aeb14cbf78ade11f0a3af074d8055 (patch) | |
tree | a0e1011a256d6335f023724f816dfffaba1640a9 /scripts | |
parent | 5680ba2ca5c00f924905dc9c56a61cfde3532e8f (diff) | |
download | poky-5b0de8447e5aeb14cbf78ade11f0a3af074d8055.tar.gz |
wic: add UEFI kernel as UEFI stub
Linux kernel can be compiled as UEFI stub and loaded directly
with UEFI firmware without grub or other UEFI shell.
Tested with wic file:
bootloader --ptable gpt --timeout=0 --append="rootwait"
part /boot --source bootimg-efi --sourceparams="loader=uefi-kernel" \
--ondisk sda --fstype=vfat --label bootfs \
--active --align 1024 --use-uuid
part / --source rootfs --fstype=ext4 --label rootfs \
--align 1024 --exclude-path boot/ --use-label
(From OE-Core rev: b18025fc8a2dad963b6f4b697e24455f2511b279)
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-efi.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 634a808d78..70c55ce2f0 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py | |||
@@ -220,6 +220,8 @@ class BootimgEFIPlugin(SourcePlugin): | |||
220 | cls.do_configure_grubefi(hdddir, creator, cr_workdir, source_params) | 220 | cls.do_configure_grubefi(hdddir, creator, cr_workdir, source_params) |
221 | elif source_params['loader'] == 'systemd-boot': | 221 | elif source_params['loader'] == 'systemd-boot': |
222 | cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) | 222 | cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) |
223 | elif source_params['loader'] == 'uefi-kernel': | ||
224 | return | ||
223 | else: | 225 | else: |
224 | raise WicError("unrecognized bootimg-efi loader: %s" % source_params['loader']) | 226 | raise WicError("unrecognized bootimg-efi loader: %s" % source_params['loader']) |
225 | except KeyError: | 227 | except KeyError: |
@@ -385,6 +387,28 @@ class BootimgEFIPlugin(SourcePlugin): | |||
385 | for mod in [x for x in os.listdir(kernel_dir) if x.startswith("systemd-")]: | 387 | for mod in [x for x in os.listdir(kernel_dir) if x.startswith("systemd-")]: |
386 | cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:]) | 388 | cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, mod[8:]) |
387 | exec_cmd(cp_cmd, True) | 389 | exec_cmd(cp_cmd, True) |
390 | elif source_params['loader'] == 'uefi-kernel': | ||
391 | kernel = get_bitbake_var("KERNEL_IMAGETYPE") | ||
392 | if not kernel: | ||
393 | raise WicError("Empty KERNEL_IMAGETYPE %s\n" % target) | ||
394 | target = get_bitbake_var("TARGET_SYS") | ||
395 | if not target: | ||
396 | raise WicError("Unknown arch (TARGET_SYS) %s\n" % target) | ||
397 | |||
398 | if re.match("x86_64", target): | ||
399 | kernel_efi_image = "bootx64.efi" | ||
400 | elif re.match('i.86', target): | ||
401 | kernel_efi_image = "bootia32.efi" | ||
402 | elif re.match('aarch64', target): | ||
403 | kernel_efi_image = "bootaa64.efi" | ||
404 | elif re.match('arm', target): | ||
405 | kernel_efi_image = "bootarm.efi" | ||
406 | else: | ||
407 | raise WicError("UEFI stub kernel is incompatible with target %s" % target) | ||
408 | |||
409 | for mod in [x for x in os.listdir(kernel_dir) if x.startswith(kernel)]: | ||
410 | cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, kernel_efi_image) | ||
411 | exec_cmd(cp_cmd, True) | ||
388 | else: | 412 | else: |
389 | raise WicError("unrecognized bootimg-efi loader: %s" % | 413 | raise WicError("unrecognized bootimg-efi loader: %s" % |
390 | source_params['loader']) | 414 | source_params['loader']) |