@@ -90,3 +90,32 @@ def riscv_isa_to_tune(isa):
# Eliminate duplicates, but preserve the order
feature = list(dict.fromkeys(feature))
return ' '.join(feature)
+
+# riscv_pkgarch(features, exact_pkgarch)
+#
+# Prefer a RISCV_PROFILES name (plus any extensions enabled on top of it) as the
+# package arch fragment, since otherwise the full ISA extension list will exceed
+# what the sstate class can handle. When several profiles match, the one with
+# the most extensions is preferred, as it is the more specific/clearer match.
+# If there's no clear profile matching the extension list, then fall back to
+# exact_pkgarch.
+def riscv_pkgarch(features, exact_pkgarch):
+ if not features:
+ return exact_pkgarch
+
+ current = set(features.split())
+
+ best_match = None
+ best_features = None
+ for name in RISCV_PROFILES:
+ profile_features = set(riscv_isa_to_tune(name).split())
+ if profile_features.issubset(current):
+ if best_features is None or len(profile_features) > len(best_features):
+ best_match = name
+ best_features = profile_features
+
+ if best_match is None:
+ return exact_pkgarch
+
+ extra = sorted(current - best_features)
+ return '_'.join([best_match] + extra)
Create a new function to help match RISC-V ISA extension combinations against recognized profile strings (e.g. 'rva22u64'), so that we can use simpler patterns for naming things like sstate/build paths. Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> --- meta/lib/oe/tune.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)