summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKurt Bodiker <kurt.bodiker@braintrust-us.com>2018-05-01 10:05:27 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2018-05-01 23:17:28 -0400
commitaf55d880668a32e7f2415d72f4f4f0b4bd7bbefb (patch)
tree6990bd93a8ab96b38a9baeff79ec5bfacb557d86
parent032ef5310419563a01baad0b1b94e4587d12f777 (diff)
downloadmeta-virtualization-af55d880668a32e7f2415d72f4f4f0b4bd7bbefb.tar.gz
xen: Define standard values needed to build stubdomains
This commit introduces the stubdom.inc file that is required for each recipe that is/will be built for Xen stubdomains. This file defines the standard values to be used such as common dependencies, compiler and linker flags, and unsets every flag and build tool that is exported into the OE environment. Signed-off-by: Kurt Bodiker <kurt.bodiker@braintrust-us.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
-rw-r--r--recipes-extended/xen/stubdom.inc152
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
4COMPATIBLE_HOST = '(x86_64.*).*-linux'
5
6require xen-arch.inc
7
8# many of the xen stubdom related recipes build and package static instead of shared libraries
9EXCLUDE_FROM_SHLIBS = "1"
10
11# base set of dependencies to be used for xen stubdom recipes
12DEPENDS += "\
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.
19unset CFLAGS
20unset BUILD_CFLAGS
21unset TARGET_CFLAGS
22unset CFLAGS_FOR_BUILD
23
24unset CPPFLAGS
25unset BUILD_CPPFLAGS
26unset TARGET_CPPFLAGS
27unset CPPFLAGS_FOR_BUILD
28
29unset LDFLAGS
30unset BUILD_LDFLAGS
31unset TARGET_LDFLAGS
32unset LDFLAGS_FOR_BUILD
33
34unset CXXFLAGS
35unset TARGET_CXXFLAGS
36unset BUILD_CXXFLAGS
37unset CXXFLAGS_FOR_BUILD
38
39unset BUILD_CC
40unset BUILD_CPP
41unset BUILD_CXX
42unset BUILD_LD
43unset BUILD_AR
44unset BUILD_AS
45unset BUILD_CCLD
46unset BUILD_FC
47unset BUILD_RANLIB
48unset BUILD_NM
49unset BUILD_STRIP
50unset BUILD_READELF
51unset BUILD_OBJCOPY
52unset BUILD_OBJDUMP
53unset CC
54unset CPP
55unset CXX
56unset LD
57unset AR
58unset AS
59unset NM
60unset RANLIB
61unset STRIP
62unset STRINGS
63unset READELF
64unset OBJCOPY
65unset OBJDUMP
66unset READELF
67unset CCLD
68unset FC
69
70# Provide support to build both 32-bit and 64-bit stubdoms
71python () {
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
84export GNU_TARGET_ARCH
85export XEN_TARGET_ARCH="${@map_xen_arch(d.getVar('TARGET_ARCH'), d)}"
86export XEN_COMPILE_ARCH="${@map_xen_arch(d.getVar('BUILD_ARCH'), d)}"
87
88LWIP_SRCDIR = "${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/lwip"
89MINIOS_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
94CPPFLAGS_INCLUDE_DIR = "-isystem ${RECIPE_SYSROOT}/cross-root-${GNU_TARGET_ARCH}/${GNU_TARGET_ARCH}-xen-elf/include"
95
96STUBDOM_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
113STUBDOM_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
132STUBDOM_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
141export prefix="/cross-root-${GNU_TARGET_ARCH}"
142export includedir="${prefix}/${GNU_TARGET_ARCH}-xen-elf/include"
143export libdir="${prefix}/${GNU_TARGET_ARCH}-xen-elf/lib"
144export libexecdir="${libdir}"
145export STAGING_INCDIR
146export 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
150export debug="y"
151export stubdom="y"
152export XEN_OS="MiniOS"