blob: 7608cec044d613e1408314b1db481729df6619ee [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001SUMMARY = "OP-TEE Secure Partion Development Kit"
2DESCRIPTION = "Open Portable Trusted Execution Environment - Development Kit to run secure partitions"
3HOMEPAGE = "https://www.op-tee.org/"
4
5LICENSE = "BSD-2-Clause"
6LIC_FILES_CHKSUM = "file://LICENSE;md5=c1f21c4f72f372ef38a5a4aee55ec173"
7
8inherit deploy python3native
9require optee.inc
10FILESEXTRAPATHS:prepend := "${THISDIR}/optee-os:"
11
12CVE_PRODUCT = "linaro:op-tee op-tee:op-tee_os"
13
14DEPENDS = "python3-pyelftools-native"
15
16DEPENDS:append:toolchain-clang = " compiler-rt"
17
18# spdevkit isn't yet merged to master
19SRC_URI = "git://git.trustedfirmware.org/OP-TEE/optee_os.git;protocol=https;branch=psa-development \
20 file://0006-allow-setting-sysroot-for-libgcc-lookup.patch \
21 file://0007-allow-setting-sysroot-for-clang.patch \
22"
23SRCREV = "f9de2c9520ed97b89760cc4c99424aae440b63f4"
24PV = "3.10+git${SRCPV}"
25
26S = "${WORKDIR}/git"
27B = "${WORKDIR}/build"
28
29EXTRA_OEMAKE += " \
30 PLATFORM=${OPTEEMACHINE} \
31 CFG_${OPTEE_CORE}_core=y \
32 CROSS_COMPILE_core=${HOST_PREFIX} \
33 CROSS_COMPILE_sp_${OPTEE_ARCH}=${HOST_PREFIX} \
34 CFG_CORE_FFA=y \
35 CFG_WITH_SP=y \
36 O=${B} \
37"
38
39CFLAGS[unexport] = "1"
40LDFLAGS[unexport] = "1"
41CPPFLAGS[unexport] = "1"
42AS[unexport] = "1"
43LD[unexport] = "1"
44
45do_configure[noexec] = "1"
46
47do_compile() {
48 oe_runmake -C ${S} sp_dev_kit
49}
50do_compile[cleandirs] = "${B}"
51
52do_install() {
53 #install SP devkit
54 install -d ${D}${includedir}/optee/export-user_sp/
55 for f in ${B}/export-sp_${OPTEE_ARCH}/* ; do
56 cp -aR $f ${D}${includedir}/optee/export-user_sp/
57 done
58 cat > ${D}${includedir}/optee/export-user_sp/include/stddef.h <<'EOF'
59#ifndef STDDEF_H
60#define STDDEF_H
61
62#include <stddef_.h>
63
64#ifndef _PTRDIFF_T
65typedef long ptrdiff_t;
66#define _PTRDIFF_T
67#endif
68
69#ifndef NULL
70#define NULL ((void *) 0)
71#endif
72
73#define offsetof(st, m) __builtin_offsetof(st, m)
74
75#endif /* STDDEF_H */
76EOF
77 cat > ${D}${includedir}/optee/export-user_sp/include/stddef_.h <<'EOF'
78#ifndef STDDEF__H
79#define STDDEF__H
80
81#ifndef SIZET_
82typedef unsigned long size_t;
83#define SIZET_
84#endif
85
86#endif /* STDDEF__H */
87EOF
88 cat > ${D}${includedir}/optee/export-user_sp/include/stdarg.h <<'EOF'
89#ifndef STDARG_H
90#define STDARG_H
91
92#define va_list __builtin_va_list
93#define va_start(ap, last) __builtin_va_start(ap, last)
94#define va_end(ap) __builtin_va_end(ap)
95#define va_copy(to, from) __builtin_va_copy(to, from)
96#define va_arg(to, type) __builtin_va_arg(to, type)
97
98#endif /* STDARG_H */
99EOF
100 cat > ${D}${includedir}/optee/export-user_sp/include/stdbool.h <<'EOF'
101#ifndef STDBOOL_H
102#define STDBOOL_H
103
104#define bool _Bool
105
106#define true 1
107#define false 0
108
109#define __bool_true_false_are_defined 1
110
111#endif /* STDBOOL_H */
112EOF
113
114cat > ${D}${includedir}/optee/export-user_sp/include/features.h <<'EOF'
115 #ifndef _FEATURES_H
116 #define _FEATURES_H
117 #if defined(_ALL_SOURCE) && !defined(_GNU_SOURCE)
118 #define _GNU_SOURCE 1
119#endif
120 #if defined(_DEFAULT_SOURCE) && !defined(_BSD_SOURCE)
121 #define _BSD_SOURCE 1
122#endif
123 #if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) \
124 && !defined(_XOPEN_SOURCE) && !defined(_GNU_SOURCE) \
125 && !defined(_BSD_SOURCE) && !defined(__STRICT_ANSI__)
126 #define _BSD_SOURCE 1
127 #define _XOPEN_SOURCE 700
128#endif
129 #if __STDC_VERSION__ >= 199901L
130 #define __restrict restrict
131 #elif !defined(__GNUC__)
132 #define __restrict
133#endif
134 #if __STDC_VERSION__ >= 199901L || defined(__cplusplus)
135 #define __inline inline
136 #elif !defined(__GNUC__)
137 #define __inline
138#endif
139 #if __STDC_VERSION__ >= 201112L
140 #elif defined(__GNUC__)
141 #define _Noreturn __attribute__((__noreturn__))
142#else
143 #define _Noreturn
144#endif
145 #define __REDIR(x,y) __typeof__(x) x __asm__(#y)
146#endif
147EOF
148cat > ${D}${includedir}/optee/export-user_sp/include/errno.h <<'EOF'
149 #ifndef _ERRNO_H
150 #define _ERRNO_H
151 #include <features.h>
152 #define EPERM 1
153 #define ENOENT 2
154 #define ESRCH 3
155 #define EINTR 4
156 #define EIO 5
157 #define ENXIO 6
158 #define E2BIG 7
159 #define ENOEXEC 8
160 #define EBADF 9
161 #define ECHILD 10
162 #define EAGAIN 11
163 #define ENOMEM 12
164 #define EACCES 13
165 #define EFAULT 14
166 #define ENOTBLK 15
167 #define EBUSY 16
168 #define EEXIST 17
169 #define EXDEV 18
170 #define ENODEV 19
171 #define ENOTDIR 20
172 #define EISDIR 21
173 #define EINVAL 22
174 #define ENFILE 23
175 #define EMFILE 24
176 #define ENOTTY 25
177 #define ETXTBSY 26
178 #define EFBIG 27
179 #define ENOSPC 28
180 #define ESPIPE 29
181 #define EROFS 30
182 #define EMLINK 31
183 #define EPIPE 32
184 #define EDOM 33
185 #define ERANGE 34
186 #define EDEADLK 35
187 #define ENAMETOOLONG 36
188 #define ENOLCK 37
189 #define ENOSYS 38
190 #define ENOTEMPTY 39
191 #define ELOOP 40
192 #define EWOULDBLOCK EAGAIN
193 #define ENOMSG 42
194 #define EIDRM 43
195 #define ECHRNG 44
196 #define EL2NSYNC 45
197 #define EL3HLT 46
198 #define EL3RST 47
199 #define ELNRNG 48
200 #define EUNATCH 49
201 #define ENOCSI 50
202 #define EL2HLT 51
203 #define EBADE 52
204 #define EBADR 53
205 #define EXFULL 54
206 #define ENOANO 55
207 #define EBADRQC 56
208 #define EBADSLT 57
209 #define EDEADLOCK EDEADLK
210 #define EBFONT 59
211 #define ENOSTR 60
212 #define ENODATA 61
213 #define ETIME 62
214 #define ENOSR 63
215 #define ENONET 64
216 #define ENOPKG 65
217 #define EREMOTE 66
218 #define ENOLINK 67
219 #define EADV 68
220 #define ESRMNT 69
221 #define ECOMM 70
222 #define EPROTO 71
223 #define EMULTIHOP 72
224 #define EDOTDOT 73
225 #define EBADMSG 74
226 #define EOVERFLOW 75
227 #define ENOTUNIQ 76
228 #define EBADFD 77
229 #define EREMCHG 78
230 #define ELIBACC 79
231 #define ELIBBAD 80
232 #define ELIBSCN 81
233 #define ELIBMAX 82
234 #define ELIBEXEC 83
235 #define EILSEQ 84
236 #define ERESTART 85
237 #define ESTRPIPE 86
238 #define EUSERS 87
239 #define ENOTSOCK 88
240 #define EDESTADDRREQ 89
241 #define EMSGSIZE 90
242 #define EPROTOTYPE 91
243 #define ENOPROTOOPT 92
244 #define EPROTONOSUPPORT 93
245 #define ESOCKTNOSUPPORT 94
246 #define EOPNOTSUPP 95
247 #define ENOTSUP EOPNOTSUPP
248 #define EPFNOSUPPORT 96
249 #define EAFNOSUPPORT 97
250 #define EADDRINUSE 98
251 #define EADDRNOTAVAIL 99
252 #define ENETDOWN 100
253 #define ENETUNREACH 101
254 #define ENETRESET 102
255 #define ECONNABORTED 103
256 #define ECONNRESET 104
257 #define ENOBUFS 105
258 #define EISCONN 106
259 #define ENOTCONN 107
260 #define ESHUTDOWN 108
261 #define ETOOMANYREFS 109
262 #define ETIMEDOUT 110
263 #define ECONNREFUSED 111
264 #define EHOSTDOWN 112
265 #define EHOSTUNREACH 113
266 #define EALREADY 114
267 #define EINPROGRESS 115
268 #define ESTALE 116
269 #define EUCLEAN 117
270 #define ENOTNAM 118
271 #define ENAVAIL 119
272 #define EISNAM 120
273 #define EREMOTEIO 121
274 #define EDQUOT 122
275 #define ENOMEDIUM 123
276 #define EMEDIUMTYPE 124
277 #define ECANCELED 125
278 #define ENOKEY 126
279 #define EKEYEXPIRED 127
280 #define EKEYREVOKED 128
281 #define EKEYREJECTED 129
282 #define EOWNERDEAD 130
283 #define ENOTRECOVERABLE 131
284 #define ERFKILL 132
285 #define EHWPOISON 133
286 #ifdef __GNUC__
287 __attribute__((const))
288#endif
289 int *__errno_location(void);
290 #define errno (*__errno_location())
291 #ifdef _GNU_SOURCE
292 extern char *program_invocation_short_name, *program_invocation_name;
293#endif
294#endif
295EOF
296}
297
298PACKAGE_ARCH = "${MACHINE_ARCH}"
299
300COMPATIBLE_HOST = "aarch64.*-linux"
301
302# optee-spdevkit static library is part of optee-os image. No need to package this library in a staticdev package
303INSANE_SKIP:${PN}-dev = "staticdev"
304# Build paths are currently embedded
305INSANE_SKIP:${PN}-dev += "buildpaths"