* [PATCH 1/3] wic: add target tools to PATH when executing native commands
@ 2022-07-27 11:11 Ross Burton
2022-07-27 11:11 ` [PATCH 2/3] wic/bootimg-efi: use cross objcopy when building unified kernel image Ross Burton
2022-07-27 11:11 ` [PATCH 3/3] wic: depend on cross-binutils Ross Burton
0 siblings, 2 replies; 3+ messages in thread
From: Ross Burton @ 2022-07-27 11:11 UTC (permalink / raw
To: openembedded-core; +Cc: nd
We might want to run a cross tool, such as objcopy, in wic. These are
in a TARGET_SYS/ subdirectory under /usr/bin, so add that directory to
the search path too.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
scripts/lib/wic/misc.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/scripts/lib/wic/misc.py b/scripts/lib/wic/misc.py
index 3bc165fd7d4..2b90821b305 100644
--- a/scripts/lib/wic/misc.py
+++ b/scripts/lib/wic/misc.py
@@ -141,11 +141,12 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""):
cmd_and_args = pseudo + cmd_and_args
hosttools_dir = get_bitbake_var("HOSTTOOLS_DIR")
+ target_sys = get_bitbake_var("TARGET_SYS")
- native_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin:%s/bin:%s" % \
+ native_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin:%s/usr/bin/%s:%s/bin:%s" % \
(native_sysroot, native_sysroot,
- native_sysroot, native_sysroot,
- hosttools_dir)
+ native_sysroot, native_sysroot, target_sys,
+ native_sysroot, hosttools_dir)
native_cmd_and_args = "export PATH=%s:$PATH;%s" % \
(native_paths, cmd_and_args)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] wic/bootimg-efi: use cross objcopy when building unified kernel image
2022-07-27 11:11 [PATCH 1/3] wic: add target tools to PATH when executing native commands Ross Burton
@ 2022-07-27 11:11 ` Ross Burton
2022-07-27 11:11 ` [PATCH 3/3] wic: depend on cross-binutils Ross Burton
1 sibling, 0 replies; 3+ messages in thread
From: Ross Burton @ 2022-07-27 11:11 UTC (permalink / raw
To: openembedded-core; +Cc: nd
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.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
scripts/lib/wic/plugins/source/bootimg-efi.py | 25 +++++++++----------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 0391aebdc84..a65a5b97804 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -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)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] wic: depend on cross-binutils
2022-07-27 11:11 [PATCH 1/3] wic: add target tools to PATH when executing native commands Ross Burton
2022-07-27 11:11 ` [PATCH 2/3] wic/bootimg-efi: use cross objcopy when building unified kernel image Ross Burton
@ 2022-07-27 11:11 ` Ross Burton
1 sibling, 0 replies; 3+ messages in thread
From: Ross Burton @ 2022-07-27 11:11 UTC (permalink / raw
To: openembedded-core; +Cc: nd
Wic can build an unified kernel image, but this needs the cross-objcopy
from binutils.
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
meta/classes/image_types_wic.bbclass | 2 ++
meta/recipes-core/meta/wic-tools.bb | 1 +
2 files changed, 3 insertions(+)
diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass
index 79f8d93b94c..940dc5f5774 100644
--- a/meta/classes/image_types_wic.bbclass
+++ b/meta/classes/image_types_wic.bbclass
@@ -84,6 +84,8 @@ do_image_wic[deptask] += "do_image_complete"
WKS_FILE_DEPENDS_DEFAULT = '${@bb.utils.contains_any("BUILD_ARCH", [ 'x86_64', 'i686' ], "syslinux-native", "",d)}'
WKS_FILE_DEPENDS_DEFAULT += "bmap-tools-native cdrtools-native btrfs-tools-native squashfs-tools-native e2fsprogs-native erofs-utils-native"
+# Unified kernel images need objcopy
+WKS_FILE_DEPENDS_DEFAULT += "virtual/${TARGET_PREFIX}binutils"
WKS_FILE_DEPENDS_BOOTLOADERS = ""
WKS_FILE_DEPENDS_BOOTLOADERS:x86 = "syslinux grub-efi systemd-boot os-release"
WKS_FILE_DEPENDS_BOOTLOADERS:x86-64 = "syslinux grub-efi systemd-boot os-release"
diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb
index b9580d7e335..9282d36a4dc 100644
--- a/meta/recipes-core/meta/wic-tools.bb
+++ b/meta/recipes-core/meta/wic-tools.bb
@@ -7,6 +7,7 @@ DEPENDS = "\
mtools-native bmap-tools-native grub-native cdrtools-native \
btrfs-tools-native squashfs-tools-native pseudo-native \
e2fsprogs-native util-linux-native tar-native erofs-utils-native \
+ virtual/${TARGET_PREFIX}binutils \
"
DEPENDS:append:x86 = " syslinux-native syslinux grub-efi systemd-boot"
DEPENDS:append:x86-64 = " syslinux-native syslinux grub-efi systemd-boot"
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-27 11:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-27 11:11 [PATCH 1/3] wic: add target tools to PATH when executing native commands Ross Burton
2022-07-27 11:11 ` [PATCH 2/3] wic/bootimg-efi: use cross objcopy when building unified kernel image Ross Burton
2022-07-27 11:11 ` [PATCH 3/3] wic: depend on cross-binutils Ross Burton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.