[meta-freescale] [meta-fsl-arm PATCH 01/23] fsl-dynamic-packagearch.bbclass: Dynamically set package architecture

Otavio Salvador otavio at ossystems.com.br
Mon Sep 23 12:55:36 PDT 2013


This allow to easy reuse of binary packages among similar SoCs. The
usual use for this is to share SoC specific packages among different
boards. The class can be used to share GPU packages for i.MX53 boards
(as all them share the AMD GPU) and i.MX6 based boards (as all them
share Vivante GPU).

It inspects the database and identify if the package provides or
depends on one of subarch provided values and if it does, it sets the
PACKAGE_ARCH for MACHINE_SUBARCH value otherwise if it matches in the
machine specific filter, it sets it to MACHINE_ARCH.

Change-Id: Icb0a8060e862c8eeb166c45d1b39c40de07b01d8
Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---
 classes/fsl-dynamic-packagearch.bbclass | 37 +++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 classes/fsl-dynamic-packagearch.bbclass

diff --git a/classes/fsl-dynamic-packagearch.bbclass b/classes/fsl-dynamic-packagearch.bbclass
new file mode 100644
index 0000000..2778885
--- /dev/null
+++ b/classes/fsl-dynamic-packagearch.bbclass
@@ -0,0 +1,37 @@
+# Automatically set PACKAGE_ARCH for MACHINE_SUBARCH
+#
+# This allow to easy reuse of binary packages among similar SoCs. The
+# usual use for this is to share SoC specific packages among different
+# boards.
+#
+# For example, in meta-fsl-arm, this is used to share GPU packages for
+# i.MX53 boards (as all them share the AMD GPU) and i.MX6 based boards
+# (as all them share Vivante GPU).
+#
+# To use the class, specify:
+#
+# SUBARCH_FILTER = "foo"
+# MACHINE_ARCH_FILTER = "bar"
+#
+# Copyright 2013 (C) O.S. Systems Software LTDA.
+
+python __anonymous () {
+    machine_arch_filter = set((d.getVar("MACHINE_ARCH_FILTER", True) or "").split())
+    subarch_filter = set((d.getVar("SUBARCH_FILTER", True) or "").split())
+    if subarch_filter or machine_arch_filter:
+        provides = set((d.getVar("PROVIDES", True) or "").split())
+        depends = set((d.getVar("DEPENDS", True) or "").split())
+        PN = d.getVar("PN", True)
+
+        package_arch = None
+        if list(machine_arch_filter & (provides | depends)):
+            package_arch = d.getVar("MACHINE_ARCH", True)
+        elif list(subarch_filter & (provides | depends)):
+            package_arch = d.getVar("MACHINE_SUBARCH", True)
+            if not package_arch:
+                bb.parse.SkipPackage("You must set MACHINE_SUBARCH as SUBARCH_FILTER is set for this SoC.")
+
+        if package_arch:
+            bb.debug(1, "Use '%s' as package archictecture for '%s'" % (package_arch, PN))
+            d.setVar("PACKAGE_ARCH", package_arch)
+}
-- 
1.8.4.rc3




More information about the meta-freescale mailing list