wic/bootimg-efi: use cross objcopy when building unified kernel image

We can't rely on the host objcopy knowing how to process target binaries,
so use the cross objcopy in the sysroot instead.

Also construct the command argument-by-argument as the format expression
was getting unwieldy.

(From OE-Core rev: 0264aeedbf21e9e7a104243c11b3b57f00e38bda)

(From OE-Core rev: 4e8b803d7efa13c950353bb00ab65be22eb61736)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton authored and Richard Purdie committed 2022-08-31 16:54:17 +01:00
1 parent 8191b79123
commit cd88865fd2
1 file changed
+12 -13
+12 -13
View File
@@ -326,21 +326,20 @@ class BootimgEFIPlugin(SourcePlugin):
exec_cmd(install_cmd)
staging_dir_host = get_bitbake_var("STAGING_DIR_HOST")
target_sys = get_bitbake_var("TARGET_SYS")
# https://www.freedesktop.org/software/systemd/man/systemd-stub.html
objcopy_cmd = "objcopy \
--add-section .osrel=%s --change-section-vma .osrel=0x20000 \
--add-section .cmdline=%s --change-section-vma .cmdline=0x30000 \
--add-section .linux=%s --change-section-vma .linux=0x2000000 \
--add-section .initrd=%s --change-section-vma .initrd=0x3000000 \
%s %s" % \
("%s/usr/lib/os-release" % staging_dir_host,
cmdline.name,
"%s/%s" % (staging_kernel_dir, kernel),
initrd.name,
efi_stub,
"%s/EFI/Linux/linux.efi" % hdddir)
exec_cmd(objcopy_cmd)
objcopy_cmd = "%s-objcopy" % target_sys
objcopy_cmd += " --add-section .osrel=%s/usr/lib/os-release" % staging_dir_host
objcopy_cmd += " --change-section-vma .osrel=0x20000"
objcopy_cmd += " --add-section .cmdline=%s" % cmdline.name
objcopy_cmd += " --change-section-vma .cmdline=0x30000"
objcopy_cmd += " --add-section .linux=%s/%s" % (staging_kernel_dir, kernel)
objcopy_cmd += " --change-section-vma .linux=0x2000000"
objcopy_cmd += " --add-section .initrd=%s" % initrd.name
objcopy_cmd += " --change-section-vma .initrd=0x3000000"
objcopy_cmd += " %s %s/EFI/Linux/linux.efi" % (efi_stub, hdddir)
exec_native_cmd(objcopy_cmd, native_sysroot)
else:
install_cmd = "install -m 0644 %s/%s %s/%s" % \
(staging_kernel_dir, kernel, hdddir, kernel)