Skip to contentSkip to conversation

meta/conf/templates: add a blank template

PATCH In review Alexander Kanavin 2 participants 13 messages Jun 3, 2025 – Jun 4, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 meta/conf/templates: add a blank template

From: Alexander Kanavin <[email protected]>

The default oe-core/poky templates have a number of settings (such as distro and machine) and are thus unsuitable for building up configurations from fragments. This adds a template with an empty local.conf, so that it can be used as the starting point for fragment-driven configuration.

There will also be a blank template in poky; the difference is that this one includes only oe-core and the poky one adds poky layers.

---
 .../conf/templates/blank/bblayers.conf.sample | 10 ++++++++++
 meta/conf/templates/blank/conf-notes.txt      | 19 +++++++++++++++++++
 meta/conf/templates/blank/conf-summary.txt    |  1 +
 meta/conf/templates/blank/local.conf.sample   | 10 ++++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 meta/conf/templates/blank/bblayers.conf.sample
 create mode 100644 meta/conf/templates/blank/conf-notes.txt
 create mode 100644 meta/conf/templates/blank/conf-summary.txt
 create mode 100644 meta/conf/templates/blank/local.conf.sample
meta/conf/templates/blank/bblayers.conf.sample new file +10 -0
new file mode 100644
index 00000000000..c985f4f2420
@@ -0,0 +1,10 @@
+# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
+# changes incompatibly
+LCONF_VERSION = "7"
+
+BBPATH = "${TOPDIR}"
+BBFILES ?= ""
+
+BBLAYERS ?= " \
+  ##OEROOT##/meta \
+  "
meta/conf/templates/blank/conf-notes.txt new file +19 -0
new file mode 100644
index 00000000000..cfd1f1977bf
@@ -0,0 +1,19 @@
+
+### Shell environment set up for builds. ###
+
+You can now run 'bitbake <target>'
+
+Common targets are:
+    core-image-minimal
+    core-image-full-cmdline
+    core-image-sato
+    core-image-weston
+    meta-toolchain
+    meta-ide-support
+
+You can also run generated qemu images with a command like 'runqemu qemux86-64'.
+
+Other commonly useful commands are:
+ - 'devtool' and 'recipetool' handle common recipe tasks
+ - 'bitbake-layers' handles common layer tasks
+ - 'oe-pkgdata-util' handles common target package tasks
meta/conf/templates/blank/conf-summary.txt new file +1 -0
new file mode 100644
index 00000000000..7528c297947
@@ -0,0 +1 @@
+This configuration is empty and is intended as a starting point for adding configuration fragments.
meta/conf/templates/blank/local.conf.sample new file +10 -0
new file mode 100644
index 00000000000..41eea8506df
@@ -0,0 +1,10 @@
+#
+# This file is intended for local configuration tweaks. It is intentionally
+# set up empty, so that configuration can be constructed from fragments
+# using bitbake-config-build tool and by setting MACHINE and DISTRO here.
+#
+# If you would like to publish this file (for example as a bitbake
+# configuration template), it is recommended to create fragments
+# from changes made here; the only settings that can remain are
+# MACHINE and DISTRO.
+#
Signature · 1 line
2.39.5
#1 lore raw

PATCH 2/4 conf/fragments: add fragments for qemux86-64 and qemuarm64

From: Alexander Kanavin <[email protected]>

These will be used by official bitbake-setup configurations, and so let's start with them :) Plenty more fragments can be added over time.

---
 meta/conf/fragments/machines/qemuarm64.conf  | 5 +++++
 meta/conf/fragments/machines/qemux86-64.conf | 5 +++++
 2 files changed, 10 insertions(+)
 create mode 100644 meta/conf/fragments/machines/qemuarm64.conf
 create mode 100644 meta/conf/fragments/machines/qemux86-64.conf
