diff mbox series

[1/3] bitbake-setup: support bb-local-conf-header injection

Message ID 20260320150312.1243270-2-zhangfei.gao@linaro.org
State New
Headers show
Series bitbake-setup: config-driven local.conf, default target and docs | expand

Commit Message

Zhangfei Gao March 20, 2026, 3:03 p.m. UTC
Allow bitbake configurations to provide local.conf content through
'bb-local-conf-header'.

When present, bitbake-setup appends the provided value (string or list
of lines) to build/conf/local.conf during setup initialization.

This helps projects carry machine-specific local.conf policy in
configuration data instead of wrapper scripts.

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
---
 bin/bitbake-setup | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 9d08f3a1b..edb8c4d1f 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -310,6 +310,15 @@  def setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_c
 # layer fragments from changes made here.
 #
 """
+
+        local_conf_extra = bitbake_config.get("bb-local-conf-header")
+        if local_conf_extra:
+            local_conf += "\n# Added by bitbake-setup from bb-local-conf-header\n"
+            if isinstance(local_conf_extra, list):
+                local_conf += "\n".join(local_conf_extra) + "\n"
+            else:
+                local_conf += str(local_conf_extra) + "\n"
+
         with open(os.path.join(build_conf_dir, "local.conf"), 'w') as f:
             f.write(local_conf)