From patchwork Sun Oct 25 18:18:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 101915 Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net [185.136.64.228]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.27707.1792952334533910843 for ; Sun, 25 Oct 2026 11:18:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=hzcEksBj; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.228, mailfrom: fm-1329275-202610251818511c865e5b4c0002072d-nhe8az@rts-flowmailer.siemens.com) Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 202610251818511c865e5b4c0002072d for ; Sun, 25 Oct 2026 19:18:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=3+iJXxJ4miocP66MrpA0KdIltbQXo0oSFy8P932YT70=; b=hzcEksBj1C4QgjwFLRBa6z/3z2pLUNGvreBz10c3DGwFSlG50xnWoQtNjfVNmIwU+WRbFF M3+9+kQp96OXz9rxCjsTCejjksQ6SksOKnX7/xUCVpLuN6oi7LV8JF4+swvPnE8U/gvuamEs fFMpgbihQ7EEc+iA9Pu2/jglTTKWfAu8sUD+zJfwswbWnjl9oMyQLsu1tmxuASviBToTOOzK ycXgY4i1mpdrRuN6gpnR7EImQkGEsqDvtI8iH4zp7zdBU/UmV5MMMoYvgFBtZr0UgT5huin5 k76sKi9o5TLm/6stiiTT51BbrGZteuZRxesVhSemALXA2nE/5fdV6erA==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH v2 1/6] kernel-fit-image: add FIT_LOADABLE_* variables to do_compile vardeps Date: Sun, 25 Oct 2026 19:18:27 +0100 Message-ID: <20261025181847.784113-2-adrian.freihofer@siemens.com> In-Reply-To: <20261025181847.784113-1-adrian.freihofer@siemens.com> References: <20261025181847.784113-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Sun, 25 Oct 2026 18:19:00 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248612 From: Adrian Freihofer do_compile only reads the per-loadable flags of the FIT_LOADABLE_* variables with d.getVarFlag('FIT_LOADABLE_*', loadable), never their values. As the flag names are not literals, bitbake cannot track these accesses, so the flags are not part of the do_compile signature. Changing e.g. FIT_LOADABLE_LOADADDRESS[atf] did not trigger a rebuild and a stale FIT image was reused. When FIT_LOADABLES is set, add the FIT_LOADABLE_* variables to do_compile[vardeps] with a single appendVarFlag call after the loop that already processes them. Referencing a variable includes all its flags in the signature. While at it, fix the duplicated word in the comment. This is a fixup for commit 2535427d8de0 "kernel-fit-image: support arbitrary loadables" Signed-off-by: Adrian Freihofer --- meta/classes-recipe/kernel-fit-image.bbclass | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/meta/classes-recipe/kernel-fit-image.bbclass b/meta/classes-recipe/kernel-fit-image.bbclass index 7b2bcd4673..a238de1aa2 100644 --- a/meta/classes-recipe/kernel-fit-image.bbclass +++ b/meta/classes-recipe/kernel-fit-image.bbclass @@ -32,17 +32,19 @@ python () { # Parse loadables config loadables = d.getVar('FIT_LOADABLES') if loadables: - # Check that the loadables configuration variables are not set directly - # directly, then assign them a synthetic value for testability purposes - for v in ['FIT_LOADABLE_ARCH', 'FIT_LOADABLE_COMPRESSION', - 'FIT_LOADABLE_DESCRIPTION', 'FIT_LOADABLE_ENTRYPOINT', - 'FIT_LOADABLE_FILENAME', 'FIT_LOADABLE_LOADADDRESS', - 'FIT_LOADABLE_OS', 'FIT_LOADABLE_TYPE']: + # Forbid direct assignment, set synthetic values for testability and + # add the vars to vardeps so their flags are part of the signature. + loadable_vars = ['FIT_LOADABLE_ARCH', 'FIT_LOADABLE_COMPRESSION', + 'FIT_LOADABLE_DESCRIPTION', 'FIT_LOADABLE_ENTRYPOINT', + 'FIT_LOADABLE_FILENAME', 'FIT_LOADABLE_LOADADDRESS', + 'FIT_LOADABLE_OS', 'FIT_LOADABLE_TYPE'] + for v in loadable_vars: if d.getVar(v): raise bb.parse.SkipRecipe("You cannot use %s as a variable, you can only set flags." % v) synt_value = " ? ".join([ d.getVarFlag(v, loadable) or "" for loadable in loadables.split() ]) d.setVar(v, synt_value) + d.appendVarFlag('do_compile', 'vardeps', ' ' + ' '.join(loadable_vars)) } do_configure[noexec] = "1" From patchwork Sun Oct 25 18:18:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 101913 Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.27496.1792952334704607207 for ; Sun, 25 Oct 2026 11:18:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=c/+vDNOq; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.226, mailfrom: fm-1329275-20261025181851ac0dd5d56c00020724-j5dlm4@rts-flowmailer.siemens.com) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 20261025181851ac0dd5d56c00020724 for ; Sun, 25 Oct 2026 19:18:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=DptLzR39Hz7wZETPur9ylLpgGGqOSAizOaIzNr8ev4M=; b=c/+vDNOqAXwLGn28hdDPkkP2ITvFemJYKIiGTX7iBm/y7SrrxgUH0OwIa8Y8MMfKxz4yMR UAUmWxP6PiiaKXJf04TcGfFxBKf5zwbvq7YuDtwptwoVnxzhXAHBmKT00VA8MJ4A5/D+tKk+ Ex9QnaGIIGH1oMjWU2PbqydqUxCUhskZpnHZnmA3aNjp5z8owbQzEa3GhnnTSvUa8afbm9Oz BGkIRsC6AhMNIoAMSUycvSyClF7kBOL/9RtWze7xW3x4JflQrtmdCLGP/sl5PmO4r3qJ1jHk Q/IbFXJlXdc8GWCAzK0x2jrgKuw7EvtVOx6Xuy07FxPayusawyuzdVZQ==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH v2 2/6] oeqa/selftest/esdk: pass only the image name to get_bb_vars Date: Sun, 25 Oct 2026 19:18:28 +0100 Message-ID: <20261025181847.784113-3-adrian.freihofer@siemens.com> In-Reply-To: <20261025181847.784113-1-adrian.freihofer@siemens.com> References: <20261025181847.784113-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Sun, 25 Oct 2026 18:18:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248617 From: Adrian Freihofer get_eSDK_toolchain passes " -c populate_sdk_ext" as the target to get_bb_vars. This works only because get_bb_vars passes the target to "bitbake -e" as is. The task does not change the variable values which are reported by bitbake -e, pass the image name only. Signed-off-by: Adrian Freihofer --- meta/lib/oeqa/selftest/cases/esdk.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/esdk.py b/meta/lib/oeqa/selftest/cases/esdk.py index 7a5fe00a08..691a80cc8d 100644 --- a/meta/lib/oeqa/selftest/cases/esdk.py +++ b/meta/lib/oeqa/selftest/cases/esdk.py @@ -42,9 +42,7 @@ class oeSDKExtSelfTest(OESelftestTestCase): @staticmethod def get_eSDK_toolchain(image): - pn_task = '%s -c populate_sdk_ext' % image - - bb_vars = get_bb_vars(['SDK_DEPLOY', 'TOOLCHAINEXT_OUTPUTNAME'], pn_task) + bb_vars = get_bb_vars(['SDK_DEPLOY', 'TOOLCHAINEXT_OUTPUTNAME'], image) sdk_deploy = bb_vars['SDK_DEPLOY'] toolchain_name = bb_vars['TOOLCHAINEXT_OUTPUTNAME'] return os.path.join(sdk_deploy, toolchain_name + '.sh') From patchwork Sun Oct 25 18:18:29 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 101916 Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.27497.1792952334746325424 for ; Sun, 25 Oct 2026 11:18:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=mLnVHelr; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.225, mailfrom: fm-1329275-2026102518185137682b23be0002074f-ednjyf@rts-flowmailer.siemens.com) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 2026102518185137682b23be0002074f for ; Sun, 25 Oct 2026 19:18:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=BxGuveQWxhPFureqVqBXzXtkD+/NgCJtB0dOtOif9hg=; b=mLnVHelrvecoH9oXKRJhi7AUT0TrmImrnPCoxJKM4ilN7g8zhjAMiaA2QIxFTJ3QPLtUoA vGVDssCPDMl0EOqz8WrCCjsIkIo6akTPA743s+OxYLvmY1FpCXB53o/bELNEqo1AkC7V55xf oisuf2yYVksSdmaJ3YeC7vGOY5SO5+Gku5bOvd0wGyjh4GbnSm01Pd0moMRLZ7FxIZ92G6n9 UetZ31UtN5dJw8eILbXMS/z+5gZMCtcDgnETlp5cDHUNq2X2Ko7OMNWFOK7wxOEmvGKGT3R+ obD4iiCy/Lf8/rVZ9+I+2+q0SvS6FfQntbiBGPNCSym1D6zFjIuF6nBw==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH v2 3/6] oeqa/utils/commands: use tinfoil in get_bb_vars Date: Sun, 25 Oct 2026 19:18:29 +0100 Message-ID: <20261025181847.784113-4-adrian.freihofer@siemens.com> In-Reply-To: <20261025181847.784113-1-adrian.freihofer@siemens.com> References: <20261025181847.784113-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Sun, 25 Oct 2026 18:19:00 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248616 From: Adrian Freihofer Refactor get_bb_vars to read the variables from a tinfoil datastore instead of parsing the "bitbake -e" output with regular expressions. Without a target, finalizeData() is used as bitbake -e does. The postconfig file handling of bitbake() is moved into a context manager which is shared with get_bb_vars. The postconfig parameter is kept although no caller in oe-core uses it. The API does not change. Small differences in the returned values: - values are no longer shell escaped. bitbake -e escapes $, ", ` and newlines, e.g. BB_UNIHASH was returned as \${BB_TASKHASH}. This is consistent with get_bb_var, which already returned unescaped values. No test in oe-core or meta-yocto undoes the escaping or reads a variable which contains these characters after expansion. - multi-line values are found - lines of shell functions are no longer returned as variables - when all variables are requested, names such as FILES:${PN} are returned as well It is also faster. Without a memory resident bitbake server, reading a few configuration variables takes 0.65s instead of 2.0s, reading a few variables of a recipe takes 2.1s instead of 2.8s. Signed-off-by: Adrian Freihofer --- meta/lib/oeqa/utils/commands.py | 99 +++++++++++++++++---------------- 1 file changed, 51 insertions(+), 48 deletions(-) diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 9154220968..1ccc107aed 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -218,25 +218,33 @@ def runCmd(command, ignore_status=False, timeout=None, assert_error=True, sync=T return result -def bitbake(command, ignore_status=False, timeout=None, postconfig=None, output_log=None, **options): - - if postconfig: - postconfig_file = os.path.join(os.environ.get('BUILDDIR'), 'oeqa-post.conf') - ftools.write_file(postconfig_file, postconfig) - extra_args = "-R %s" % postconfig_file - else: - extra_args = "" - - if isinstance(command, str): - cmd = "bitbake " + extra_args + " " + command - else: - cmd = [ "bitbake" ] + [a for a in (command + extra_args.split(" ")) if a not in [""]] +@contextlib.contextmanager +def _postconfig_file(postconfig): + """Write postconfig to a temporary configuration file and yield its path + Yield None if there is no postconfig. + """ + if not postconfig: + yield None + return + path = os.path.join(os.environ.get('BUILDDIR'), 'oeqa-post.conf') + ftools.write_file(path, postconfig) try: - return runCmd(cmd, ignore_status, timeout, output_log=output_log, **options) + yield path finally: - if postconfig: - os.remove(postconfig_file) + os.remove(path) + + +def bitbake(command, ignore_status=False, timeout=None, postconfig=None, output_log=None, **options): + with _postconfig_file(postconfig) as postfile: + extra_args = "-R %s" % postfile if postfile else "" + + if isinstance(command, str): + cmd = "bitbake " + extra_args + " " + command + else: + cmd = [ "bitbake" ] + [a for a in (command + extra_args.split(" ")) if a not in [""]] + + return runCmd(cmd, ignore_status, timeout, output_log=output_log, **options) def get_bb_env(target=None, postconfig=None): @@ -246,42 +254,37 @@ def get_bb_env(target=None, postconfig=None): return bitbake("-e", postconfig=postconfig).output def get_bb_vars(variables=None, target=None, postconfig=None): - """Get values of multiple bitbake variables""" - bbenv = get_bb_env(target, postconfig=postconfig) + """Get values of multiple bitbake variables + + All values are read with a single tinfoil session. If variables is None, + all variables are returned. Unset or empty values are returned as None. + """ + import bb.tinfoil - if variables is not None: - variables = list(variables) - var_re = re.compile(r'^(export )?(?P\w+(_.*)?)="(?P.*)"$') - unset_re = re.compile(r'^unset (?P\w+)$') - lastline = None values = {} - for line in bbenv.splitlines(): - match = var_re.match(line) - val = None - if match: - val = match.group('value') + with _postconfig_file(postconfig) as postfile, bb.tinfoil.Tinfoil() as tinfoil: + config_params = None + if postfile: + config_params = bb.tinfoil.TinfoilConfigParameters(config_only=not target, quiet=2, postfile=[postfile]) + tinfoil.prepare(config_only=not target, config_params=config_params, quiet=2) + if target: + d = tinfoil.parse_recipe(target) else: - match = unset_re.match(line) - if match: - # Handle [unexport] variables - if lastline.startswith('# "'): - val = lastline.split('"')[1] - if val: - var = match.group('var') - if variables is None: - values[var] = val - else: - if var in variables: - values[var] = val - variables.remove(var) - # Stop after all required variables have been found - if not variables: - break - lastline = line - if variables: - # Fill in missing values + # Expand keys and run anonymous functions to get the same result as "bitbake -e" + d = tinfoil.finalizeData() + + if variables is None: + for var in d.keys(): + if var.startswith('__') or d.getVarFlag(var, 'func'): + continue + val = d.getVar(var) + if val is not None and val != '': + values[var] = str(val) + return values + for var in variables: - values[var] = None + val = d.getVar(var) + values[var] = str(val) if val is not None and val != '' else None return values def get_bb_var(var, target=None, postconfig=None): From patchwork Sun Oct 25 18:18:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 101912 Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.27495.1792952334704440004 for ; Sun, 25 Oct 2026 11:18:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=j1aW1Ftj; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.226, mailfrom: fm-1329275-2026102518185113d718b35b000207b4-ylbgcr@rts-flowmailer.siemens.com) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 2026102518185113d718b35b000207b4 for ; Sun, 25 Oct 2026 19:18:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=6rCDAI0aGvUJDyYzVyjEJm1BwHkqiEasPn9fpxKrGaA=; b=j1aW1FtjdO5m7nAXzwppIzaqDXsJ1RwQx86ytzJKcKPBMDuYJEIbjxbRkm5T+dbGOIimbJ lH9NjSBz3ZJX6kd2nqSVjuULrTJSoqny5JIE0BG5wrKfVUt60OXXY1TcdN4fMYu/Ya3q1uvU 7F95M2j54ESgnxG03eacUzlRS+Dwst4H57itJ4jC7xvoyTiSUZ53s0XlxVgf7jsHsacbNNpE dCsi2p0cWRETtgMiYb8Pnuoza9KlWat82jy6XnBjam1qCagtxgI8v9zjnr54KR1ay1COBkNp b9TJqK1t70Ssgw0gX5Ah9U4AWVN1rN4Z0Kg2MgKXEAQB9AeG8897js2w==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH v2 4/6] oeqa/utils/commands: support variable flags in get_bb_vars Date: Sun, 25 Oct 2026 19:18:30 +0100 Message-ID: <20261025181847.784113-5-adrian.freihofer@siemens.com> In-Reply-To: <20261025181847.784113-1-adrian.freihofer@siemens.com> References: <20261025181847.784113-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Sun, 25 Oct 2026 18:18:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248618 From: Adrian Freihofer Tests can not query variable flags with get_bb_vars. They either need another bitbake invocation per flag or the metadata needs to copy the flags into variable values just to make them visible to the tests. Allow requesting variable flags with the VAR[flag] syntax. They are read in the same tinfoil session as the variables. Unset or empty flags are returned as None, consistent with the variables. For example: bb_vars = get_bb_vars(['FIT_LOADABLES', 'FIT_LOADABLE_FILENAME[loadable1]'], 'linux-yocto-fitimage') filename = bb_vars['FIT_LOADABLE_FILENAME[loadable1]'] Signed-off-by: Adrian Freihofer --- meta/lib/oeqa/utils/commands.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 1ccc107aed..f4876ca6c9 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -254,10 +254,11 @@ def get_bb_env(target=None, postconfig=None): return bitbake("-e", postconfig=postconfig).output def get_bb_vars(variables=None, target=None, postconfig=None): - """Get values of multiple bitbake variables + """Get values of multiple bitbake variables or variable flags - All values are read with a single tinfoil session. If variables is None, - all variables are returned. Unset or empty values are returned as None. + All values are read with a single tinfoil session. Variable flags can be + requested with the VAR[flag] syntax. If variables is None, all variables + are returned. Unset or empty values are returned as None. """ import bb.tinfoil @@ -282,8 +283,13 @@ def get_bb_vars(variables=None, target=None, postconfig=None): values[var] = str(val) return values + flag_re = re.compile(r'^(?P[^\[]+)\[(?P[^\]]+)\]$') for var in variables: - val = d.getVar(var) + match = flag_re.match(var) + if match: + val = d.getVarFlag(match.group('var'), match.group('flag')) + else: + val = d.getVar(var) values[var] = str(val) if val is not None and val != '' else None return values From patchwork Sun Oct 25 18:18:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 101914 Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.27708.1792952334673933839 for ; Sun, 25 Oct 2026 11:18:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=JTxZOoSv; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.227, mailfrom: fm-1329275-202610251818511717b815a10002072e-nezrt9@rts-flowmailer.siemens.com) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 202610251818511717b815a10002072e for ; Sun, 25 Oct 2026 19:18:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=a9SztI/VpScl84W1EFWbfnv0qJX7+4leZTPm5jc7rTk=; b=JTxZOoSv8lu1wyuvLCcKYm23PZKAotBUovEqa/IWTDEh8UzBSl4F3QuYULhHIzS+cCvh/L z9Y/T84vZp7znvJScN4YtW8u0FHEPXCpnmNgHeKcKC38VvagF+clTSPBUmLy+zySL7wGvi1+ GEDxuQ/QijhEYSLEqPIEPPDjBoBQ2RhPZjPG04sfEzCMbdghs92kMUiXlfmi9zQk2aMXSK/y 1tVsHhk28sl0vkF/aA4oNrncu+3IH9ftsW5k5iNbM9EZJOur4pOcO1iwX69tVT+r98hbP04/ 0Yxzaga6ZPsD1RndjEg5cRFKbaCF7diSZj4Pb0EDdlVOt9mD39fdLYcg==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH v2 5/6] oeqa/utils/commands: use the tinfoil helper in get_bb_var Date: Sun, 25 Oct 2026 19:18:31 +0100 Message-ID: <20261025181847.784113-6-adrian.freihofer@siemens.com> In-Reply-To: <20261025181847.784113-1-adrian.freihofer@siemens.com> References: <20261025181847.784113-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Sun, 25 Oct 2026 18:19:00 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248614 From: Adrian Freihofer Move the tinfoil code of get_bb_vars into a helper and use it in get_bb_var instead of bitbake-getvar. get_bb_var can now query variable flags with the VAR[flag] syntax. The return values do not change. This also fixes get_bb_var with a postconfig file, which returned the whole "bitbake -e" output instead of the value. It went unnoticed because no caller in oe-core passes a postconfig. Signed-off-by: Adrian Freihofer --- meta/lib/oeqa/utils/commands.py | 48 ++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index f4876ca6c9..10422fea24 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -253,12 +253,13 @@ def get_bb_env(target=None, postconfig=None): else: return bitbake("-e", postconfig=postconfig).output -def get_bb_vars(variables=None, target=None, postconfig=None): - """Get values of multiple bitbake variables or variable flags +def _get_bb_values(variables=None, target=None, postconfig=None): + """Read bitbake variables or variable flags with a single tinfoil session - All values are read with a single tinfoil session. Variable flags can be - requested with the VAR[flag] syntax. If variables is None, all variables - are returned. Unset or empty values are returned as None. + Variable flags can be requested with the VAR[flag] syntax. If variables + is None, all variables are returned. Values which are not strings are + converted with str() as bitbake -e does, unset variables or flags are + returned as None. """ import bb.tinfoil @@ -279,7 +280,7 @@ def get_bb_vars(variables=None, target=None, postconfig=None): if var.startswith('__') or d.getVarFlag(var, 'func'): continue val = d.getVar(var) - if val is not None and val != '': + if val is not None: values[var] = str(val) return values @@ -290,24 +291,29 @@ def get_bb_vars(variables=None, target=None, postconfig=None): val = d.getVarFlag(match.group('var'), match.group('flag')) else: val = d.getVar(var) - values[var] = str(val) if val is not None and val != '' else None + values[var] = str(val) if val is not None else None return values +def get_bb_vars(variables=None, target=None, postconfig=None): + """Get values of multiple bitbake variables or variable flags + + All values are read with a single tinfoil session. Variable flags can be + requested with the VAR[flag] syntax. If variables is None, all variables + are returned. Unset or empty values are returned as None. + """ + values = _get_bb_values(variables, target, postconfig) + if variables is None: + return {var: val for var, val in values.items() if val} + return {var: val or None for var, val in values.items()} + def get_bb_var(var, target=None, postconfig=None): - if postconfig: - return bitbake("-e %s" % target or "", postconfig=postconfig).output - else: - # Fast-path for the non-postconfig case - cmd = ["bitbake-getvar", "--quiet", "--value", var] - if target: - cmd.extend(["--recipe", target]) - try: - return subprocess.run(cmd, check=True, text=True, stdout=subprocess.PIPE).stdout.strip() - except subprocess.CalledProcessError as e: - # We need to return None not the empty string if the variable hasn't been set. - if e.returncode == 1: - return None - raise + """Get the value of a bitbake variable or variable flag + + A variable flag can be requested with the VAR[flag] syntax. Unset values + are returned as None, empty values as an empty string. + """ + val = _get_bb_values([var], target, postconfig)[var] + return val.strip() if val is not None else None def get_test_layer(bblayers=None): if bblayers is None: From patchwork Sun Oct 25 18:18:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 101911 Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net [185.136.64.228]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.27706.1792952334533595499 for ; Sun, 25 Oct 2026 11:18:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=i0maeL4Q; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.228, mailfrom: fm-1329275-202610251818514825ba3748000207cc-7hw82c@rts-flowmailer.siemens.com) Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 202610251818514825ba3748000207cc for ; Sun, 25 Oct 2026 19:18:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=gF5AaSd7IrBV/pA8s3LrfDDrw02fBGvTPZi0qyZbcmY=; b=i0maeL4QHOjd/9DQGhV8Q/d4CnUlKguWw+x3b2AFeSPIjNmN3VfiAlttcXT0V9tQFte0pj YtlPqamx/t02VEyZnxRz5B6ynmvwT6yEmoTMZdMgn1fd92AgeDdwq/1Z3Ez3JwuPDDQpbQGZ KlwhVbjtnMpnXVnIDmreKnxdna1aGfqUmQXyoqKS4iCQGMi3geYA1GwTn/PR4QTf1d/IiWJ5 JFsUw13fAaiOqPUnn837v+II+1Rpx/JUZusyr/H8U6B7RdcfLbGOV5xFqQ+bVvFiZ4bDA+P/ hMDH2Jg8qvU2oAApgUAB04wEdPsS83b79msLFuLMePqgZTuRvTqxb1ZA==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH v2 6/6] kernel-fit-image: drop the synthetic FIT_LOADABLE_* values Date: Sun, 25 Oct 2026 19:18:32 +0100 Message-ID: <20261025181847.784113-7-adrian.freihofer@siemens.com> In-Reply-To: <20261025181847.784113-1-adrian.freihofer@siemens.com> References: <20261025181847.784113-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Sun, 25 Oct 2026 18:18:59 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248613 From: Adrian Freihofer The anonymous function sets the FIT_LOADABLE_* variables to the flags of all loadables joined by " ? ", e.g. "0x86000000 ? 0x87000000". This was done only to make the flags visible to the selftests, which could read variables but not flags. do_compile reads the flags directly and does not need these values. get_bb_vars supports reading variable flags now. Let the test request the FIT_LOADABLE_* flags of the loadables it configures and drop the synthetic values from the class. Signed-off-by: Adrian Freihofer --- meta/classes-recipe/kernel-fit-image.bbclass | 7 ++----- meta/lib/oeqa/selftest/cases/fitimage.py | 13 +++++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/meta/classes-recipe/kernel-fit-image.bbclass b/meta/classes-recipe/kernel-fit-image.bbclass index a238de1aa2..abf7327c97 100644 --- a/meta/classes-recipe/kernel-fit-image.bbclass +++ b/meta/classes-recipe/kernel-fit-image.bbclass @@ -32,8 +32,8 @@ python () { # Parse loadables config loadables = d.getVar('FIT_LOADABLES') if loadables: - # Forbid direct assignment, set synthetic values for testability and - # add the vars to vardeps so their flags are part of the signature. + # Only flags are supported. Add the vars to vardeps so their flags are + # part of the signature. loadable_vars = ['FIT_LOADABLE_ARCH', 'FIT_LOADABLE_COMPRESSION', 'FIT_LOADABLE_DESCRIPTION', 'FIT_LOADABLE_ENTRYPOINT', 'FIT_LOADABLE_FILENAME', 'FIT_LOADABLE_LOADADDRESS', @@ -41,9 +41,6 @@ python () { for v in loadable_vars: if d.getVar(v): raise bb.parse.SkipRecipe("You cannot use %s as a variable, you can only set flags." % v) - - synt_value = " ? ".join([ d.getVarFlag(v, loadable) or "" for loadable in loadables.split() ]) - d.setVar(v, synt_value) d.appendVarFlag('do_compile', 'vardeps', ' ' + ' '.join(loadable_vars)) } diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py index 5d77e6da09..ffd7f9747e 100644 --- a/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/meta/lib/oeqa/selftest/cases/fitimage.py @@ -676,8 +676,6 @@ class KernelFitImageBase(FitImageTestCase): 'FIT_HASH_ALG', 'FIT_KERNEL_COMP_ALG', 'FIT_LOADABLES', - 'FIT_LOADABLE_ENTRYPOINT', - 'FIT_LOADABLE_LOADADDRESS', 'FIT_OS', 'FIT_SIGN_ALG', 'FIT_SIGN_INDIVIDUAL', @@ -1025,10 +1023,10 @@ class KernelFitImageBase(FitImageTestCase): "Entry Point": bb_vars['UBOOT_RD_ENTRYPOINT'] } # Create one section per loadable - for index,loadable in enumerate(loadables): - loadaddress = bb_vars['FIT_LOADABLE_LOADADDRESS'].split("?")[index].strip() + for loadable in loadables: + loadaddress = bb_vars['FIT_LOADABLE_LOADADDRESS[%s]' % loadable] req_sections[loadable] = { "Load Address": loadaddress } - entrypoint = bb_vars['FIT_LOADABLE_ENTRYPOINT'].split("?")[index].strip() + entrypoint = bb_vars.get('FIT_LOADABLE_ENTRYPOINT[%s]' % loadable) if entrypoint: req_sections[loadable]['Entry Point'] = entrypoint # Create a configuration section for each DTB @@ -1204,7 +1202,10 @@ FIT_LOADABLE_TYPE[loadable2] = "firmware" config = FitImageTestCase._config_add_machine_settings(config, machine, keys=["KERNEL_DEVICETREE", "FIT_CONF_DEFAULT_DTB"]) config = self._config_add_kernel_classes(config) self.write_config(config) - bb_vars = self._fit_get_bb_vars() + loadable_flags = ['%s[%s]' % (var, loadable) + for loadable in ('loadable1', 'loadable2') + for var in ('FIT_LOADABLE_ENTRYPOINT', 'FIT_LOADABLE_LOADADDRESS')] + bb_vars = self._fit_get_bb_vars(loadable_flags) self._gen_atf_tee_dummy_images(bb_vars) self._test_fitimage(bb_vars)