summaryrefslogtreecommitdiffstats
path: root/classes/fsl-dynamic-packagearch.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/fsl-dynamic-packagearch.bbclass')
-rw-r--r--classes/fsl-dynamic-packagearch.bbclass65
1 files changed, 65 insertions, 0 deletions
diff --git a/classes/fsl-dynamic-packagearch.bbclass b/classes/fsl-dynamic-packagearch.bbclass
new file mode 100644
index 00000000..fa542fce
--- /dev/null
+++ b/classes/fsl-dynamic-packagearch.bbclass
@@ -0,0 +1,65 @@
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 PACKAGE_ARCH as MACHINE_SOCARCH
9#
10# MACHINE_ARCH_FILTER list all packages associated with
11# MACHINE_ARCH and, when match, will set PACKAGE_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_SUFFIX_soc = "-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-2015 (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 raise bb.parse.SkipPackage("You must set MACHINE_SOCARCH as MACHINE_SOCARCH_FILTER is set for this SoC.")
43
44 machine_socarch_suffix = d.getVar("MACHINE_SOCARCH_SUFFIX", True)
45 if not machine_socarch_suffix:
46 raise bb.parse.SkipPackage("You must set MACHINE_SOCARCH_SUFFIX as MACHINE_SOCARCH_FILTER is set for this SoC.")
47
48 if package_arch:
49 bb.debug(1, "Use '%s' as package archictecture for '%s'" % (package_arch, PN))
50 d.setVar("PACKAGE_ARCH", package_arch)
51
52 cur_package_archs = (d.getVar("PACKAGE_ARCHS", True) or "").split()
53 arch_extra_socarch = (d.getVar("ARM_EXTRA_SOCARCH", True) or "")
54 thumb_extra_socarch = (d.getVar("THUMB_EXTRA_SOCARCH", True) or "")
55 if not arch_extra_socarch in cur_package_archs:
56 d.appendVar("PACKAGE_EXTRA_ARCHS", " %s" % arch_extra_socarch)
57
58 if not thumb_extra_socarch in cur_package_archs:
59 d.appendVar("PACKAGE_EXTRA_ARCHS", " %s" % thumb_extra_socarch)
60}
61
62ARM_EXTRA_SOCARCH = "${ARMPKGARCH}${ARMPKGSFX_DSP}${ARMPKGSFX_EABI}${ARMPKGSFX_ENDIAN}${ARMPKGSFX_FPU}${MACHINE_SOCARCH_SUFFIX}"
63THUMB_EXTRA_SOCARCH = "${ARMPKGARCH}${ARM_THUMB_SUFFIX}${ARMPKGSFX_DSP}${ARMPKGSFX_EABI}${ARMPKGSFX_ENDIAN}${ARMPKGSFX_FPU}${MACHINE_SOCARCH_SUFFIX}"
64
65MACHINE_SOCARCH = "${@bb.utils.contains('ARM_INSTRUCTION_SET', 'thumb', '${THUMB_EXTRA_SOCARCH}', '${ARM_EXTRA_SOCARCH}', d)}"