meta/conf/fragments/machines/qemuarm64.conf new file +5 -0
new file mode 100644
index 00000000000..0fc164541d5
@@ -0,0 +1,5 @@
+BB_CONF_FRAGMENT_SUMMARY = "Use qemuarm64 as a target MACHINE, suitable for running in QEMU system emulator."
+BB_CONF_FRAGMENT_DESCRIPTION = "Select qemuarm64 as the target machine. This is the best option for running the target system inside QEMU emulator on arm64 build hosts, \
+as it allows near-native performance with kvm acceleration. Also useful for testing arm64 specific assembly code or compiler output."
+
+MACHINE ?= "qemuarm64"
meta/conf/fragments/machines/qemux86-64.conf new file +5 -0
new file mode 100644
index 00000000000..0fce37c4e2e
@@ -0,0 +1,5 @@
+BB_CONF_FRAGMENT_SUMMARY = "Use qemux86-64 as a target MACHINE, suitable for running in QEMU system emulator."
+BB_CONF_FRAGMENT_DESCRIPTION = "Select qemux86-64 as the target machine. This is the best option for running the target system inside QEMU emulator on x86-64 build hosts, \
+as it allows near-native performance with kvm acceleration. Also useful for testing x86-64 specific assembly code or compiler output."
+
+MACHINE ?= "qemux86-64"
Signature · 1 line
2.39.5
#2 lore raw

Re: [poky] [PATCH 2/4] conf/fragments: add fragments for qemux86-64 and qemuarm64

Quoted 31 lines · Alexander Kanavin via lists.yoctoproject.org

From: Alexander Kanavin <[email protected]>

These will be used by official bitbake-setup configurations, and so let's start with them :) Plenty more fragments can be added over time.

---
 meta/conf/fragments/machines/qemuarm64.conf  | 5 +++++ meta/conf/fragments/machines/qemux86-64.conf | 5 +++++

 2 files changed, 10 insertions(+)

 create mode 100644 meta/conf/fragments/machines/qemuarm64.conf create mode 100644 meta/conf/fragments/machines/qemux86-64.conf

meta/conf/fragments/machines/qemuarm64.conf new file +5 -0
new file mode 100644
index 00000000000..0fc164541d5
@@ -0,0 +1,5 @@
+BB_CONF_FRAGMENT_SUMMARY = "Use qemuarm64 as a target MACHINE, suitable for running in QEMU system emulator."
+BB_CONF_FRAGMENT_DESCRIPTION = "Select qemuarm64 as the target machine. This is the best option for running the target system inside QEMU emulator on arm64 build hosts, \
+as it allows near-native performance with kvm acceleration. Also useful for testing arm64 specific assembly code or compiler output."
+
+MACHINE ?= "qemuarm64"
meta/conf/fragments/machines/qemux86-64.conf new file +0 -0
new file mode 100644
index 00000000000..0fce37c4e2e

meta/conf/fragments/machines/qemux86-64.conf line 5

Quoted 5 lines
meta/conf/fragments/machines/qemux86-64.conf new file +5 -0
@@ -0,0 +1,5 @@
+BB_CONF_FRAGMENT_SUMMARY = "Use qemux86-64 as a target MACHINE, suitable for running in QEMU system emulator."
+BB_CONF_FRAGMENT_DESCRIPTION = "Select qemux86-64 as the target machine. This is the best option for running the target system inside QEMU emulator on x86-64 build hosts, \
+as it allows near-native performance with kvm acceleration. Also useful for testing x86-64 specific assembly code or compiler output."
+
+MACHINE ?= "qemux86-64"

What bothers me about this is that we have multiple files, each with a single similar config line in them. It implies we need to create a new machine config fragment for every machine, which to be honest, is madness.

Would it be better if the config/setup code understood what something like "machine/qemux86-64" or "distro/poky" meant and did something magic with that?

Cheers,

Richard

#3 lore raw

Re: [poky] [PATCH 2/4] conf/fragments: add fragments for qemux86-64 and qemuarm64

Quoted 8 lines · Richard Purdie

What bothers me about this is that we have multiple files, each with a single similar config line in them. It implies we need to create a new machine config fragment for every machine, which to be honest, is madness.

Would it be better if the config/setup code understood what something like "machine/qemux86-64" or "distro/poky" meant and did something magic with that?

Haha, yes. I've been stuck in the subject so long that I no longer see the forest for the trees.

