1 # This class exists to provide information about the targets that
2 # may be needed by other classes and/or recipes. If you add a new
3 # target this will probably need to be updated.
6 # Returns information about 'what' for the named target 'target'
7 # where 'target' == "<arch>-<os>"
10 # * target: Returns the target name ("<arch>-<os>")
11 # * endianess: Return "be" for big endian targets, "le" for little endian
12 # * bits: Returns the bit size of the target, either "32" or "64"
13 # * libc: Returns the name of the c library used by the target
15 # It is an error for the target not to exist.
16 # If 'what' doesn't exist then an empty value is returned
18 def get_siteinfo_list(d):
21 target = bb.data.getVar('HOST_ARCH', d, 1) + "-" + bb.data.getVar('HOST_OS', d, 1)
24 "armeb-linux": "endian-big bit-32 common-glibc arm-common",\
25 "armeb-linux-gnueabi": "endian-big bit-32 common-glibc arm-common armeb-linux",\
26 "armeb-linux-uclibc": "endian-big bit-32 common-uclibc arm-common",\
27 "armeb-linux-uclibcgnueabi": "endian-big bit-32 common-uclibc arm-common armeb-linux-uclibc",\
28 "arm-darwin": "endian-little bit-32 common-darwin",\
29 "arm-linux": "endian-little bit-32 common-glibc arm-common",\
30 "arm-linux-gnueabi": "endian-little bit-32 common-glibc arm-common arm-linux",\
31 "arm-linux-uclibc": "endian-little bit-32 common-uclibc arm-common",\
32 "arm-linux-uclibcgnueabi": "endian-little bit-32 common-uclibc arm-common arm-linux-uclibc",\
33 "avr32-linux": "endian-big bit-32 common-glibc avr32-common",\
34 "avr32-linux-uclibc": "endian-big bit-32 common-uclibc avr32-common",\
35 "bfin-uclinux-uclibc": "endian-little bit-32 common-uclibc bfin-common",\
36 "i386-linux": "endian-little bit-32 common-glibc ix86-common",\
37 "i486-linux": "endian-little bit-32 common-glibc ix86-common",\
38 "i586-linux": "endian-little bit-32 common-glibc ix86-common",\
39 "i686-linux": "endian-little bit-32 common-glibc ix86-common",\
40 "i386-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
41 "i486-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
42 "i586-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
43 "i686-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
44 "mipsel-linux": "endian-little bit-32 common-glibc",\
45 "mipsel-linux-uclibc": "endian-little bit-32 common-uclibc",\
46 "mips-linux": "endian-big bit-32 common-glibc",\
47 "mips-linux-uclibc": "endian-big bit-32 common-uclibc",\
48 "powerpc-darwin": "endian-big bit-32 common-darwin",\
49 "ppc-linux": "endian-big bit-32 common-glibc powerpc-common",\
50 "powerpc-linux": "endian-big bit-32 common-glibc powerpc-common",\
51 "powerpc-linux-uclibc": "endian-big bit-32 common-uclibc powerpc-common",\
52 "sh3-linux": "endian-little bit-32 common-glibc sh-common",\
53 "sh4-linux": "endian-little bit-32 common-glibc sh-common",\
54 "sh4-linux-uclibc": "endian-little bit-32 common-uclibc sh-common",\
55 "sparc-linux": "endian-big bit-32 common-glibc",\
56 "x86_64-linux": "endian-little bit-64 common-glibc",\
57 "x86_64-linux-uclibc": "endian-little bit-64 common-uclibc"}
58 if target in targetinfo:
59 info = targetinfo[target].split()
64 bb.error("Information not available for target '%s'" % target)
68 # Define which site files to use. We check for several site files and
69 # use each one that is found, based on the list returned by get_siteinfo_list()
71 # Search for the files in the following directories:
72 # 1) ${BBPATH}/site (in reverse) - app specific, then site wide
73 # 2) ${FILE_DIRNAME}/site-${PV} - app version specific
75 def siteinfo_get_files(d):
80 # Determine which site files to look for
81 sites = get_siteinfo_list(d)
82 sites.append("common");
84 # Check along bbpath for site files and append in reverse order so
85 # the application specific sites files are last and system site
87 path_bb = bb.data.getVar('BBPATH', d, 1)
88 for p in (path_bb or "").split(':'):
91 fname = os.path.join(p, 'site', i)
92 if os.path.exists(fname):
94 sitefiles = tmp + sitefiles;
96 # Now check for the applications version specific site files
97 path_pkgv = os.path.join(bb.data.getVar('FILE_DIRNAME', d, 1), "site-" + bb.data.getVar('PV', d, 1))
99 fname = os.path.join(path_pkgv, i)
100 if os.path.exists(fname):
101 sitefiles += fname + " "
103 bb.debug(1, "SITE files " + sitefiles);
107 # Export CONFIG_SITE to the enviroment. The autotools will make use
108 # of this to determine where to load in variables from. This is a
109 # space seperate list of shell scripts processed in the order listed.
111 export CONFIG_SITE = "${@siteinfo_get_files(d)}"
114 def siteinfo_get_endianess(d):
115 info = get_siteinfo_list(d)
116 if 'endian-little' in info:
118 elif 'endian-big' in info:
120 bb.error("Site info could not determine endianess for target")
122 def siteinfo_get_bits(d):
123 info = get_siteinfo_list(d)
126 elif 'bit-64' in info:
128 bb.error("Site info could not determine bit size for target")
131 # Make some information available via variables
133 SITEINFO_ENDIANESS = "${@siteinfo_get_endianess(d)}"
134 SITEINFO_BITS = "${@siteinfo_get_bits(d)}"