Skip to contentSkip to conversation

nativesdk: ensure features don't get backfilled

PATCH New [email protected] 1 participant 3 messages Dec 21, 2023 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 nativesdk: ensure features don't get backfilled

From: Ross Burton <[email protected]>

nativesdk aims to run in a slightly different environment than the target build, so it resets MACHINE_FEATURES and filters DISTRO_FEATURES with DISTRO_FEATURES_NATIVESDK.

However, feature backfill happens _after_ these operations:

 $ bitbake-getvar -r nativesdk-glib-2.0 MACHINE_FEATURES
 #
 # $MACHINE_FEATURES [5 operations]
 #   set /home/ross/Yocto/poky/meta/conf/machine/include/qemu.inc:14
 #     "alsa bluetooth usbgadget screen vfat"
 #   set /home/ross/Yocto/poky/meta/conf/documentation.conf:284
 #     [doc] "Specifies the list of hardware features the MACHINE supports."
 #   set? /home/ross/Yocto/poky/meta/conf/bitbake.conf:893
 #     ""
 #   set /home/ross/Yocto/poky/meta/classes-recipe/nativesdk.bbclass:18
 #     ""
 #   append utils.py:132 [features_backfill]
 #     " rtc qemu-usermode"
 # pre-expansion value:
 #   " rtc qemu-usermode"
 MACHINE_FEATURES=" rtc qemu-usermode"

This is not intentional nor desired as the target machine features are unrelated to the nativesdk environment.

---
 meta/classes-recipe/nativesdk.bbclass | 3 +++
 1 file changed, 3 insertions(+)
meta/classes-recipe/nativesdk.bbclass +3 -0
index 08288fdb733..ccaf411f0d7 100644
@@ -15,7 +15,10 @@ NATIVESDKLIBC ?= "libc-glibc"
 LIBCOVERRIDE = ":${NATIVESDKLIBC}"
 CLASSOVERRIDE = "class-nativesdk"
 MACHINEOVERRIDES = ""
+
 MACHINE_FEATURES = ""
+DISTRO_FEATURES_BACKFILL = ""
+MACHINE_FEATURES_BACKFILL = ""
 
 MULTILIBS = ""
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 nativesdk: don't unset MACHINE_FEATURES, let machine-sdk/ set it

From: Ross Burton <[email protected]>

There is actually a use for nativesdk MACHINE_FEATURES; for example qemu-usermode being supported, as this is needed to build profile-guided optimised code.

We shouldn't use the target MACHINE_FEATURES for this because the target and the SDK can be entirely different, so instead set the MACHINE_FEATURES in nativesdk.bbclass to SDK_MACHINE_FEATURES (which defaults to "") and let the conf/machine-sdk/*.conf files set that as appropriate.

---
 meta/classes-recipe/nativesdk.bbclass | 2 +-
 meta/conf/bitbake.conf                | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
meta/classes-recipe/nativesdk.bbclass +1 -1
index ccaf411f0d7..de6debda93c 100644
@@ -16,7 +16,7 @@ LIBCOVERRIDE = ":${NATIVESDKLIBC}"
 CLASSOVERRIDE = "class-nativesdk"
 MACHINEOVERRIDES = ""
 
-MACHINE_FEATURES = ""
+MACHINE_FEATURES = "${SDK_MACHINE_FEATURES}"
 DISTRO_FEATURES_BACKFILL = ""
 MACHINE_FEATURES_BACKFILL = ""
 
meta/conf/bitbake.conf +2 -0
index 83b12cbc158..ebfd297430a 100644
@@ -892,6 +892,8 @@ OES_BITBAKE_CONF = "1"
 ##################################################################
 
 MACHINE_FEATURES ?= ""
+SDK_MACHINE_FEATURES ?= ""
+
 DISTRO_FEATURES ?= ""
 
 DISTRO_EXTRA_RDEPENDS ?= ""
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/3 conf/machine-sdk: declare qemu-usermode SDK_MACHINE_FEATURE

In reply to [email protected]

From: Ross Burton <[email protected]>

All of our defined SDK machines (which are assumed to be Linux) support qemu-user, so state this explicitly.

---
 meta/conf/machine-sdk/aarch64.conf     | 2 ++
 meta/conf/machine-sdk/i586.conf        | 1 +
 meta/conf/machine-sdk/i686.conf        | 2 ++
 meta/conf/machine-sdk/loongarch64.conf | 2 ++
 meta/conf/machine-sdk/ppc64.conf       | 2 ++
 meta/conf/machine-sdk/ppc64le.conf     | 2 ++
 meta/conf/machine-sdk/riscv64.conf     | 2 ++
 meta/conf/machine-sdk/x86_64.conf      | 2 ++
 8 files changed, 15 insertions(+)
meta/conf/machine-sdk/aarch64.conf +2 -0
index 4a285cf6cb6..d2023e21744 100644
@@ -1,2 +1,4 @@
 SDK_ARCH = "aarch64"
 ABIEXTENSION:class-nativesdk = ""
+
+SDK_MACHINE_FEATURES = "qemu-usermode"
meta/conf/machine-sdk/i586.conf +1 -0
index 05e826965ea..ccee3a4881b 100644
@@ -2,3 +2,4 @@ SDK_ARCH = "i586"
 SDK_CC_ARCH = "-march=i586"
 ABIEXTENSION:class-nativesdk = ""
 
+SDK_MACHINE_FEATURES = "qemu-usermode"
meta/conf/machine-sdk/i686.conf +2 -0
index 22f580e70f0..abb7a4bc1af 100644
@@ -1,3 +1,5 @@
 SDK_ARCH = "i686"
 SDK_CC_ARCH = "-march=i686"
 ABIEXTENSION:class-nativesdk = ""
+
+SDK_MACHINE_FEATURES = "qemu-usermode"
meta/conf/machine-sdk/loongarch64.conf +2 -0
index 40bf0039ea5..6bb4c7a4ea1 100644
@@ -1,2 +1,4 @@
 SDK_ARCH = "loongarch64"
 ABIEXTENSION:class-nativesdk = ""
+
+SDK_MACHINE_FEATURES = "qemu-usermode"
meta/conf/machine-sdk/ppc64.conf +2 -0
index b41325dfe78..8ba3fccc677 100644
@@ -1,2 +1,4 @@
 SDK_ARCH = "ppc64"
 ABIEXTENSION:class-nativesdk = ""
+
+SDK_MACHINE_FEATURES = "qemu-usermode"
meta/conf/machine-sdk/ppc64le.conf +2 -0
index db1f863496e..3ee12faf572 100644
@@ -1,2 +1,4 @@
 SDK_ARCH = "ppc64le"
 ABIEXTENSION:class-nativesdk = ""
+
+SDK_MACHINE_FEATURES = "qemu-usermode"
meta/conf/machine-sdk/riscv64.conf +2 -0
index 3f4a5af0af7..a43fe433fe6 100644
@@ -1,2 +1,4 @@
 SDK_ARCH = "riscv64"
 ABIEXTENSION:class-nativesdk = ""
+
+SDK_MACHINE_FEATURES = "qemu-usermode"
meta/conf/machine-sdk/x86_64.conf +2 -0
index 3396f95d69d..357dab0b882 100644
@@ -2,3 +2,5 @@ SDK_ARCH = "x86_64"
 SDK_CC_ARCH = "-march=x86-64"
 ABIEXTENSION:class-crosssdk = ""
 ABIEXTENSION:class-nativesdk = ""
+
+SDK_MACHINE_FEATURES = "qemu-usermode"
Signature · 1 line
2.34.1