diff options
Diffstat (limited to 'recipes-extended/xen')
-rw-r--r-- | recipes-extended/xen/stubdom.inc | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/recipes-extended/xen/stubdom.inc b/recipes-extended/xen/stubdom.inc new file mode 100644 index 00000000..bfc67527 --- /dev/null +++ b/recipes-extended/xen/stubdom.inc | |||
@@ -0,0 +1,152 @@ | |||
1 | # Copyright (C) 2017 Kurt Bodiker <kurt.bodiker@braintrust-us.com> | ||
2 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
3 | |||
4 | COMPATIBLE_HOST = '(x86_64.*).*-linux' | ||
5 | |||
6 | require xen-arch.inc | ||
7 | |||
8 | # many of the xen stubdom related recipes build and package static instead of shared libraries | ||
9 | EXCLUDE_FROM_SHLIBS = "1" | ||
10 | |||
11 | # base set of dependencies to be used for xen stubdom recipes | ||
12 | DEPENDS += "\ | ||
13 | lwip \ | ||
14 | mini-os \ | ||
15 | " | ||
16 | |||
17 | # unset EVERYTHING from the OE environment. | ||
18 | # Weird things happen when these are exported into the environment. | ||
19 | unset CFLAGS | ||
20 | unset BUILD_CFLAGS | ||
21 | unset TARGET_CFLAGS | ||
22 | unset CFLAGS_FOR_BUILD | ||
23 | |||
24 | unset CPPFLAGS | ||
25 | unset BUILD_CPPFLAGS | ||
26 | unset TARGET_CPPFLAGS | ||
27 | unset CPPFLAGS_FOR_BUILD | ||
28 | |||
29 | unset LDFLAGS | ||
30 | unset BUILD_LDFLAGS | ||
31 | unset TARGET_LDFLAGS | ||
32 | unset LDFLAGS_FOR_BUILD | ||
33 | |||
34 | unset CXXFLAGS | ||
35 | unset TARGET_CXXFLAGS | ||
36 | unset BUILD_CXXFLAGS | ||
37 | unset CXXFLAGS_FOR_BUILD | ||
38 | |||
39 | unset BUILD_CC | ||
40 | unset BUILD_CPP | ||
41 | unset BUILD_CXX | ||
42 | unset BUILD_LD | ||
43 | unset BUILD_AR | ||
44 | unset BUILD_AS | ||
45 | unset BUILD_CCLD | ||
46 | unset BUILD_FC | ||
47 | unset BUILD_RANLIB | ||
48 | unset BUILD_NM | ||
49 | unset BUILD_STRIP | ||
50 | unset BUILD_READELF | ||
51 | unset BUILD_OBJCOPY | ||
52 | unset BUILD_OBJDUMP | ||
53 | unset CC | ||
54 | unset CPP | ||
55 | unset CXX | ||
56 | unset LD | ||
57 | unset AR | ||
58 | unset AS | ||
59 | unset NM | ||
60 | unset RANLIB | ||
61 | unset STRIP | ||
62 | unset STRINGS | ||
63 | unset READELF | ||
64 | unset OBJCOPY | ||
65 | unset OBJDUMP | ||
66 | unset READELF | ||
67 | unset CCLD | ||
68 | unset FC | ||
69 | |||
70 | # Provide support to build both 32-bit and 64-bit stubdoms | ||
71 | python () { | ||
72 | gnu_dict = { | ||
73 | 'x86_32': 'i686', | ||
74 | 'x86_64': 'x86_64', | ||
75 | } | ||
76 | |||
77 | if d.expand('${XEN_TARGET_ARCH}') == 'x86_32': | ||
78 | d.setVar("GNU_TARGET_ARCH",gnu_dict[d.expand('${XEN_TARGET_ARCH}')]) | ||
79 | d.setVar("PACKAGE_ARCH","core2-32") | ||
80 | elif d.expand('${XEN_TARGET_ARCH}') == 'x86_64': | ||
81 | d.setVar("GNU_TARGET_ARCH",gnu_dict[d.expand('${XEN_TARGET_ARCH}')]) | ||
82 | } | ||
83 | |||
84 | export GNU_TARGET_ARCH | ||
85 | export XEN_TARGET_ARCH="${@map_xen_arch(d.getVar('TARGET_ARCH'), d)}" | ||
86 | export XEN_COMPILE_ARCH="${@map_xen_arch(d.getVar('BUILD_ARCH'), d)}" | ||
87 | |||
88 | LWIP_SRCDIR = "${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/lwip" | ||
89 | MINIOS_SRCDIR = "${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/mini-os" | ||
90 | |||
91 | # Base set of CPPFLAGS, CFLAGS needed for each component used to build MiniOS-based stubdoms | ||
92 | # LDFLAGS are only used when building stubdoms, so only used in stubdom recipes | ||
93 | # Generic name given because each library uses DEF_, BUILD_, TARGET_, and xxxFLAGS differently | ||
94 | CPPFLAGS_INCLUDE_DIR = "-isystem ${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include" | ||
95 | |||
96 | STUBDOM_CPPFLAGS += "\ | ||
97 | -isystem ${MINIOS_SRCDIR}/include \ | ||
98 | -D__MINIOS__ \ | ||
99 | -DHAVE_LIBC \ | ||
100 | -isystem ${MINIOS_SRCDIR}/include/posix \ | ||
101 | -isystem ${MINIOS_SRCDIR}/include/xen \ | ||
102 | -isystem ${MINIOS_SRCDIR}/include/x86 \ | ||
103 | -isystem ${MINIOS_SRCDIR}/include/x86/${XEN_TARGET_ARCH} \ | ||
104 | -U __linux__ \ | ||
105 | -U __FreeBSD__ \ | ||
106 | -U __sun__ \ | ||
107 | -nostdinc \ | ||
108 | ${CPPFLAGS_INCLUDE_DIR} \ | ||
109 | -isystem ${LWIP_SRCDIR}/include \ | ||
110 | -isystem ${LWIP_SRCDIR}/include/ipv4 \ | ||
111 | " | ||
112 | |||
113 | STUBDOM_CFLAGS += "\ | ||
114 | -mno-red-zone \ | ||
115 | -O1 \ | ||
116 | -fno-omit-frame-pointer \ | ||
117 | -m64 \ | ||
118 | -fno-reorder-blocks \ | ||
119 | -fno-asynchronous-unwind-tables \ | ||
120 | -DBUILD_ID \ | ||
121 | -fno-strict-aliasing \ | ||
122 | -std=gnu99 \ | ||
123 | -Wall \ | ||
124 | -Wstrict-prototypes \ | ||
125 | -Wdeclaration-after-statement \ | ||
126 | -Wno-unused-but-set-variable \ | ||
127 | -Wno-unused-local-typedefs \ | ||
128 | -fno-stack-protector \ | ||
129 | -fno-exceptions \ | ||
130 | " | ||
131 | |||
132 | STUBDOM_LDFLAGS = "\ | ||
133 | -nostdlib \ | ||
134 | -L${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/lib \ | ||
135 | " | ||
136 | |||
137 | # Need to redefine these for stubdom-related builds. It all starts because of | ||
138 | # the prefix used in newlib and then continues because we don't want to | ||
139 | # cross-contaminate stubdom-related recipes with headers and libraries found in | ||
140 | # the OE-defined locations | ||
141 | export prefix="/cross-root-${GNU_TARGET_ARCH}" | ||
142 | export includedir="${prefix}/${GNU_TARGET_ARCH}-xen-elf/include" | ||
143 | export libdir="${prefix}/${GNU_TARGET_ARCH}-xen-elf/lib" | ||
144 | export libexecdir="${libdir}" | ||
145 | export STAGING_INCDIR | ||
146 | export STAGING_LIBDIR | ||
147 | |||
148 | # Typically defined in Xen and Minios .mk files that aren't sourced/read, | ||
149 | # defined to trigger some values and paths in Makefiles | ||
150 | export debug="y" | ||
151 | export stubdom="y" | ||
152 | export XEN_OS="MiniOS" | ||