I think bitbake-config-build should be extended to have 'list-machines/set-machine/list-distros/set-distro', and then bitbake-setup would call out to that, like it already does for fragments. There's already 'show-machines' in bitbake-layers, which should be renamed and moved, so that bitbake-layers is less over-stuffed with sub-commands.

Alex

#4 lore raw

Re: [poky] [PATCH 2/4] conf/fragments: add fragments for qemux86-64 and qemuarm64

Quoted 10 lines · Alexander Kanavin
Quoted 7 lines · Richard Purdie

What bothers me about this is that we have multiple files, each with a
single similar config line in them. It implies we need to create a new
machine config fragment for every machine, which to be honest, is madness.

Quoted 7 lines
Quoted 4 lines

Would it be better if the config/setup code understood what something
like "machine/qemux86-64" or "distro/poky" meant and did something magic with that?

Haha, yes. I've been stuck in the subject so long that I no longer see the forest for the trees.

It is hard when you're deeply into something like this! Something has bothered me about these for a while but it has taken me far too long to be able to succinctly explain it.

Quoted 6 lines

I think bitbake-config-build should be extended to have 'list-machines/set-machine/list-distros/set-distro', and then bitbake-setup would call out to that, like it already does for fragments. There's already 'show-machines' in bitbake-layers, which should be renamed and moved, so that bitbake-layers is less over-stuffed with sub-commands.

Maybe. I do like the idea of being able to express a configuration with just a list of fragments so a magic mapping of machine/XXX and distro/XXX does still have some appeal. We could code something:

BBCONFIG_FRAGMENT_VARIABLE_MAPS = "machine/:MACHINE and distro/:DISTRO"

to make the code generic?

Cheers,

Richard

#5 lore raw

Re: [poky] [PATCH 2/4] conf/fragments: add fragments for qemux86-64 and qemuarm64

Quoted 7 lines · Richard Purdie
Quoted 6 lines

I think bitbake-config-build should be extended to have 'list-machines/set-machine/list-distros/set-distro', and then bitbake-setup would call out to that, like it already does for fragments. There's already 'show-machines' in bitbake-layers, which should be renamed and moved, so that bitbake-layers is less over-stuffed with sub-commands.

Quoted 7 lines

Maybe. I do like the idea of being able to express a configuration with just a list of fragments so a magic mapping of machine/XXX and distro/XXX does still have some appeal. We could code something:

BBCONFIG_FRAGMENT_VARIABLE_MAPS = "machine/:MACHINE and distro/:DISTRO"

to make the code generic?

My idea was to do away with fragments for machine/distro, and have 'bitbake-config-build set-machine XXX' write 'MACHINE = 'XXX' into conf/auto.conf.

