Skip to contentSkip to conversation

baremetal, linux-dummy: bypass kernel dependencies for baremetal

RFC PATCH In review Denys Dmytriyenko 2 participants 9 messages Oct 2, 2025

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/5 baremetal, linux-dummy: bypass kernel dependencies for baremetal

From: Denys Dmytriyenko <[email protected]>

When building something for baremetal configs (such as firmware images for heterogeneous cores), you don't normally include Linux kernel. But yocto-check-layer (and possibly other tools) tend to dump "world" signatures and trip over a large number of Linux kernel depdencies from other recipes and packagegroups. Those aren't limited to directly depending on virtual/kernel, but also everything else kernel-related, such as tools, device trees and especially a large number of specific kernel module RRECOMMENDS.

As linux-dummy was originally created to specifically cut down all such kernel dependencies when it's not built or packaged normally, we can re-use it for baremetal configs as well.

Since linux-dummy can now be used outside of Linux host, update COMPATIBLE_HOST accordingly.

Also, cut out kernel-devsrc (kernel sources) from the world build completely - it is quite weird and very custom on its own.

[YOCTO #15982]

---
 meta/conf/distro/include/tclibc-baremetal.inc | 1 +
 meta/recipes-kernel/linux/kernel-devsrc.bb    | 2 ++
 meta/recipes-kernel/linux/linux-dummy.bb      | 2 --
 3 files changed, 3 insertions(+), 2 deletions(-)
meta/conf/distro/include/tclibc-baremetal.inc +1 -0
index abea5a7162..adac212dc0 100644
@@ -8,6 +8,7 @@ LIBCOVERRIDE = ":libc-baremetal"
 
 ASSUME_PROVIDED += "virtual/libc virtual/libiconv virtual/crypt"
 
+PREFERRED_PROVIDER_virtual/kernel ?= "linux-dummy"
 PREFERRED_PROVIDER_virtual/libc ?= "musl"
 PREFERRED_PROVIDER_virtual/libiconv ?= "musl"
 PREFERRED_PROVIDER_virtual/libintl ?= "gettext"
meta/recipes-kernel/linux/kernel-devsrc.bb +2 -0
index 04dd683dde..dbad6f113a 100644
@@ -423,3 +423,5 @@ RDEPENDS:${PN} += "${@bb.utils.contains('ARCH', 'powerpc', 'elfutils-dev', '', d
 RDEPENDS:${PN} += "gcc-plugins libmpc-dev"
 # 5.13+ needs grep for powerpc
 RDEPENDS:${PN}:append:powerpc = " grep"
+
+EXCLUDE_FROM_WORLD = "1"
meta/recipes-kernel/linux/linux-dummy.bb +0 -2
index d7f39a452d..6199787a71 100644
@@ -25,8 +25,6 @@ DESCRIPTION:kernel-vmlinux = "Kernel vmlinux meta package"
 
 INHIBIT_DEFAULT_DEPS = "1"
 
-COMPATIBLE_HOST = ".*-linux"
-
 SRC_URI = "file://COPYING.GPL"
 
 S = "${UNPACKDIR}"
Signature · 1 line
2.25.1
#1 lore raw

RFC PATCH 2/5 glibc: skip also on baremetal

From: Denys Dmytriyenko <[email protected]>

Similar to how glibc gets skipped when building musl config, also skip it when building baremetal config.

[YOCTO #15982]

---
 meta/recipes-core/glibc/glibc-common.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/glibc/glibc-common.inc +1 -0
index 7422ede04d..30179870a9 100644
@@ -21,6 +21,7 @@ ARM_INSTRUCTION_SET:armv6 = "arm"
 # this helps in easing out parsing for non-glibc system libraries
 #
 COMPATIBLE_HOST:libc-musl:class-target = "null"
+COMPATIBLE_HOST:libc-baremetal:class-target = "null"
 
 PV = "2.42+git"
 
Signature · 1 line
2.25.1
#2 lore raw

RFC PATCH 3/5 musl: set compatibility a bit more flexible

In reply to Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

Like musl Linux config, baremetal also uses musl as a libc, but it has a different host triplet set. Hence adjust COMPATIBLE_HOST to accomodate this use case by checking that musl is a preferred provider of libc.

[YOCTO #15982]

---
 meta/recipes-core/musl/bsd-headers.bb      | 2 +-
 meta/recipes-core/musl/libssp-nonshared.bb | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/musl/bsd-headers.bb +1 -1
index ad9ba81e4f..c6a3814a49 100644
@@ -25,7 +25,7 @@ do_install() {
 #
 # We will skip parsing for non-musl systems
 #
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
 
-COMPATIBLE_HOST = ".*-musl.*"
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
meta/recipes-core/musl/libssp-nonshared.bb +2 -1
index 4bcbaef7ea..6f12ff0c9b 100644
@@ -29,7 +29,8 @@ do_install() {
 #
 # We will skip parsing for non-musl systems
 #
-COMPATIBLE_HOST = ".*-musl.*"
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
+
 RDEPENDS:${PN}-staticdev = ""
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
Signature · 1 line
2.25.1
#3 lore raw

Re: [OE-core] [RFC PATCH 3/5] musl: set compatibility a bit more flexible

Quoted 7 lines · Denys Dmytriyenko via lists.openembedded.org

From: Denys Dmytriyenko <[email protected]>

Like musl Linux config, baremetal also uses musl as a libc, but it has a different host triplet set. Hence adjust COMPATIBLE_HOST to accomodate this use case by checking that musl is a preferred provider of libc.

This sounds a bit odd. Why do we use musl for baremetal targets ? while musl does have FDPIC support but I don't think thats how we use it.

Quoted 48 lines

[YOCTO #15982]

---
 meta/recipes-core/musl/bsd-headers.bb      | 2 +-
 meta/recipes-core/musl/libssp-nonshared.bb | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/musl/bsd-headers.bb +1 -1
index ad9ba81e4f..c6a3814a49 100644
@@ -25,7 +25,7 @@ do_install() {
 #
 # We will skip parsing for non-musl systems
 #
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
 
-COMPATIBLE_HOST = ".*-musl.*"
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
meta/recipes-core/musl/libssp-nonshared.bb +2 -2
index 4bcbaef7ea..6f12ff0c9b 100644
@@ -29,7 +29,8 @@ do_install() {
 #
 # We will skip parsing for non-musl systems
 #
-COMPATIBLE_HOST = ".*-musl.*"
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
+
 RDEPENDS:${PN}-staticdev = ""
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
--

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#224333): https://lists.openembedded.org/g/openembedded-core/message/224333
Mute This Topic: https://lists.openembedded.org/mt/115544473/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw

Re: [OE-core] [RFC PATCH 3/5] musl: set compatibility a bit more flexible

Quoted 11 lines · Khem Raj
Quoted 7 lines · Denys Dmytriyenko via lists.openembedded.org

From: Denys Dmytriyenko <[email protected]>

Like musl Linux config, baremetal also uses musl as a libc, but it has a different host triplet set. Hence adjust COMPATIBLE_HOST to accomodate this use case by checking that musl is a preferred provider of libc.

This sounds a bit odd. Why do we use musl for baremetal targets ?

Was like that for 10 years since the beginning of baremetal support:
https://git.openembedded.org/openembedded-core/commit/?id=cb010e306a6a856c589db5f41fdcaea4e5035d93

Quoted 41 lines

while musl does have FDPIC support but I don't think thats how we use it.

Quoted 38 lines

[YOCTO #15982]

---
 meta/recipes-core/musl/bsd-headers.bb      | 2 +-
 meta/recipes-core/musl/libssp-nonshared.bb | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/musl/bsd-headers.bb +1 -1
index ad9ba81e4f..c6a3814a49 100644
@@ -25,7 +25,7 @@ do_install() {
 #
 # We will skip parsing for non-musl systems
 #
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
 
-COMPATIBLE_HOST = ".*-musl.*"
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
meta/recipes-core/musl/libssp-nonshared.bb +2 -2
index 4bcbaef7ea..6f12ff0c9b 100644
@@ -29,7 +29,8 @@ do_install() {
 #
 # We will skip parsing for non-musl systems
 #
-COMPATIBLE_HOST = ".*-musl.*"
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
+
 RDEPENDS:${PN}-staticdev = ""
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
--

2.25.1

#5 lore raw

Re: [OE-core] [RFC PATCH 3/5] musl: set compatibility a bit more flexible

Quoted 12 lines · Denys Dmytriyenko
Quoted 10 lines · Khem Raj
Quoted 7 lines · Denys Dmytriyenko via lists.openembedded.org

From: Denys Dmytriyenko <[email protected]>

Like musl Linux config, baremetal also uses musl as a libc, but it has a different host triplet set. Hence adjust COMPATIBLE_HOST to accomodate this use case by checking that musl is a preferred provider of libc.

Quoted 5 lines
Quoted 1 line

This sounds a bit odd. Why do we use musl for baremetal targets ?

Was like that for 10 years since the beginning of baremetal support:
https://git.openembedded.org/openembedded-core/commit/?id=cb010e306a6a856c589db5f41fdcaea4e5035d93

A lot has changed since then in terms of toolchain sequences and dependencies it might be a good time to revise this

Quoted 42 lines
Quoted 42 lines

while musl does have FDPIC support but I don't think thats how we use it.

Quoted 38 lines

[YOCTO #15982]

---
 meta/recipes-core/musl/bsd-headers.bb      | 2 +-
 meta/recipes-core/musl/libssp-nonshared.bb | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/musl/bsd-headers.bb +1 -1
index ad9ba81e4f..c6a3814a49 100644
@@ -25,7 +25,7 @@ do_install() {
 #
 # We will skip parsing for non-musl systems
 #
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
 
-COMPATIBLE_HOST = ".*-musl.*"
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
meta/recipes-core/musl/libssp-nonshared.bb +2 -2
index 4bcbaef7ea..6f12ff0c9b 100644
@@ -29,7 +29,8 @@ do_install() {
 #
 # We will skip parsing for non-musl systems
 #
-COMPATIBLE_HOST = ".*-musl.*"
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
+
 RDEPENDS:${PN}-staticdev = ""
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
--

2.25.1

#6 lore raw

Re: [OE-core] [RFC PATCH 3/5] musl: set compatibility a bit more flexible

Quoted 13 lines · Khem Raj
Quoted 12 lines · Denys Dmytriyenko
Quoted 10 lines · Khem Raj
Quoted 7 lines · Denys Dmytriyenko via lists.openembedded.org

From: Denys Dmytriyenko <[email protected]>

Like musl Linux config, baremetal also uses musl as a libc, but it has a different host triplet set. Hence adjust COMPATIBLE_HOST to accomodate this use case by checking that musl is a preferred provider of libc.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

This sounds a bit odd. Why do we use musl for baremetal targets ?

Was like that for 10 years since the beginning of baremetal support:
https://git.openembedded.org/openembedded-core/commit/?id=cb010e306a6a856c589db5f41fdcaea4e5035d93

A lot has changed since then in terms of toolchain sequences and dependencies it might be a good time to revise this

Yeah, that would be the next step and is part of my longer todo list.

We've noticed that the baremetal toolchain build is now much larger and much longer than how it used to be several years ago - there seems to be a lot of unnecessary dependencies being pulled just to build a couple of self-contained firmware images... Still need to investigate further though.

Quoted 41 lines
Quoted 41 lines
Quoted 41 lines

while musl does have FDPIC support but I don't think thats how we use it.

Quoted 38 lines

[YOCTO #15982]

---
 meta/recipes-core/musl/bsd-headers.bb      | 2 +-
 meta/recipes-core/musl/libssp-nonshared.bb | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
meta/recipes-core/musl/bsd-headers.bb +1 -1
index ad9ba81e4f..c6a3814a49 100644
@@ -25,7 +25,7 @@ do_install() {
 #
 # We will skip parsing for non-musl systems
 #
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
 
-COMPATIBLE_HOST = ".*-musl.*"
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-dev (= ${EXTENDPKGV})"
meta/recipes-core/musl/libssp-nonshared.bb +2 -2
index 4bcbaef7ea..6f12ff0c9b 100644
@@ -29,7 +29,8 @@ do_install() {
 #
 # We will skip parsing for non-musl systems
 #
-COMPATIBLE_HOST = ".*-musl.*"
+COMPATIBLE_HOST = "${@oe.utils.conditional('PREFERRED_PROVIDER_virtual/libc', 'musl', '.*', 'null', d)}"
+
 RDEPENDS:${PN}-staticdev = ""
 DEV_PKG_DEPENDENCY = ""
 RRECOMMENDS:${PN}-dbg = "${PN}-staticdev (= ${EXTENDPKGV})"
--

2.25.1

#7 lore raw

RFC PATCH 4/5 newlib: mark as incompatible with baremetal, which uses musl

In reply to Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

Like newlib is already marked as incompatible with glibc and musl, mark it as incompatible with baremetal, which uses musl.

[YOCTO #15982]

---
 meta/recipes-core/newlib/newlib.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-core/newlib/newlib.inc +1 -0
index a8794dd1d9..a8d138739c 100644
@@ -65,3 +65,4 @@ do_install() {
 
 COMPATIBLE_HOST:libc-musl:class-target = "null"
 COMPATIBLE_HOST:libc-glibc:class-target = "null"
+COMPATIBLE_HOST:libc-baremetal:class-target = "null"
Signature · 1 line
2.25.1
#8 lore raw

RFC PATCH 5/5 packagegroups, dpkg: extend musl conditionals to baremetal

In reply to Denys Dmytriyenko

From: Denys Dmytriyenko <[email protected]>

Some packagegroups have conditional inclusion of packages based on their compatibility with specific libc providers. Add baremetal config, which is mostly similar to musl, that baremetal uses as libc.

[YOCTO #15982]

---
 meta/recipes-core/packagegroups/packagegroup-core-sdk.bb        | 1 +
 .../packagegroups/packagegroup-core-tools-profile.bb            | 2 ++
 .../packagegroups/packagegroup-core-tools-testapps.bb           | 1 +
 meta/recipes-devtools/dpkg/dpkg.inc                             | 1 +
 4 files changed, 5 insertions(+)
meta/recipes-core/packagegroups/packagegroup-core-sdk.bb +1 -0
index e6d704b5ba..2fd815508f 100644
@@ -42,6 +42,7 @@ SANITIZERS:nios2 = ""
 SANITIZERS:riscv64 = ""
 SANITIZERS:riscv32 = ""
 SANITIZERS:libc-musl = ""
+SANITIZERS:libc-baremetal = ""
 
 RRECOMMENDS:packagegroup-core-sdk = "\
     libgomp \
meta/recipes-core/packagegroups/packagegroup-core-tools-profile.bb +2 -0
index 9c09f5ab44..501559771e 100644
@@ -28,6 +28,7 @@ PERF:riscv32 = ""
 # systemtap needs elfutils which is not fully buildable on some arches/libcs
 SYSTEMTAP = "systemtap"
 SYSTEMTAP:libc-musl = ""
+SYSTEMTAP:libc-baremetal = ""
 SYSTEMTAP:nios2 = ""
 SYSTEMTAP:riscv32 = ""
 
@@ -41,6 +42,7 @@ BABELTRACE2 = "babeltrace2"
 
 VALGRIND = "valgrind"
 VALGRIND:libc-musl = ""
+VALGRIND:libc-baremetal = ""
 VALGRIND:mipsarch = ""
 VALGRIND:nios2 = ""
 VALGRIND:arc = ""
meta/recipes-core/packagegroups/packagegroup-core-tools-testapps.bb +1 -0
index 25561f6878..b77739871e 100644
@@ -17,6 +17,7 @@ KEXECTOOLS:nios2 ?= ""
 KEXECTOOLS:riscv64 ?= ""
 KEXECTOOLS:riscv32 ?= ""
 KEXECTOOLS:loongarch64 ?= ""
+KEXECTOOLS:libc-baremetal ?= ""
 
 # go does not support ppc32, only ppc64
 # https://github.com/golang/go/issues/22885
meta/recipes-devtools/dpkg/dpkg.inc +1 -0
index b4e9667107..e091fdb5cd 100644
@@ -116,6 +116,7 @@ ALTERNATIVE_PRIORITY = "100"
 
 EXTRA_RDPENDS = "ldconfig"
 EXTRA_RDPENDS:libc-musl = ""
+EXTRA_RDPENDS:libc-baremetal = ""
 RDEPENDS:${PN} += "${PN}-start-stop ${EXTRA_RDPENDS}"
 
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.25.1