diff mbox series

[09/12] meta/conf/machine/include/riscv/arch-riscv.inc: error on very long package archs

Message ID 20261118204853.2155173-10-tgamblin@baylibre.com
State New
Headers show
Series riscv: add new ISA extensions, profiles, and selftests | expand

Commit Message

Trevor Gamblin Nov. 18, 2026, 8:48 p.m. UTC
Tunes that don't set RISCVPKGARCH:tune-<name> fall back to
TUNE_RISCV_PKGARCH, which grows with every extension enabled. This can
easily exceed allowable maximums for build and sstate paths, so make it
a fatal error when it's longer than 64 characters and inform the user
to set RISCVPKGARCH:tune-<name> instead.

Existing tunes already set RISCVPKGARCH:tune-<name>, so they are
unaffected. The longest known fallback is currently Microblaze-V's
riscv64imafdc_zicsr_zifencei_zba_zbb_zbs at 41 characters, which is well
under the set limit.

Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
 meta/conf/machine/include/riscv/README         | 3 ++-
 meta/conf/machine/include/riscv/arch-riscv.inc | 8 +++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/conf/machine/include/riscv/README b/meta/conf/machine/include/riscv/README
index ef7a484f25..c66925eb83 100644
--- a/meta/conf/machine/include/riscv/README
+++ b/meta/conf/machine/include/riscv/README
@@ -93,7 +93,8 @@  RISCVPKGARCH - This is the package arch actually used.  As with ARMPKGARCH
                on arm, each tune sets it as a literal in
                RISCVPKGARCH:tune-<name>, so that it only changes when
                deliberately changed.  Tunes that don't set it fall back to
-               TUNE_RISCV_PKGARCH.
+               TUNE_RISCV_PKGARCH, which is an error if that is longer
+               than 64 characters.
 
 The standard variables are defined as:
 
diff --git a/meta/conf/machine/include/riscv/arch-riscv.inc b/meta/conf/machine/include/riscv/arch-riscv.inc
index ff14f94deb..cde35ce56d 100644
--- a/meta/conf/machine/include/riscv/arch-riscv.inc
+++ b/meta/conf/machine/include/riscv/arch-riscv.inc
@@ -301,7 +301,13 @@  TUNE_ARCH = "${TUNE_RISCV_ARCH}"
 # Tunes that don't set it fall back to TUNE_RISCV_PKGARCH, which is built from
 # TUNE_FEATURES above, e.g.:
 #    riscv32imac
-RISCVPKGARCH = "${@d.getVar('RISCVPKGARCH:tune-${DEFAULTTUNE}') or d.getVar('TUNE_RISCV_PKGARCH')}"
+# However, TUNE_RISCV_PKGARCH grows with every extension the tune enables, so to
+# keep build and sstate paths manageable, RISCVPKGARCH:tune-<name> should be set
+# for a custom tune. For TUNE_RISCV_PKGARCH longer than 64 characters, throw an
+# error.
+RISCVPKGARCH = "${@d.getVar('RISCVPKGARCH:tune-${DEFAULTTUNE}') or \
+    ('${TUNE_RISCV_PKGARCH}' if len('${TUNE_RISCV_PKGARCH}') <= 64 else \
+     bb.fatal('The package arch for tune ${DEFAULTTUNE} would be ${TUNE_RISCV_PKGARCH}, which is longer than 64 characters. Set RISCVPKGARCH:tune-${DEFAULTTUNE} to a shorter name.'))}"
 TUNE_PKGARCH = "${RISCVPKGARCH}"
 
 # Misc settings