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-linux": "endian-little bit-32 common-glibc arm-common",\
29 "arm-linux-gnueabi": "endian-little bit-32 common-glibc arm-common arm-linux",\
30 "arm-linux-uclibc": "endian-little bit-32 common-uclibc arm-common",\
31 "arm-linux-uclibcgnueabi": "endian-little bit-32 common-uclibc arm-common arm-linux-uclibc",\
32 "i386-linux": "endian-little bit-32 common-glibc ix86-common",\
33 "i486-linux": "endian-little bit-32 common-glibc ix86-common",\
34 "i586-linux": "endian-little bit-32 common-glibc ix86-common",\
35 "i686-linux": "endian-little bit-32 common-glibc ix86-common",\
36 "i386-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
37 "i486-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
38 "i586-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
39 "i686-linux-uclibc": "endian-little bit-32 common-uclibc ix86-common",\
40 "mipsel-linux": "endian-little bit-32 common-glibc",\
41 "mipsel-linux-uclibc": "endian-little bit-32 common-uclibc",\
42 "powerpc-darwin": "endian-big bit-32 common-darwin",\
43 "ppc-linux": "endian-big bit-32 common-glibc powerpc-common",\
44 "powerpc-linux": "endian-big bit-32 common-glibc powerpc-common",\
45 "powerpc-linux-uclibc": "endian-big bit-32 common-uclibc powerpc-common",\
46 "sh3-linux": "endian-little bit-32 common-glibc sh-common",\
47 "sh4-linux": "endian-little bit-32 common-glibc sh-common",\
48 "sh4-linux-uclibc": "endian-little bit-32 common-uclibc sh-common",\
49 "sparc-linux": "endian-big bit-32 common-glibc",\
50 "x86_64-linux": "endian-little bit-64 common-glibc",\
51 "x86_64-linux-uclibc": "endian-little bit-64 common-uclibc"}
52 if target in targetinfo:
53 info = targetinfo[target].split()
58 bb.error("Information not available for target '%s'" % target)
62 # Define which site files to use. We check for several site files and
63 # use each one that is found, based on the list returned by get_siteinfo_list()
65 # Search for the files in the following directories:
66 # 1) ${BBPATH}/site (in reverse) - app specific, then site wide
67 # 2) ${FILE_DIRNAME}/site-${PV} - app version specific
69 def siteinfo_get_files(d):
74 # Determine which site files to look for
75 sites = get_siteinfo_list(d)
76 sites.append("common");
78 # Check along bbpath for site files and append in reverse order so
79 # the application specific sites files are last and system site
81 path_bb = bb.data.getVar('BBPATH', d, 1)
82 for p in (path_bb or "").split(':'):
85 fname = os.path.join(p, 'site', i)
86 if os.path.exists(fname):
88 sitefiles = tmp + sitefiles;
90 # Now check for the applications version specific site files
91 path_pkgv = os.path.join(bb.data.getVar('FILE_DIRNAME', d, 1), "site-" + bb.data.getVar('PV', d, 1))
93 fname = os.path.join(path_pkgv, i)
94 if os.path.exists(fname):
95 sitefiles += fname + " "
97 bb.debug(1, "SITE files " + sitefiles);
101 # Export CONFIG_SITE to the enviroment. The autotools will make use
102 # of this to determine where to load in variables from. This is a
103 # space seperate list of shell scripts processed in the order listed.
105 export CONFIG_SITE = "${@siteinfo_get_files(d)}"
108 def siteinfo_get_endianess(d):
109 info = get_siteinfo_list(d)
110 if 'endian-little' in info:
112 elif 'endian-big' in info:
114 bb.error("Site info could not determine endianess for target")
116 def siteinfo_get_bits(d):
117 info = get_siteinfo_list(d)
120 elif 'bit-64' in info:
122 bb.error("Site info could not determine bit size for target")
125 # Make some information available via variables
127 SITEINFO_ENDIANESS = "${@siteinfo_get_endianess(d)}"
128 SITEINFO_BITS = "${@siteinfo_get_bits(d)}"