If you want to make a disk image containing rootfs for different machines, the only way to do it today is by calling wic and passing the different rootfs-paths.
Eg: combined.wks part /export --source rootfs --rootfs-dir=target-image part / --source rootfs bitbake multiconfig:arm:target-image wic create combined --rootfs-dir target-image=/workdir/build/tmp/work/arm-poky-linux/target-image/1.0-r0/rootfs/ -e main This has many drawbacks: 1) You need to know the folder location for the target-image 2) It is easy to forget updating the target (only running wic and not bitbake) 3) It is slow 4) It does not scale when you have multiple machines Instead, wic can be given a hint of what machine to search for: combined.wks part /export --source rootfs --rootfs-dir=arm:target-image part / --source rootfs bitbake main If we ensoure the dependency of target-image from main via do_image[mcdepends], all the dependencies are automatically handled. This patch makes wic aware of the machine to use. Signed-off-by: Ricardo Ribalda Delgado <rica...@ribalda.com> --- scripts/lib/wic/misc.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/lib/wic/misc.py b/scripts/lib/wic/misc.py index 91975ba151..51b43b49aa 100644 --- a/scripts/lib/wic/misc.py +++ b/scripts/lib/wic/misc.py @@ -206,7 +206,12 @@ class BitbakeVars(defaultdict): if image not in self: if image and self.vars_dir: - fname = os.path.join(self.vars_dir, image + '.env') + if image.find(":") != -1: + [machine, img] = image.split(":") + fname = os.path.join(self.vars_dir, "../../", + machine, "imgdata", img + '.env') + else: + fname = os.path.join(self.vars_dir, image + '.env') if os.path.isfile(fname): # parse .env file with open(fname) as varsfile: @@ -220,11 +225,16 @@ class BitbakeVars(defaultdict): # Get bitbake -e output cmd = "bitbake -e" if image: - cmd += " %s" % image + if image.find(":") != -1: + [machine, img] = image.split(":") + cmd = "MACHINE=%s %s" % (machine, cmd) + else: + img = image + cmd += " %s" % img log_level = logger.getEffectiveLevel() logger.setLevel(logging.INFO) - ret, lines = _exec_cmd(cmd) + ret, lines = _exec_cmd(cmd, as_shell=True) logger.setLevel(log_level) if ret: -- 2.26.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#137446): https://lists.openembedded.org/g/openembedded-core/message/137446 Mute This Topic: https://lists.openembedded.org/mt/73241116/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-