And then bitbake-setup config files would have a particular syntax for that, e.g. replace the current:

            "qemux86-64-poky": {
                "description": "Poky reference distro build for qemux86-64",
                "oe-template": "poky-blank",
                "oe-fragments":
["core/machines/qemux86-64","yocto/distros/poky","core/yocto/sstate-mirror-cdn","core/qemu/enable-native-sdl"],
                "targets": ["bitbake core-image-minimal
core-image-full-cmdline core-image-sato-sdk core-image-weston"]
            },

with

          "qemux86-64-poky": {
                "description": "Poky reference distro build for qemux86-64",
                "oe-template": "poky-blank",
                "oe-distro": "poky",
                "oe-machine": "qemux86-64",
                "oe-fragments":
["core/yocto/sstate-mirror-cdn","core/qemu/enable-native-sdl"],
                "targets": ["bitbake core-image-minimal
core-image-full-cmdline core-image-sato-sdk core-image-weston"]
            },

I don't have a strong opinion either way, perhaps it's best to 'upload discussion data in brain and process', while fixing further do_unpack rework fails :) If you can respond with further points I'd appreciate that! (so I better see the forest)

Alex

#6 lore raw

Re: [poky] [PATCH 2/4] conf/fragments: add fragments for qemux86-64 and qemuarm64

Quoted 13 lines · Alexander Kanavin
Quoted 11 lines · Richard Purdie
Quoted 6 lines

I think bitbake-config-build should be extended to have 'list-machines/set-machine/list-distros/set-distro', and then bitbake-setup would call out to that, like it already does for fragments. There's already 'show-machines' in bitbake-layers, which should be renamed and moved, so that bitbake-layers is less over-stuffed with sub-commands.

Maybe. I do like the idea of being able to express a configuration with just a list of fragments so a magic mapping of machine/XXX and distro/XXX does still have some appeal. We could code something:

Quoted 7 lines
Quoted 3 lines

BBCONFIG_FRAGMENT_VARIABLE_MAPS = "machine/:MACHINE and distro/:DISTRO"

to make the code generic?

My idea was to do away with fragments for machine/distro, and have 'bitbake-config-build set-machine XXX' write 'MACHINE = 'XXX' into conf/auto.conf.

Let me just throw some ideas around here. I'm not saying any are right/wrong, this is in the spirit of sharing ideas.

Moving the "machine" commands into one standard place would make sense so I do like that aspect of what you're suggesting.

I have some caution about teaching "bitbake" commands machine/distro specific as it breaks layers of separation. Note that bitbake-layers list-machines is part of OE-Core, not bitbake.

I also have an idea in the back of my mind that being able to reproduce common setups with a list of fragments would be a nice idea. If you have to say:

set-machine XXX
set-distro YYY
set-features A B C

it isn't a very succinct explanation to people. If you can say:

set-features A B C machine/XXX distro/YYY

then it becomes a bit of a nicer thing for someone else to copy. This is all generic in that someone else can add their own fragments. The autobuilder can also then simplify configs too. Someone could add an extra variable mapping for an extra level of config, say toolchain/clang to set TOOLCHAIN = "clang", not that I'm suggesting that specifically but you get the idea.

Quoted 25 lines

And then bitbake-setup config files would have a particular syntax for that, e.g. replace the current:

            "qemux86-64-poky": {
                "description": "Poky reference distro build for qemux86-64",
                "oe-template": "poky-blank",
                "oe-fragments":
["core/machines/qemux86-64","yocto/distros/poky","core/yocto/sstate-mirror-cdn","core/qemu/enable-native-sdl"], "targets": ["bitbake core-image-minimal
core-image-full-cmdline core-image-sato-sdk core-image-weston"]
            },

with

          "qemux86-64-poky": {
                "description": "Poky reference distro build for qemux86-64", "oe-template": "poky-blank",
                "oe-distro": "poky",
                "oe-machine": "qemux86-64",
                "oe-fragments":
["core/yocto/sstate-mirror-cdn","core/qemu/enable-native-sdl"], "targets": ["bitbake core-image-minimal core-image-full-cmdline core-image-sato-sdk core-image-weston"] },

Quoted 4 lines

I don't have a strong opinion either way, perhaps it's best to 'upload discussion data in brain and process', while fixing further do_unpack rework fails :) If you can respond with further points I'd appreciate that! (so I better see the forest)

playing devils advocate:

          "qemux86-64-poky": {
                "description": "Poky reference distro build for qemux86-64",
                "oe-template": "poky-blank",
                "oe-fragments": ["core/yocto/sstate-mirror-cdn","core/qemu/enable-native-sdl", "machine/qemux86-64 distro/poky],
                "targets": ["bitbake core-image-minimal core-image-full-cmdline core-image-sato-sdk core-image-weston"]
            },

Cheers,

Richard

#7 lore raw

PATCH 3/4 conf/fragments: add a fragment for CDN sstate mirror

In reply to Alexander Kanavin

From: Alexander Kanavin <[email protected]>

This will be used in bitbake-setup official configurations and it will be awesome.

---
 meta/conf/fragments/yocto/sstate-mirror-cdn.conf | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 meta/conf/fragments/yocto/sstate-mirror-cdn.conf
meta/conf/fragments/yocto/sstate-mirror-cdn.conf new file +12 -0
new file mode 100644
index 00000000000..e204975ce3b
@@ -0,0 +1,12 @@
+BB_CONF_FRAGMENT_SUMMARY = "Use prebuilt sstate artifacts for standard Yocto build configurations."
+BB_CONF_FRAGMENT_DESCRIPTION = "The Yocto Project has prebuilt artefacts available for standard build configurations. \
+This fragment enables their use. This will mean the build will query the \
+the network to check for artefacts at the start of builds, which does slow it down \
+initially but it will then speed up the builds by not having to build things if they are \
+present in the cache. It assumes you can download something faster than you can build it \
+which will depend on your network. \
+Note: For this to work you also need hash-equivalence passthrough to the matching server \
+"
+
+BB_HASHSERVE_UPSTREAM = 'wss://hashserv.yoctoproject.org/ws'
+SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"
Signature · 1 line
2.39.5
#8 lore raw

PATCH 4/4 fragments/qemu: add support for enabling sdl in qemu

In reply to Alexander Kanavin

From: Alexander Kanavin <[email protected]>

This has been the default in poky's local.conf template for a long time, but it's not enabled directly in poky distro. To allow better sstate reuse and a better user experience on a typical laptop (qemu will pop up a graphical window directly), let's add this fragment and enable it in official bitbake-setup configurations.

---
 meta/conf/fragments/qemu/enable-native-sdl.conf | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 meta/conf/fragments/qemu/enable-native-sdl.conf
meta/conf/fragments/qemu/enable-native-sdl.conf new file +8 -0
new file mode 100644
index 00000000000..21c1298171e
@@ -0,0 +1,8 @@
+BB_CONF_FRAGMENT_SUMMARY = "Enable SDL support for direct graphical output on the build host."
+BB_CONF_FRAGMENT_DESCRIPTION = "By default qemu is built with a internal VNC server \
+support. To see graphical output from the guest system, one can use a VNC client to \
+connect to it. This fragment enables Simple Directmedia Layer support, which allows \
+seeing the graphical output from guest directly in a X/Wayland session on the build host machine. \
+"
+
+PACKAGECONFIG:append:pn-qemu-system-native = " sdl"
Signature · 1 line
2.39.5
#9 lore raw

Re: [poky] [PATCH 4/4] fragments/qemu: add support for enabling sdl in qemu

Quoted 21 lines · Alexander Kanavin via lists.yoctoproject.org

From: Alexander Kanavin <[email protected]>

This has been the default in poky's local.conf template for a long time, but it's not enabled directly in poky distro. To allow better sstate reuse and a better user experience on a typical laptop (qemu will pop up a graphical window directly), let's add this fragment and enable it in official bitbake-setup configurations.

---
 meta/conf/fragments/qemu/enable-native-sdl.conf | 8 ++++++++

 1 file changed, 8 insertions(+)

 create mode 100644 meta/conf/fragments/qemu/enable-native-sdl.conf

meta/conf/fragments/qemu/enable-native-sdl.conf new file +0 -0
new file mode 100644
index 00000000000..21c1298171e

meta/conf/fragments/qemu/enable-native-sdl.conf line 8

Quoted 8 lines
meta/conf/fragments/qemu/enable-native-sdl.conf new file +8 -0
@@ -0,0 +1,8 @@
+BB_CONF_FRAGMENT_SUMMARY = "Enable SDL support for direct graphical output on the build host."
+BB_CONF_FRAGMENT_DESCRIPTION = "By default qemu is built with a internal VNC server \
+support. To see graphical output from the guest system, one can use a VNC client to \
+connect to it. This fragment enables Simple Directmedia Layer support, which allows \
+seeing the graphical output from guest directly in a X/Wayland session on the build host machine. \
+"
+
+PACKAGECONFIG:append:pn-qemu-system-native = " sdl"

I have to wonder whether rather than making this a fragment, we should just change the default...

Cheers,

Richard

#10 lore raw

Re: [poky] [PATCH 4/4] fragments/qemu: add support for enabling sdl in qemu

Quoted 8 lines · Richard Purdie
Quoted 6 lines

This has been the default in poky's local.conf template for a long time, but it's not enabled directly in poky distro. To allow better sstate reuse and a better user experience on a typical laptop (qemu will pop up a graphical window directly), let's add this fragment and enable it in official bitbake-setup configurations.

I have to wonder whether rather than making this a fragment, we should just change the default...

Yes. I am somewhat unsure where to set it: in the recipe, or in poky distro? I'm leaning towards the former, as both oe-core and poky default local.conf templates add the setting.

Alex

#11 lore raw

Re: [poky] [PATCH 4/4] fragments/qemu: add support for enabling sdl in qemu

Quoted 10 lines · Alexander Kanavin
Quoted 7 lines · Richard Purdie
Quoted 7 lines

This has been the default in poky's local.conf template for a long time, but it's not enabled directly in poky distro. To allow better sstate reuse and a better user experience on a typical laptop (qemu will pop up a graphical window directly),
let's add this fragment and enable it in official bitbake-setup configurations.

Quoted 6 lines
Quoted 2 lines

I have to wonder whether rather than making this a fragment, we should just change the default...

Yes. I am somewhat unsure where to set it: in the recipe, or in poky distro? I'm leaning towards the former, as both oe-core and poky default local.conf templates add the setting.

I agree, I think we should change the recipe.

Cheers,

Richard

#12 lore raw
In reply to Alexander Kanavin

This set needs to go to oe-core, pls ignore.

(but the 3-patch set I sent just prior is indeed for poky).

Alex

Quoted 92 lines · Alexander Kanavin

From: Alexander Kanavin <[email protected]>

The default oe-core/poky templates have a number of settings (such as distro and machine) and are thus unsuitable for building up configurations from fragments. This adds a template with an empty local.conf, so that it can be used as the starting point for fragment-driven configuration.

There will also be a blank template in poky; the difference is that this one includes only oe-core and the poky one adds poky layers.

---
 .../conf/templates/blank/bblayers.conf.sample | 10 ++++++++++
 meta/conf/templates/blank/conf-notes.txt      | 19 +++++++++++++++++++
 meta/conf/templates/blank/conf-summary.txt    |  1 +
 meta/conf/templates/blank/local.conf.sample   | 10 ++++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 meta/conf/templates/blank/bblayers.conf.sample
 create mode 100644 meta/conf/templates/blank/conf-notes.txt
 create mode 100644 meta/conf/templates/blank/conf-summary.txt
 create mode 100644 meta/conf/templates/blank/local.conf.sample
meta/conf/templates/blank/bblayers.conf.sample new file +10 -0
new file mode 100644
index 00000000000..c985f4f2420
@@ -0,0 +1,10 @@
+# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
+# changes incompatibly
+LCONF_VERSION = "7"
+
+BBPATH = "${TOPDIR}"
+BBFILES ?= ""
+
+BBLAYERS ?= " \
+  ##OEROOT##/meta \
+  "
meta/conf/templates/blank/conf-notes.txt new file +19 -0
new file mode 100644
index 00000000000..cfd1f1977bf
@@ -0,0 +1,19 @@
+
+### Shell environment set up for builds. ###
+
+You can now run 'bitbake <target>'
+
+Common targets are:
+    core-image-minimal
+    core-image-full-cmdline
+    core-image-sato
+    core-image-weston
+    meta-toolchain
+    meta-ide-support
+
+You can also run generated qemu images with a command like 'runqemu qemux86-64'.
+
+Other commonly useful commands are:
+ - 'devtool' and 'recipetool' handle common recipe tasks
+ - 'bitbake-layers' handles common layer tasks
+ - 'oe-pkgdata-util' handles common target package tasks
meta/conf/templates/blank/conf-summary.txt new file +1 -0
new file mode 100644
index 00000000000..7528c297947
@@ -0,0 +1 @@
+This configuration is empty and is intended as a starting point for adding configuration fragments.
meta/conf/templates/blank/local.conf.sample new file +10 -1
new file mode 100644
index 00000000000..41eea8506df
@@ -0,0 +1,10 @@
+#
+# This file is intended for local configuration tweaks. It is intentionally
+# set up empty, so that configuration can be constructed from fragments
+# using bitbake-config-build tool and by setting MACHINE and DISTRO here.
+#
+# If you would like to publish this file (for example as a bitbake
+# configuration template), it is recommended to create fragments
+# from changes made here; the only settings that can remain are
+# MACHINE and DISTRO.
+#
--

2.39.5