summaryrefslogtreecommitdiffstats
path: root/classes
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2013-09-22 20:12:55 -0300
committerOtavio Salvador <otavio@ossystems.com.br>2013-09-25 15:28:34 -0300
commit21d99526538452d96c558cfdef119a6881645748 (patch)
treeef4a629fa605f328dc2e1781b43b4d67434d14c3 /classes
parent69f0129c93d0a267ea4e73ea3ec23cdd8df489cb (diff)
downloadmeta-fsl-arm-21d99526538452d96c558cfdef119a6881645748.tar.gz
fsl-dynamic-packagearch.bbclass: Dynamically set package architecture
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. This reduces the amount of packages we build, for example in case of core-image-x11 we: $ ls -l tmp/deploy/rpm/cortexa9hf_vfp_neon_mx6/*.rpm | wc -l 75 So we reuse 75 binaries; these would be build otherwise. It being dynamically set or statically set it has following benefits: * correctness: it is easier to ensure the system behaves as expected * correctness for non-tracked recipes: new recipes, if depending on virtual/kernel or GPU has the right architecture choosen, without a .bbappend file for them * safeness: non-expert users get a more adequate behavior as the complexity of choosing the right architecture is simplified for them * easy maintenance: it is easier for me, as maintainer, to maintain a code which decides what to do than having hundreds of bbappend files for it Change-Id: Icb0a8060e862c8eeb166c45d1b39c40de07b01d8 Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'classes')
-rw-r--r--classes/fsl-dynamic-packagearch.bbclass47
1 files changed, 47 insertions, 0 deletions
diff --git a/classes/fsl-dynamic-packagearch.bbclass b/classes/fsl-dynamic-packagearch.bbclass
new file mode 100644
index 0000000..def8e71
--- /dev/null
+++ b/classes/fsl-dynamic-packagearch.bbclass
@@ -0,0 +1,47 @@
1# Automatically set PACKAGE_ARCH for MACHINE_SOCARCH
2#
3# This allow to easy reuse of binary packages among similar SoCs. The
4# usual use for this is to share SoC specific packages among different
5# boards.
6#
7# MACHINE_SOCARCH_FILTER list all packages associated with
8# MACHINE_SOCARCH and, when match, will set PACHAGE_ARCH as MACHINE_SOCARCH
9#
10# MACHINE_ARCH_FILTER list all packages associated with
11# MACHINE_ARCH and, when match, will set PACHAGE_ARCH as MACHINE_ARCH
12#
13# For example, in meta-fsl-arm, this is used to share GPU packages for
14# i.MX53 boards (as all them share the AMD GPU) and i.MX6 based boards
15# (as all them share Vivante GPU).
16#
17# To use the class, specify, for example:
18#
19# MACHINE_SOCARCH_soc = "${TUNE_PKGARCH}-soc"
20#
21# and the need filters, as:
22#
23# MACHINE_ARCH_FILTER = "virtual/kernel"
24# MACHINE_SOCARCH_FILTER_soc = "virtual/libgles1 ... virtual/libgl"
25#
26# Copyright 2013 (C) O.S. Systems Software LTDA.
27
28python __anonymous () {
29 machine_arch_filter = set((d.getVar("MACHINE_ARCH_FILTER", True) or "").split())
30 machine_socarch_filter = set((d.getVar("MACHINE_SOCARCH_FILTER", True) or "").split())
31 if machine_socarch_filter or machine_arch_filter:
32 provides = set((d.getVar("PROVIDES", True) or "").split())
33 depends = set((d.getVar("DEPENDS", True) or "").split())
34 PN = d.getVar("PN", True)
35
36 package_arch = None
37 if list(machine_arch_filter & (provides | depends)):
38 package_arch = d.getVar("MACHINE_ARCH", True)
39 elif list(machine_socarch_filter & (provides | depends)):
40 package_arch = d.getVar("MACHINE_SOCARCH", True)
41 if not package_arch:
42 bb.parse.SkipPackage("You must set MACHINE_SOCARCH as MACHINE_SOCARCH_FILTER is set for this SoC.")
43
44 if package_arch:
45 bb.debug(1, "Use '%s' as package archictecture for '%s'" % (package_arch, PN))
46 d.setVar("PACKAGE_ARCH", package_arch)
47}