diff options
author | Lans Zhang <jia.zhang@windriver.com> | 2017-06-22 15:22:01 +0800 |
---|---|---|
committer | Lans Zhang <jia.zhang@windriver.com> | 2017-06-22 15:24:04 +0800 |
commit | 1b3e5944491c315ca99b832bc3afdb6a19d81430 (patch) | |
tree | ffb3469d58e8e203e4bc8a37adc9fe81a48558fb /meta-tpm2 | |
download | meta-secure-core-1b3e5944491c315ca99b832bc3afdb6a19d81430.tar.gz |
meta-secure-core: initial commit
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
Diffstat (limited to 'meta-tpm2')
27 files changed, 1584 insertions, 0 deletions
diff --git a/meta-tpm2/README.md b/meta-tpm2/README.md new file mode 100644 index 0000000..fbad353 --- /dev/null +++ b/meta-tpm2/README.md | |||
@@ -0,0 +1,21 @@ | |||
1 | ### TPM 2.0 | ||
2 | This feature enables Trusted Platform Module (TPM 2.0) support, including | ||
3 | kernel option changes to enable tpm drivers, and picking up TPM 2.0 packages. | ||
4 | |||
5 | Trusted Platform Module (TPM 2.0) is a microcontroller that stores keys, | ||
6 | passwords, and digital certificates. A TPM 2.0 offers the capabilities as | ||
7 | part of the overall platform security requirements. | ||
8 | |||
9 | ### Clear TPM | ||
10 | For TPM 2.0, the following typical steps can be performed to get the TPM | ||
11 | ready for use: | ||
12 | |||
13 | - Clear and enable TPM from the BIOS or set the security jumper on the board. | ||
14 | - Take TPM ownership, setting Owner/Endorsement/Lockout passwords if | ||
15 | necessary. These passwords are used for the authorization to certain | ||
16 | TPM 2.0 commands. | ||
17 | ``` | ||
18 | # tpm2_takeownership -o <ownerPasswd> -e <endorsePasswd> -l <lockPasswd> | ||
19 | ``` | ||
20 | Then, you can use the TPM for a specific need, such as key generation, | ||
21 | sealing encrypted data, etc. | ||
diff --git a/meta-tpm2/conf/layer.conf b/meta-tpm2/conf/layer.conf new file mode 100644 index 0000000..0b8656e --- /dev/null +++ b/meta-tpm2/conf/layer.conf | |||
@@ -0,0 +1,12 @@ | |||
1 | # We have a conf and classes directory, add to BBPATH | ||
2 | BBPATH .= ":${LAYERDIR}" | ||
3 | |||
4 | # We have recipes-* directories, add to BBFILES | ||
5 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ | ||
6 | ${LAYERDIR}/recipes-*/*/*.bbappend" | ||
7 | |||
8 | BBFILE_COLLECTIONS += "tpm2" | ||
9 | BBFILE_PATTERN_tpm2 = "^${LAYERDIR}/" | ||
10 | BBFILE_PRIORITY_tpm2 = "10" | ||
11 | |||
12 | LAYERDEPENDS_tpm2 = "core" | ||
diff --git a/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2-initramfs.bb b/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2-initramfs.bb new file mode 100644 index 0000000..87c811a --- /dev/null +++ b/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2-initramfs.bb | |||
@@ -0,0 +1 @@ | |||
include packagegroup-tpm2.inc | |||
diff --git a/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2.bb b/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2.bb new file mode 100644 index 0000000..b0dc843 --- /dev/null +++ b/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2.bb | |||
@@ -0,0 +1,11 @@ | |||
1 | include packagegroup-tpm2.inc | ||
2 | |||
3 | RDEPENDS_${PN} += "\ | ||
4 | tpm2-abrmd \ | ||
5 | tpm2.0-tools \ | ||
6 | rng-tools \ | ||
7 | " | ||
8 | |||
9 | RRECOMMENDS_${PN} += "\ | ||
10 | kernel-module-tpm-rng \ | ||
11 | " | ||
diff --git a/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2.inc b/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2.inc new file mode 100644 index 0000000..9ffca61 --- /dev/null +++ b/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2.inc | |||
@@ -0,0 +1,5 @@ | |||
1 | DESCRIPTION = "Packagegroup for TPM2 TCG TSS userspace and utilities." | ||
2 | LICENSE = "MIT" | ||
3 | PR = "r0" | ||
4 | |||
5 | inherit packagegroup | ||
diff --git a/meta-tpm2/recipes-kernel/linux/linux-yocto-rt_4.%.bbappend b/meta-tpm2/recipes-kernel/linux/linux-yocto-rt_4.%.bbappend new file mode 100644 index 0000000..edaf7f3 --- /dev/null +++ b/meta-tpm2/recipes-kernel/linux/linux-yocto-rt_4.%.bbappend | |||
@@ -0,0 +1 @@ | |||
include linux-yocto-tpm2.inc | |||
diff --git a/meta-tpm2/recipes-kernel/linux/linux-yocto-tpm2.inc b/meta-tpm2/recipes-kernel/linux/linux-yocto-tpm2.inc new file mode 100644 index 0000000..32456ca --- /dev/null +++ b/meta-tpm2/recipes-kernel/linux/linux-yocto-tpm2.inc | |||
@@ -0,0 +1,6 @@ | |||
1 | FILESEXTRAPATHS_prepend := "${THISDIR}/linux-yocto:" | ||
2 | |||
3 | SRC_URI += " \ | ||
4 | ${@bb.utils.contains('DISTRO_FEATURES', 'tpm2', \ | ||
5 | 'file://tpm2.scc file://tpm2.cfg', '', d)} \ | ||
6 | " | ||
diff --git a/meta-tpm2/recipes-kernel/linux/linux-yocto/tpm2.cfg b/meta-tpm2/recipes-kernel/linux/linux-yocto/tpm2.cfg new file mode 100644 index 0000000..d175fb5 --- /dev/null +++ b/meta-tpm2/recipes-kernel/linux/linux-yocto/tpm2.cfg | |||
@@ -0,0 +1,16 @@ | |||
1 | .......................................................................... | ||
2 | . WARNING | ||
3 | . | ||
4 | . This file is a kernel configuration fragment, and not a full kernel | ||
5 | . configuration file. The final kernel configuration is made up of | ||
6 | . an assembly of processed fragments, each of which is designed to | ||
7 | . capture a specific part of the final configuration (e.g. platform | ||
8 | . configuration, feature configuration, and board specific hardware | ||
9 | . configuration). For more information on kernel configuration, please | ||
10 | . consult the product documentation. | ||
11 | . | ||
12 | .......................................................................... | ||
13 | |||
14 | CONFIG_TCG_TPM=y | ||
15 | CONFIG_TCG_TIS=y | ||
16 | CONFIG_TCG_CRB=y | ||
diff --git a/meta-tpm2/recipes-kernel/linux/linux-yocto/tpm2.scc b/meta-tpm2/recipes-kernel/linux/linux-yocto/tpm2.scc new file mode 100644 index 0000000..b369daa --- /dev/null +++ b/meta-tpm2/recipes-kernel/linux/linux-yocto/tpm2.scc | |||
@@ -0,0 +1,4 @@ | |||
1 | define KFEATURE_DESCRIPTION "TPM 2.x enablement" | ||
2 | |||
3 | kconf hardware tpm2.cfg | ||
4 | |||
diff --git a/meta-tpm2/recipes-kernel/linux/linux-yocto_4.%.bbappend b/meta-tpm2/recipes-kernel/linux/linux-yocto_4.%.bbappend new file mode 100644 index 0000000..edaf7f3 --- /dev/null +++ b/meta-tpm2/recipes-kernel/linux/linux-yocto_4.%.bbappend | |||
@@ -0,0 +1 @@ | |||
include linux-yocto-tpm2.inc | |||
diff --git a/meta-tpm2/recipes-tpm/tpm2-abrmd/files/Fix-build-failure-when-searching-tabrmd.h.patch b/meta-tpm2/recipes-tpm/tpm2-abrmd/files/Fix-build-failure-when-searching-tabrmd.h.patch new file mode 100644 index 0000000..24dc022 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2-abrmd/files/Fix-build-failure-when-searching-tabrmd.h.patch | |||
@@ -0,0 +1,293 @@ | |||
1 | From 034e9cd7e539e1feda2fbe9a3646e28156856594 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lans Zhang <jia.zhang@windriver.com> | ||
3 | Date: Thu, 15 Jun 2017 10:21:02 +0800 | ||
4 | Subject: [PATCH] Fix build failure when searching tabrmd.h | ||
5 | |||
6 | Signed-off-by: Lans Zhang <jia.zhang@windriver.com> | ||
7 | --- | ||
8 | Makefile.am | 2 +- | ||
9 | src/access-broker.c | 2 +- | ||
10 | src/include/tabrmd.h | 56 --------------------------- | ||
11 | src/include/tcti-tabrmd.h | 2 +- | ||
12 | src/include/tss2/tabrmd.h | 56 +++++++++++++++++++++++++++ | ||
13 | src/resource-manager.c | 2 +- | ||
14 | src/tabrmd-error.c | 2 +- | ||
15 | src/tabrmd.c | 2 +- | ||
16 | src/tcti-tabrmd.c | 2 +- | ||
17 | test/integration/hash-sequence.int.c | 2 +- | ||
18 | test/integration/password-authorization.int.c | 2 +- | ||
19 | test/integration/tcti-cancel.int.c | 2 +- | ||
20 | test/integration/tcti-set-locality.int.c | 2 +- | ||
21 | 13 files changed, 67 insertions(+), 67 deletions(-) | ||
22 | delete mode 100644 src/include/tabrmd.h | ||
23 | create mode 100644 src/include/tss2/tabrmd.h | ||
24 | |||
25 | diff --git a/Makefile.am b/Makefile.am | ||
26 | index 5f88429..4733d4f 100644 | ||
27 | --- a/Makefile.am | ||
28 | +++ b/Makefile.am | ||
29 | @@ -90,7 +90,7 @@ install-data-hook: | ||
30 | $(DESTDIR)$(mandir)/man3/tss2_tcti_tabrmd_init_full.3 | ||
31 | |||
32 | tpm2_abrmddir = $(includedir)/tss2 | ||
33 | -tpm2_abrmd_HEADERS = $(srcdir)/src/include/tabrmd.h | ||
34 | +tpm2_abrmd_HEADERS = $(srcdir)/src/include/tss2/tabrmd.h | ||
35 | libtcti_tabrmddir = $(includedir)/tcti | ||
36 | libtcti_tabrmd_HEADERS = $(srcdir)/src/include/tcti-tabrmd.h | ||
37 | |||
38 | diff --git a/src/access-broker.c b/src/access-broker.c | ||
39 | index d21113d..f357101 100644 | ||
40 | --- a/src/access-broker.c | ||
41 | +++ b/src/access-broker.c | ||
42 | @@ -28,7 +28,7 @@ | ||
43 | #include <inttypes.h> | ||
44 | #include <stdbool.h> | ||
45 | |||
46 | -#include "tabrmd.h" | ||
47 | +#include <tss2/tabrmd.h> | ||
48 | |||
49 | #include "access-broker.h" | ||
50 | #include "tcti.h" | ||
51 | diff --git a/src/include/tabrmd.h b/src/include/tabrmd.h | ||
52 | deleted file mode 100644 | ||
53 | index 42d41a2..0000000 | ||
54 | --- a/src/include/tabrmd.h | ||
55 | +++ /dev/null | ||
56 | @@ -1,56 +0,0 @@ | ||
57 | -/* | ||
58 | - * Copyright (c) 2017, Intel Corporation | ||
59 | - * All rights reserved. | ||
60 | - * | ||
61 | - * Redistribution and use in source and binary forms, with or without | ||
62 | - * modification, are permitted provided that the following conditions are met: | ||
63 | - * | ||
64 | - * 1. Redistributions of source code must retain the above copyright notice, | ||
65 | - * this list of conditions and the following disclaimer. | ||
66 | - * | ||
67 | - * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
68 | - * this list of conditions and the following disclaimer in the documentation | ||
69 | - * and/or other materials provided with the distribution. | ||
70 | - * | ||
71 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
72 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
73 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
74 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
75 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
76 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
77 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
78 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
79 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
80 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
81 | - * THE POSSIBILITY OF SUCH DAMAGE. | ||
82 | - */ | ||
83 | -#ifndef TSS2_TABD_H | ||
84 | -#define TSS2_TABD_H | ||
85 | - | ||
86 | -#include <gio/gio.h> | ||
87 | -#include <tpm20.h> | ||
88 | - | ||
89 | -#define TABRMD_DBUS_INTERFACE "com.intel.tss2.TctiTabrmd" | ||
90 | -#define TABRMD_DBUS_NAME_DEFAULT "com.intel.tss2.Tabrmd" | ||
91 | -#define TABRMD_DBUS_PATH "/com/intel/tss2/Tabrmd/Tcti" | ||
92 | -#define TABRMD_DBUS_METHOD_CREATE_CONNECTION "CreateConnection" | ||
93 | -#define TABRMD_DBUS_METHOD_CANCEL "Cancel" | ||
94 | -#define TABRMD_DBUS_TYPE_DEFAULT G_BUS_TYPE_SYSTEM | ||
95 | - | ||
96 | -/* implementation specific RCs */ | ||
97 | -#define TSS2_RESMGR_RC_INTERNAL_ERROR (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (1 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT)) | ||
98 | -#define TSS2_RESMGR_RC_SAPI_INIT (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (2 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT)) | ||
99 | -#define TSS2_RESMGR_RC_OUT_OF_MEMORY (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (3 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT)) | ||
100 | -/* RCs in the RESMGR layer */ | ||
101 | -#define TSS2_RESMGR_RC_BAD_VALUE (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_BAD_VALUE) | ||
102 | -#define TSS2_RESMGR_RC_NOT_PERMITTED (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_NOT_PERMITTED) | ||
103 | -#define TSS2_RESMGR_RC_NOT_IMPLEMENTED (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_NOT_IMPLEMENTED) | ||
104 | -#define TSS2_RESMGR_RC_GENERAL_FAILURE (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_GENERAL_FAILURE) | ||
105 | -#define TSS2_RESMGR_RC_OBJECT_MEMORY (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TPM_RC_OBJECT_MEMORY) | ||
106 | - | ||
107 | -#define TABRMD_ERROR tabrmd_error_quark () | ||
108 | -GQuark tabrmd_error_quark (void); | ||
109 | - | ||
110 | -TSS2_RC tss2_tcti_tabrmd_dump_trans_state (TSS2_TCTI_CONTEXT *tcti_context); | ||
111 | - | ||
112 | -#endif /* TSS2_TABD_H */ | ||
113 | diff --git a/src/include/tcti-tabrmd.h b/src/include/tcti-tabrmd.h | ||
114 | index c145eb5..e8e0c7f 100644 | ||
115 | --- a/src/include/tcti-tabrmd.h | ||
116 | +++ b/src/include/tcti-tabrmd.h | ||
117 | @@ -35,7 +35,7 @@ extern "C" { | ||
118 | #include <sapi/tpm20.h> | ||
119 | #include <sapi/tss2_tcti.h> | ||
120 | |||
121 | -#include "tabrmd.h" | ||
122 | +#include <tss2/tabrmd.h> | ||
123 | |||
124 | #define TCTI_TABRMD_DBUS_TYPE_DEFAULT TABRMD_DBUS_TYPE_DEFAULT | ||
125 | #define TCTI_TABRMD_DBUS_NAME_DEFAULT TABRMD_DBUS_NAME_DEFAULT | ||
126 | diff --git a/src/include/tss2/tabrmd.h b/src/include/tss2/tabrmd.h | ||
127 | new file mode 100644 | ||
128 | index 0000000..42d41a2 | ||
129 | --- /dev/null | ||
130 | +++ b/src/include/tss2/tabrmd.h | ||
131 | @@ -0,0 +1,56 @@ | ||
132 | +/* | ||
133 | + * Copyright (c) 2017, Intel Corporation | ||
134 | + * All rights reserved. | ||
135 | + * | ||
136 | + * Redistribution and use in source and binary forms, with or without | ||
137 | + * modification, are permitted provided that the following conditions are met: | ||
138 | + * | ||
139 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
140 | + * this list of conditions and the following disclaimer. | ||
141 | + * | ||
142 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
143 | + * this list of conditions and the following disclaimer in the documentation | ||
144 | + * and/or other materials provided with the distribution. | ||
145 | + * | ||
146 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
147 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
148 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
149 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
150 | + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
151 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
152 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
153 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
154 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
155 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | ||
156 | + * THE POSSIBILITY OF SUCH DAMAGE. | ||
157 | + */ | ||
158 | +#ifndef TSS2_TABD_H | ||
159 | +#define TSS2_TABD_H | ||
160 | + | ||
161 | +#include <gio/gio.h> | ||
162 | +#include <tpm20.h> | ||
163 | + | ||
164 | +#define TABRMD_DBUS_INTERFACE "com.intel.tss2.TctiTabrmd" | ||
165 | +#define TABRMD_DBUS_NAME_DEFAULT "com.intel.tss2.Tabrmd" | ||
166 | +#define TABRMD_DBUS_PATH "/com/intel/tss2/Tabrmd/Tcti" | ||
167 | +#define TABRMD_DBUS_METHOD_CREATE_CONNECTION "CreateConnection" | ||
168 | +#define TABRMD_DBUS_METHOD_CANCEL "Cancel" | ||
169 | +#define TABRMD_DBUS_TYPE_DEFAULT G_BUS_TYPE_SYSTEM | ||
170 | + | ||
171 | +/* implementation specific RCs */ | ||
172 | +#define TSS2_RESMGR_RC_INTERNAL_ERROR (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (1 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT)) | ||
173 | +#define TSS2_RESMGR_RC_SAPI_INIT (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (2 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT)) | ||
174 | +#define TSS2_RESMGR_RC_OUT_OF_MEMORY (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (3 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT)) | ||
175 | +/* RCs in the RESMGR layer */ | ||
176 | +#define TSS2_RESMGR_RC_BAD_VALUE (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_BAD_VALUE) | ||
177 | +#define TSS2_RESMGR_RC_NOT_PERMITTED (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_NOT_PERMITTED) | ||
178 | +#define TSS2_RESMGR_RC_NOT_IMPLEMENTED (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_NOT_IMPLEMENTED) | ||
179 | +#define TSS2_RESMGR_RC_GENERAL_FAILURE (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_GENERAL_FAILURE) | ||
180 | +#define TSS2_RESMGR_RC_OBJECT_MEMORY (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TPM_RC_OBJECT_MEMORY) | ||
181 | + | ||
182 | +#define TABRMD_ERROR tabrmd_error_quark () | ||
183 | +GQuark tabrmd_error_quark (void); | ||
184 | + | ||
185 | +TSS2_RC tss2_tcti_tabrmd_dump_trans_state (TSS2_TCTI_CONTEXT *tcti_context); | ||
186 | + | ||
187 | +#endif /* TSS2_TABD_H */ | ||
188 | diff --git a/src/resource-manager.c b/src/resource-manager.c | ||
189 | index 6efdd82..8ad4e46 100644 | ||
190 | --- a/src/resource-manager.c | ||
191 | +++ b/src/resource-manager.c | ||
192 | @@ -35,7 +35,7 @@ | ||
193 | #include "resource-manager.h" | ||
194 | #include "sink-interface.h" | ||
195 | #include "source-interface.h" | ||
196 | -#include "tabrmd.h" | ||
197 | +#include <tss2/tabrmd.h> | ||
198 | #include "tpm2-header.h" | ||
199 | #include "tpm2-command.h" | ||
200 | #include "tpm2-response.h" | ||
201 | diff --git a/src/tabrmd-error.c b/src/tabrmd-error.c | ||
202 | index 5ff5a7d..41a561d 100644 | ||
203 | --- a/src/tabrmd-error.c | ||
204 | +++ b/src/tabrmd-error.c | ||
205 | @@ -1,6 +1,6 @@ | ||
206 | #include <gio/gio.h> | ||
207 | #include <glib.h> | ||
208 | -#include "tabrmd.h" | ||
209 | +#include <tss2/tabrmd.h> | ||
210 | |||
211 | static const GDBusErrorEntry tabrmd_error_entries[] = { | ||
212 | { | ||
213 | diff --git a/src/tabrmd.c b/src/tabrmd.c | ||
214 | index 2275aa5..7156cdf 100644 | ||
215 | --- a/src/tabrmd.c | ||
216 | +++ b/src/tabrmd.c | ||
217 | @@ -34,7 +34,7 @@ | ||
218 | #include <unistd.h> | ||
219 | |||
220 | #include <sapi/tpm20.h> | ||
221 | -#include "tabrmd.h" | ||
222 | +#include <tss2/tabrmd.h> | ||
223 | #include "access-broker.h" | ||
224 | #include "connection.h" | ||
225 | #include "connection-manager.h" | ||
226 | diff --git a/src/tcti-tabrmd.c b/src/tcti-tabrmd.c | ||
227 | index d6d78ea..52418de 100644 | ||
228 | --- a/src/tcti-tabrmd.c | ||
229 | +++ b/src/tcti-tabrmd.c | ||
230 | @@ -35,7 +35,7 @@ | ||
231 | |||
232 | #include <sapi/tpm20.h> | ||
233 | |||
234 | -#include "tabrmd.h" | ||
235 | +#include <tss2/tabrmd.h> | ||
236 | #include "tcti-tabrmd.h" | ||
237 | #include "tcti-tabrmd-priv.h" | ||
238 | #include "tpm2-header.h" | ||
239 | diff --git a/test/integration/hash-sequence.int.c b/test/integration/hash-sequence.int.c | ||
240 | index cf8331d..fd489f9 100644 | ||
241 | --- a/test/integration/hash-sequence.int.c | ||
242 | +++ b/test/integration/hash-sequence.int.c | ||
243 | @@ -34,7 +34,7 @@ | ||
244 | |||
245 | #include <sapi/tpm20.h> | ||
246 | |||
247 | -#include "tabrmd.h" | ||
248 | +#include <tss2/tabrmd.h> | ||
249 | #include "tcti-tabrmd.h" | ||
250 | #include "common.h" | ||
251 | |||
252 | diff --git a/test/integration/password-authorization.int.c b/test/integration/password-authorization.int.c | ||
253 | index e6298ef..5416eaa 100644 | ||
254 | --- a/test/integration/password-authorization.int.c | ||
255 | +++ b/test/integration/password-authorization.int.c | ||
256 | @@ -32,7 +32,7 @@ | ||
257 | #include <glib.h> | ||
258 | #include <inttypes.h> | ||
259 | |||
260 | -#include "tabrmd.h" | ||
261 | +#include <tss2/tabrmd.h> | ||
262 | #include "tcti-tabrmd.h" | ||
263 | #include "common.h" | ||
264 | |||
265 | diff --git a/test/integration/tcti-cancel.int.c b/test/integration/tcti-cancel.int.c | ||
266 | index 31f0f9a..c2a808b 100644 | ||
267 | --- a/test/integration/tcti-cancel.int.c | ||
268 | +++ b/test/integration/tcti-cancel.int.c | ||
269 | @@ -27,7 +27,7 @@ | ||
270 | #include <glib.h> | ||
271 | #include <inttypes.h> | ||
272 | |||
273 | -#include "tabrmd.h" | ||
274 | +#include <tss2/tabrmd.h> | ||
275 | #include "tcti-tabrmd.h" | ||
276 | #include "common.h" | ||
277 | |||
278 | diff --git a/test/integration/tcti-set-locality.int.c b/test/integration/tcti-set-locality.int.c | ||
279 | index 6b7509b..0a54b6a 100644 | ||
280 | --- a/test/integration/tcti-set-locality.int.c | ||
281 | +++ b/test/integration/tcti-set-locality.int.c | ||
282 | @@ -27,7 +27,7 @@ | ||
283 | #include <glib.h> | ||
284 | #include <inttypes.h> | ||
285 | |||
286 | -#include "tabrmd.h" | ||
287 | +#include <tss2/tabrmd.h> | ||
288 | #include "tcti-tabrmd.h" | ||
289 | #include "common.h" | ||
290 | |||
291 | -- | ||
292 | 2.7.5 | ||
293 | |||
diff --git a/meta-tpm2/recipes-tpm/tpm2-abrmd/files/tpm2-abrmd-init.sh b/meta-tpm2/recipes-tpm/tpm2-abrmd/files/tpm2-abrmd-init.sh new file mode 100644 index 0000000..c8dfb7d --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2-abrmd/files/tpm2-abrmd-init.sh | |||
@@ -0,0 +1,65 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | ### BEGIN INIT INFO | ||
4 | # Provides: tpm2-abrmd | ||
5 | # Required-Start: $local_fs $remote_fs $network | ||
6 | # Required-Stop: $local_fs $remote_fs $network | ||
7 | # Should-Start: | ||
8 | # Should-Stop: | ||
9 | # Default-Start: 2 3 4 5 | ||
10 | # Default-Stop: 0 1 6 | ||
11 | # Short-Description: starts tpm2-abrmd | ||
12 | # Description: tpm2-abrmd implements the TCG resource manager | ||
13 | ### END INIT INFO | ||
14 | |||
15 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
16 | DAEMON=/usr/sbin/tpm2-abrmd | ||
17 | NAME=tpm2-abrmd | ||
18 | DESC="TCG TSS2 Access Broker and Resource Management daemon" | ||
19 | USER="tss" | ||
20 | |||
21 | test -x "${DAEMON}" || exit 0 | ||
22 | |||
23 | # Read configuration variable file if it is present | ||
24 | [ -r /etc/default/$NAME ] && . /etc/default/$NAME | ||
25 | |||
26 | case "${1}" in | ||
27 | start) | ||
28 | echo -n "Starting $DESC: " | ||
29 | |||
30 | if [ ! -e /dev/tpm* ] | ||
31 | then | ||
32 | echo "device driver not loaded, skipping." | ||
33 | exit 0 | ||
34 | fi | ||
35 | |||
36 | start-stop-daemon --start --quiet --oknodo --background --pidfile /var/run/${NAME}.pid --user ${USER} --chuid ${USER} --exec ${DAEMON} -- ${DAEMON_OPTS} | ||
37 | RETVAL="$?" | ||
38 | echo "$NAME." | ||
39 | [ "$RETVAL" = 0 ] && pidof $DAEMON > /var/run/${NAME}.pid | ||
40 | exit $RETVAL | ||
41 | ;; | ||
42 | |||
43 | stop) | ||
44 | echo -n "Stopping $DESC: " | ||
45 | |||
46 | start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/${NAME}.pid --user ${USER} --exec ${DAEMON} | ||
47 | RETVAL="$?" | ||
48 | echo "$NAME." | ||
49 | rm -f /var/run/${NAME}.pid | ||
50 | exit $RETVAL | ||
51 | ;; | ||
52 | |||
53 | restart|force-reload) | ||
54 | "${0}" stop | ||
55 | sleep 1 | ||
56 | "${0}" start | ||
57 | exit $? | ||
58 | ;; | ||
59 | *) | ||
60 | echo "Usage: ${NAME} {start|stop|restart|force-reload|status}" >&2 | ||
61 | exit 3 | ||
62 | ;; | ||
63 | esac | ||
64 | |||
65 | exit 0 | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2-abrmd/files/tpm2-abrmd.default b/meta-tpm2/recipes-tpm/tpm2-abrmd/files/tpm2-abrmd.default new file mode 100644 index 0000000..987978a --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2-abrmd/files/tpm2-abrmd.default | |||
@@ -0,0 +1 @@ | |||
DAEMON_OPTS="--tcti=device --logger=syslog --max-connections=20 --max-transient-objects=20 --fail-on-loaded-trans" | |||
diff --git a/meta-tpm2/recipes-tpm/tpm2-abrmd/tpm2-abrmd_git.bb b/meta-tpm2/recipes-tpm/tpm2-abrmd/tpm2-abrmd_git.bb new file mode 100644 index 0000000..17dc449 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2-abrmd/tpm2-abrmd_git.bb | |||
@@ -0,0 +1,61 @@ | |||
1 | SUMMARY = "" | ||
2 | DESCRIPTION = "" | ||
3 | SECTION = "tpm" | ||
4 | |||
5 | # This is a lie. The source for this project is covered by several licenses. | ||
6 | # We're currently working on a way to make this clear for those consuming the | ||
7 | # project. Till then I'm using 'BSD' as a place holder since the Intel license | ||
8 | # is "BSD-like". | ||
9 | LICENSE = "BSD" | ||
10 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD;md5=3775480a712fc46a69647678acb234cb" | ||
11 | |||
12 | DEPENDS += "autoconf-archive dbus glib-2.0 pkgconfig tpm2.0-tss glib-2.0-native" | ||
13 | RDEPENDS_${PN} += "libgcc dbus-glib" | ||
14 | |||
15 | SRC_URI = " \ | ||
16 | git://github.com/01org/tpm2-abrmd.git;branch=master;name=tpm2-abrmd;destsuffix=tpm2-abrmd \ | ||
17 | file://tpm2-abrmd-init.sh \ | ||
18 | file://tpm2-abrmd.default \ | ||
19 | " | ||
20 | |||
21 | SRCREV = "4f0bd204d07176084b245d005df665fbfdf68db5" | ||
22 | PV = "1.0.0+git${SRCPV}" | ||
23 | S = "${WORKDIR}/${BPN}" | ||
24 | |||
25 | inherit autotools pkgconfig systemd update-rc.d useradd | ||
26 | |||
27 | SYSTEMD_PACKAGES += "${PN}" | ||
28 | SYSTEMD_SERVICE_${PN} = "tpm2-abrmd.service" | ||
29 | SYSTEMD_AUTO_ENABLE_${PN} = "enable" | ||
30 | |||
31 | INITSCRIPT_NAME = "tpm2-abrmd" | ||
32 | INITSCRIPT_PARAMS = "start 99 2 3 4 5 . stop 19 0 1 6 ." | ||
33 | |||
34 | USERADD_PACKAGES = "${PN}" | ||
35 | GROUPADD_PARAM_${PN} = "tss" | ||
36 | USERADD_PARAM_${PN} = "-M -d /var/lib/tpm -s /bin/false -g tss tss" | ||
37 | |||
38 | # break out tcti into a package: libtcti-tabrmd | ||
39 | # package up the service file | ||
40 | |||
41 | EXTRA_OECONF += " \ | ||
42 | --with-systemdsystemunitdir=${systemd_system_unitdir} \ | ||
43 | --with-udevrulesdir=${sysconfdir}/udev/rules.d \ | ||
44 | " | ||
45 | |||
46 | do_configure_prepend() { | ||
47 | # execute the bootstrap script | ||
48 | currentdir=$(pwd) | ||
49 | cd "${S}" | ||
50 | ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" ./bootstrap --force | ||
51 | cd "${currentdir}" | ||
52 | } | ||
53 | |||
54 | do_install_append() { | ||
55 | install -d "${D}${sysconfdir}/init.d" | ||
56 | install -m 0755 "${WORKDIR}/tpm2-abrmd-init.sh" "${D}${sysconfdir}/init.d/tpm2-abrmd" | ||
57 | install -d "${D}${sysconfdir}/default" | ||
58 | install -m 0644 "${WORKDIR}/tpm2-abrmd.default" "${D}${sysconfdir}/default/tpm2-abrmd" | ||
59 | } | ||
60 | |||
61 | BBCLASSEXTEND = "native" | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch new file mode 100644 index 0000000..8d91ca0 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch | |||
@@ -0,0 +1,80 @@ | |||
1 | From 9aee7b2bc400a336f0a938ce80eba51707662612 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lans Zhang <jia.zhang@windriver.com> | ||
3 | Date: Mon, 19 Jun 2017 13:52:53 +0800 | ||
4 | Subject: [PATCH 1/2] tpm2-tools: use dynamic linkage with tpm2-abrmd | ||
5 | |||
6 | tpm2-abrmd has huge dependencies and they are not necessary to be involved | ||
7 | in initramfs. | ||
8 | |||
9 | Signed-off-by: Lans Zhang <jia.zhang@windriver.com> | ||
10 | --- | ||
11 | Makefile.am | 2 +- | ||
12 | lib/context-util.c | 22 ++++++++++++++++++++-- | ||
13 | 2 files changed, 21 insertions(+), 3 deletions(-) | ||
14 | |||
15 | diff --git a/Makefile.am b/Makefile.am | ||
16 | index a3c43f8..68ba044 100644 | ||
17 | --- a/Makefile.am | ||
18 | +++ b/Makefile.am | ||
19 | @@ -38,7 +38,7 @@ LIB_COMMON := lib/libcommon.a | ||
20 | AM_CFLAGS := $(INCLUDE_DIRS) $(TPM20_TSS_CFLAGS) $(EXTRA_CFLAGS) $(TCTI_TABRMD_CFLAGS) | ||
21 | AM_LDFLAGS := $(EXTRA_LDFLAGS) | ||
22 | |||
23 | -LDADD = $(LIB_COMMON) $(TPM20_TSS_LIBS) $(TCTI_SOCK_LIBS) $(TCTI_DEV_LIBS) $(TCTI_TABRMD_LIBS) | ||
24 | +LDADD = $(LIB_COMMON) $(TPM20_TSS_LIBS) $(TCTI_SOCK_LIBS) $(TCTI_DEV_LIBS) $(TCTI_TABRMD_LIBS) -ldl | ||
25 | |||
26 | sbin_PROGRAMS = \ | ||
27 | tools/tpm2_create \ | ||
28 | diff --git a/lib/context-util.c b/lib/context-util.c | ||
29 | index 7de22ac..2ef181d 100644 | ||
30 | --- a/lib/context-util.c | ||
31 | +++ b/lib/context-util.c | ||
32 | @@ -38,6 +38,7 @@ | ||
33 | #include <tcti/tcti_socket.h> | ||
34 | #endif | ||
35 | #ifdef HAVE_TCTI_TABRMD | ||
36 | +#include <dlfcn.h> | ||
37 | #include <tcti/tcti-tabrmd.h> | ||
38 | #endif | ||
39 | |||
40 | @@ -134,10 +135,27 @@ TSS2_TCTI_CONTEXT* | ||
41 | tcti_tabrmd_init (void) | ||
42 | { | ||
43 | TSS2_TCTI_CONTEXT *tcti_ctx; | ||
44 | + TSS2_RC (*init)(TSS2_TCTI_CONTEXT *, size_t *); | ||
45 | + /* | ||
46 | + * Intend to "forget" the handle in order to make sure libtcti-tabrmd | ||
47 | + * is unloaded along with the deconstructed functions. | ||
48 | + */ | ||
49 | + void *tabrmd_handle; | ||
50 | TSS2_RC rc; | ||
51 | size_t size; | ||
52 | |||
53 | - rc = tss2_tcti_tabrmd_init(NULL, &size); | ||
54 | + tabrmd_handle = dlopen("libtcti-tabrmd.so.0", RTLD_LAZY); | ||
55 | + if (!tabrmd_handle) { | ||
56 | + fprintf (stderr, | ||
57 | + "Unable to find out the tabrmd tcti library\n"); | ||
58 | + return NULL; | ||
59 | + } | ||
60 | + | ||
61 | + init = dlsym(tabrmd_handle, "tss2_tcti_tabrmd_init"); | ||
62 | + if (!init) | ||
63 | + return NULL; | ||
64 | + | ||
65 | + rc = init(NULL, &size); | ||
66 | if (rc != TSS2_RC_SUCCESS) { | ||
67 | LOG_ERR ("Failed to get size for TABRMD TCTI context: 0x%" PRIx32, rc); | ||
68 | return NULL; | ||
69 | @@ -148,7 +166,7 @@ tcti_tabrmd_init (void) | ||
70 | strerror (errno)); | ||
71 | return NULL; | ||
72 | } | ||
73 | - rc = tss2_tcti_tabrmd_init (tcti_ctx, &size); | ||
74 | + rc = init (tcti_ctx, &size); | ||
75 | if (rc != TSS2_RC_SUCCESS) { | ||
76 | LOG_ERR ("Failed to initialize TABRMD TCTI context: 0x%" PRIx32, rc); | ||
77 | free (tcti_ctx); | ||
78 | -- | ||
79 | 2.7.5 | ||
80 | |||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0002-Fix-build-failure-with-glib-2.0.patch b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0002-Fix-build-failure-with-glib-2.0.patch new file mode 100644 index 0000000..faeaf2a --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0002-Fix-build-failure-with-glib-2.0.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From 53f9b2f63c5370f4d269bf08d940cc8576fcbbf4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lans Zhang <jia.zhang@windriver.com> | ||
3 | Date: Mon, 19 Jun 2017 13:54:34 +0800 | ||
4 | Subject: [PATCH 2/2] Fix build failure with glib-2.0 | ||
5 | |||
6 | Signed-off-by: Lans Zhang <jia.zhang@windriver.com> | ||
7 | --- | ||
8 | Makefile.am | 2 +- | ||
9 | configure.ac | 1 + | ||
10 | 2 files changed, 2 insertions(+), 1 deletion(-) | ||
11 | |||
12 | diff --git a/Makefile.am b/Makefile.am | ||
13 | index 68ba044..e792049 100644 | ||
14 | --- a/Makefile.am | ||
15 | +++ b/Makefile.am | ||
16 | @@ -35,7 +35,7 @@ ACLOCAL_AMFLAGS = -I m4 | ||
17 | INCLUDE_DIRS = -I$(srcdir)/src -I$(srcdir)/lib | ||
18 | LIB_COMMON := lib/libcommon.a | ||
19 | |||
20 | -AM_CFLAGS := $(INCLUDE_DIRS) $(TPM20_TSS_CFLAGS) $(EXTRA_CFLAGS) $(TCTI_TABRMD_CFLAGS) | ||
21 | +AM_CFLAGS := $(INCLUDE_DIRS) $(GLIB_CFLAGS) $(TPM20_TSS_CFLAGS) $(EXTRA_CFLAGS) $(TCTI_TABRMD_CFLAGS) | ||
22 | AM_LDFLAGS := $(EXTRA_LDFLAGS) | ||
23 | |||
24 | LDADD = $(LIB_COMMON) $(TPM20_TSS_LIBS) $(TCTI_SOCK_LIBS) $(TCTI_DEV_LIBS) $(TCTI_TABRMD_LIBS) -ldl | ||
25 | diff --git a/configure.ac b/configure.ac | ||
26 | index ce781ea..08fa81c 100644 | ||
27 | --- a/configure.ac | ||
28 | +++ b/configure.ac | ||
29 | @@ -6,6 +6,7 @@ LT_INIT | ||
30 | AM_INIT_AUTOMAKE([foreign | ||
31 | subdir-objects]) | ||
32 | AC_CONFIG_FILES([Makefile]) | ||
33 | +PKG_CHECK_MODULES([GLIB], [glib-2.0]) | ||
34 | PKG_CHECK_MODULES([SAPI],[sapi]) | ||
35 | # disable libtcti-device selectively (enabled by default) | ||
36 | AC_ARG_WITH( | ||
37 | -- | ||
38 | 2.7.5 | ||
39 | |||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/ax_check_compile_flag.m4 b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/ax_check_compile_flag.m4 new file mode 100644 index 0000000..dcabb92 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/ax_check_compile_flag.m4 | |||
@@ -0,0 +1,74 @@ | |||
1 | # =========================================================================== | ||
2 | # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html | ||
3 | # =========================================================================== | ||
4 | # | ||
5 | # SYNOPSIS | ||
6 | # | ||
7 | # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | ||
8 | # | ||
9 | # DESCRIPTION | ||
10 | # | ||
11 | # Check whether the given FLAG works with the current language's compiler | ||
12 | # or gives an error. (Warnings, however, are ignored) | ||
13 | # | ||
14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on | ||
15 | # success/failure. | ||
16 | # | ||
17 | # If EXTRA-FLAGS is defined, it is added to the current language's default | ||
18 | # flags (e.g. CFLAGS) when the check is done. The check is thus made with | ||
19 | # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to | ||
20 | # force the compiler to issue an error when a bad flag is given. | ||
21 | # | ||
22 | # INPUT gives an alternative input source to AC_COMPILE_IFELSE. | ||
23 | # | ||
24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | ||
25 | # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. | ||
26 | # | ||
27 | # LICENSE | ||
28 | # | ||
29 | # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> | ||
30 | # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> | ||
31 | # | ||
32 | # This program is free software: you can redistribute it and/or modify it | ||
33 | # under the terms of the GNU General Public License as published by the | ||
34 | # Free Software Foundation, either version 3 of the License, or (at your | ||
35 | # option) any later version. | ||
36 | # | ||
37 | # This program is distributed in the hope that it will be useful, but | ||
38 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
40 | # Public License for more details. | ||
41 | # | ||
42 | # You should have received a copy of the GNU General Public License along | ||
43 | # with this program. If not, see <https://www.gnu.org/licenses/>. | ||
44 | # | ||
45 | # As a special exception, the respective Autoconf Macro's copyright owner | ||
46 | # gives unlimited permission to copy, distribute and modify the configure | ||
47 | # scripts that are the output of Autoconf when processing the Macro. You | ||
48 | # need not follow the terms of the GNU General Public License when using | ||
49 | # or distributing such scripts, even though portions of the text of the | ||
50 | # Macro appear in them. The GNU General Public License (GPL) does govern | ||
51 | # all other use of the material that constitutes the Autoconf Macro. | ||
52 | # | ||
53 | # This special exception to the GPL applies to versions of the Autoconf | ||
54 | # Macro released by the Autoconf Archive. When you make and distribute a | ||
55 | # modified version of the Autoconf Macro, you may extend this special | ||
56 | # exception to the GPL to apply to your modified version as well. | ||
57 | |||
58 | #serial 5 | ||
59 | |||
60 | AC_DEFUN([AX_CHECK_COMPILE_FLAG], | ||
61 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | ||
62 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl | ||
63 | AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ | ||
64 | ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS | ||
65 | _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" | ||
66 | AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | ||
67 | [AS_VAR_SET(CACHEVAR,[yes])], | ||
68 | [AS_VAR_SET(CACHEVAR,[no])]) | ||
69 | _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) | ||
70 | AS_VAR_IF(CACHEVAR,yes, | ||
71 | [m4_default([$2], :)], | ||
72 | [m4_default([$3], :)]) | ||
73 | AS_VAR_POPDEF([CACHEVAR])dnl | ||
74 | ])dnl AX_CHECK_COMPILE_FLAGS | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/ax_check_link_flag.m4 b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/ax_check_link_flag.m4 new file mode 100644 index 0000000..819409a --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/ax_check_link_flag.m4 | |||
@@ -0,0 +1,74 @@ | |||
1 | # =========================================================================== | ||
2 | # https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html | ||
3 | # =========================================================================== | ||
4 | # | ||
5 | # SYNOPSIS | ||
6 | # | ||
7 | # AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | ||
8 | # | ||
9 | # DESCRIPTION | ||
10 | # | ||
11 | # Check whether the given FLAG works with the linker or gives an error. | ||
12 | # (Warnings, however, are ignored) | ||
13 | # | ||
14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on | ||
15 | # success/failure. | ||
16 | # | ||
17 | # If EXTRA-FLAGS is defined, it is added to the linker's default flags | ||
18 | # when the check is done. The check is thus made with the flags: "LDFLAGS | ||
19 | # EXTRA-FLAGS FLAG". This can for example be used to force the linker to | ||
20 | # issue an error when a bad flag is given. | ||
21 | # | ||
22 | # INPUT gives an alternative input source to AC_LINK_IFELSE. | ||
23 | # | ||
24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | ||
25 | # macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. | ||
26 | # | ||
27 | # LICENSE | ||
28 | # | ||
29 | # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> | ||
30 | # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> | ||
31 | # | ||
32 | # This program is free software: you can redistribute it and/or modify it | ||
33 | # under the terms of the GNU General Public License as published by the | ||
34 | # Free Software Foundation, either version 3 of the License, or (at your | ||
35 | # option) any later version. | ||
36 | # | ||
37 | # This program is distributed in the hope that it will be useful, but | ||
38 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
40 | # Public License for more details. | ||
41 | # | ||
42 | # You should have received a copy of the GNU General Public License along | ||
43 | # with this program. If not, see <https://www.gnu.org/licenses/>. | ||
44 | # | ||
45 | # As a special exception, the respective Autoconf Macro's copyright owner | ||
46 | # gives unlimited permission to copy, distribute and modify the configure | ||
47 | # scripts that are the output of Autoconf when processing the Macro. You | ||
48 | # need not follow the terms of the GNU General Public License when using | ||
49 | # or distributing such scripts, even though portions of the text of the | ||
50 | # Macro appear in them. The GNU General Public License (GPL) does govern | ||
51 | # all other use of the material that constitutes the Autoconf Macro. | ||
52 | # | ||
53 | # This special exception to the GPL applies to versions of the Autoconf | ||
54 | # Macro released by the Autoconf Archive. When you make and distribute a | ||
55 | # modified version of the Autoconf Macro, you may extend this special | ||
56 | # exception to the GPL to apply to your modified version as well. | ||
57 | |||
58 | #serial 5 | ||
59 | |||
60 | AC_DEFUN([AX_CHECK_LINK_FLAG], | ||
61 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | ||
62 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl | ||
63 | AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ | ||
64 | ax_check_save_flags=$LDFLAGS | ||
65 | LDFLAGS="$LDFLAGS $4 $1" | ||
66 | AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | ||
67 | [AS_VAR_SET(CACHEVAR,[yes])], | ||
68 | [AS_VAR_SET(CACHEVAR,[no])]) | ||
69 | LDFLAGS=$ax_check_save_flags]) | ||
70 | AS_VAR_IF(CACHEVAR,yes, | ||
71 | [m4_default([$2], :)], | ||
72 | [m4_default([$3], :)]) | ||
73 | AS_VAR_POPDEF([CACHEVAR])dnl | ||
74 | ])dnl AX_CHECK_LINK_FLAGS | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/ax_check_preproc_flag.m4 b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/ax_check_preproc_flag.m4 new file mode 100644 index 0000000..4850ff3 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/ax_check_preproc_flag.m4 | |||
@@ -0,0 +1,74 @@ | |||
1 | # =========================================================================== | ||
2 | # https://www.gnu.org/software/autoconf-archive/ax_check_preproc_flag.html | ||
3 | # =========================================================================== | ||
4 | # | ||
5 | # SYNOPSIS | ||
6 | # | ||
7 | # AX_CHECK_PREPROC_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | ||
8 | # | ||
9 | # DESCRIPTION | ||
10 | # | ||
11 | # Check whether the given FLAG works with the current language's | ||
12 | # preprocessor or gives an error. (Warnings, however, are ignored) | ||
13 | # | ||
14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on | ||
15 | # success/failure. | ||
16 | # | ||
17 | # If EXTRA-FLAGS is defined, it is added to the preprocessor's default | ||
18 | # flags when the check is done. The check is thus made with the flags: | ||
19 | # "CPPFLAGS EXTRA-FLAGS FLAG". This can for example be used to force the | ||
20 | # preprocessor to issue an error when a bad flag is given. | ||
21 | # | ||
22 | # INPUT gives an alternative input source to AC_PREPROC_IFELSE. | ||
23 | # | ||
24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | ||
25 | # macro in sync with AX_CHECK_{COMPILE,LINK}_FLAG. | ||
26 | # | ||
27 | # LICENSE | ||
28 | # | ||
29 | # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> | ||
30 | # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> | ||
31 | # | ||
32 | # This program is free software: you can redistribute it and/or modify it | ||
33 | # under the terms of the GNU General Public License as published by the | ||
34 | # Free Software Foundation, either version 3 of the License, or (at your | ||
35 | # option) any later version. | ||
36 | # | ||
37 | # This program is distributed in the hope that it will be useful, but | ||
38 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
40 | # Public License for more details. | ||
41 | # | ||
42 | # You should have received a copy of the GNU General Public License along | ||
43 | # with this program. If not, see <https://www.gnu.org/licenses/>. | ||
44 | # | ||
45 | # As a special exception, the respective Autoconf Macro's copyright owner | ||
46 | # gives unlimited permission to copy, distribute and modify the configure | ||
47 | # scripts that are the output of Autoconf when processing the Macro. You | ||
48 | # need not follow the terms of the GNU General Public License when using | ||
49 | # or distributing such scripts, even though portions of the text of the | ||
50 | # Macro appear in them. The GNU General Public License (GPL) does govern | ||
51 | # all other use of the material that constitutes the Autoconf Macro. | ||
52 | # | ||
53 | # This special exception to the GPL applies to versions of the Autoconf | ||
54 | # Macro released by the Autoconf Archive. When you make and distribute a | ||
55 | # modified version of the Autoconf Macro, you may extend this special | ||
56 | # exception to the GPL to apply to your modified version as well. | ||
57 | |||
58 | #serial 5 | ||
59 | |||
60 | AC_DEFUN([AX_CHECK_PREPROC_FLAG], | ||
61 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | ||
62 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]cppflags_$4_$1])dnl | ||
63 | AC_CACHE_CHECK([whether _AC_LANG preprocessor accepts $1], CACHEVAR, [ | ||
64 | ax_check_save_flags=$CPPFLAGS | ||
65 | CPPFLAGS="$CPPFLAGS $4 $1" | ||
66 | AC_PREPROC_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | ||
67 | [AS_VAR_SET(CACHEVAR,[yes])], | ||
68 | [AS_VAR_SET(CACHEVAR,[no])]) | ||
69 | CPPFLAGS=$ax_check_save_flags]) | ||
70 | AS_VAR_IF(CACHEVAR,yes, | ||
71 | [m4_default([$2], :)], | ||
72 | [m4_default([$3], :)]) | ||
73 | AS_VAR_POPDEF([CACHEVAR])dnl | ||
74 | ])dnl AX_CHECK_PREPROC_FLAGS | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools_git.bb b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools_git.bb new file mode 100644 index 0000000..a914c3b --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools_git.bb | |||
@@ -0,0 +1,48 @@ | |||
1 | SUMMARY = "Tools for TPM2." | ||
2 | DESCRIPTION = "tpm2.0-tools" | ||
3 | SECTION = "tpm" | ||
4 | |||
5 | LICENSE = "BSD" | ||
6 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=91b7c548d73ea16537799e8060cea819" | ||
7 | |||
8 | DEPENDS += "tpm2.0-tss tpm2-abrmd openssl curl autoconf-archive pkgconfig" | ||
9 | RDEPENDS_${PN} += "libtss2 libtctidevice" | ||
10 | |||
11 | SRC_URI = " \ | ||
12 | git://github.com/01org/tpm2.0-tools.git;branch=master;name=tpm2.0-tools;destsuffix=tpm2.0-tools \ | ||
13 | file://ax_check_compile_flag.m4 \ | ||
14 | file://ax_check_preproc_flag.m4 \ | ||
15 | file://ax_check_link_flag.m4 \ | ||
16 | file://0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch \ | ||
17 | file://0002-Fix-build-failure-with-glib-2.0.patch \ | ||
18 | " | ||
19 | |||
20 | S = "${WORKDIR}/${BPN}" | ||
21 | SRCREV = "ada4c20d23d99b4b489c6c793e4132c1d5234b66" | ||
22 | PV = "2.0.0+git${SRCPV}" | ||
23 | |||
24 | inherit autotools pkgconfig | ||
25 | |||
26 | EXTRA_OECONF += " \ | ||
27 | --with-tcti-device \ | ||
28 | --without-tcti-socket \ | ||
29 | --with-tcti-tabrmd \ | ||
30 | " | ||
31 | |||
32 | EXTRA_OEMAKE += " \ | ||
33 | CFLAGS="${CFLAGS} -Wno-implicit-fallthrough" \ | ||
34 | " | ||
35 | |||
36 | do_configure_prepend() { | ||
37 | mkdir -p "${S}/m4" | ||
38 | cp "${WORKDIR}/ax_check_compile_flag.m4" "${S}/m4" | ||
39 | cp "${WORKDIR}/ax_check_preproc_flag.m4" "${S}/m4" | ||
40 | cp "${WORKDIR}/ax_check_link_flag.m4" "${S}/m4" | ||
41 | |||
42 | # execute the bootstrap script | ||
43 | currentdir=$(pwd) | ||
44 | cd "${S}" | ||
45 | ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" \ | ||
46 | ./bootstrap --force | ||
47 | cd "${currentdir}" | ||
48 | } | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/0001-update-bootstrap.patch b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/0001-update-bootstrap.patch new file mode 100644 index 0000000..3f5fa81 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/0001-update-bootstrap.patch | |||
@@ -0,0 +1,24 @@ | |||
1 | Index: TPM2.0-TSS/bootstrap | ||
2 | =================================================================== | ||
3 | --- TPM2.0-TSS.orig/bootstrap | ||
4 | +++ TPM2.0-TSS/bootstrap | ||
5 | @@ -13,6 +13,7 @@ src_listvar () { | ||
6 | } | ||
7 | |||
8 | VARS_FILE=src_vars.mk | ||
9 | +AUTORECONF=${AUTORECONF:-autoreconf} | ||
10 | |||
11 | echo "Generating file lists: ${VARS_FILE}" | ||
12 | ( | ||
13 | @@ -30,11 +31,3 @@ echo "Generating file lists: ${VARS_FILE | ||
14 | printf "SAMPLE_SRC = \$(SAMPLE_C) \$(SAMPLE_H)\n" | ||
15 | ) > ${VARS_FILE} | ||
16 | |||
17 | -printf "Running libtoolize ...\n" | ||
18 | -libtoolize --install | ||
19 | -printf "Running aclocal ...\n" | ||
20 | -aclocal | ||
21 | -printf "Running autoconf ...\n" | ||
22 | -autoconf | ||
23 | -printf "Running automake ...\n" | ||
24 | -automake --add-missing | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_check_compile_flag.m4 b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_check_compile_flag.m4 new file mode 100644 index 0000000..dcabb92 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_check_compile_flag.m4 | |||
@@ -0,0 +1,74 @@ | |||
1 | # =========================================================================== | ||
2 | # https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html | ||
3 | # =========================================================================== | ||
4 | # | ||
5 | # SYNOPSIS | ||
6 | # | ||
7 | # AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | ||
8 | # | ||
9 | # DESCRIPTION | ||
10 | # | ||
11 | # Check whether the given FLAG works with the current language's compiler | ||
12 | # or gives an error. (Warnings, however, are ignored) | ||
13 | # | ||
14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on | ||
15 | # success/failure. | ||
16 | # | ||
17 | # If EXTRA-FLAGS is defined, it is added to the current language's default | ||
18 | # flags (e.g. CFLAGS) when the check is done. The check is thus made with | ||
19 | # the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to | ||
20 | # force the compiler to issue an error when a bad flag is given. | ||
21 | # | ||
22 | # INPUT gives an alternative input source to AC_COMPILE_IFELSE. | ||
23 | # | ||
24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | ||
25 | # macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. | ||
26 | # | ||
27 | # LICENSE | ||
28 | # | ||
29 | # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> | ||
30 | # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> | ||
31 | # | ||
32 | # This program is free software: you can redistribute it and/or modify it | ||
33 | # under the terms of the GNU General Public License as published by the | ||
34 | # Free Software Foundation, either version 3 of the License, or (at your | ||
35 | # option) any later version. | ||
36 | # | ||
37 | # This program is distributed in the hope that it will be useful, but | ||
38 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
40 | # Public License for more details. | ||
41 | # | ||
42 | # You should have received a copy of the GNU General Public License along | ||
43 | # with this program. If not, see <https://www.gnu.org/licenses/>. | ||
44 | # | ||
45 | # As a special exception, the respective Autoconf Macro's copyright owner | ||
46 | # gives unlimited permission to copy, distribute and modify the configure | ||
47 | # scripts that are the output of Autoconf when processing the Macro. You | ||
48 | # need not follow the terms of the GNU General Public License when using | ||
49 | # or distributing such scripts, even though portions of the text of the | ||
50 | # Macro appear in them. The GNU General Public License (GPL) does govern | ||
51 | # all other use of the material that constitutes the Autoconf Macro. | ||
52 | # | ||
53 | # This special exception to the GPL applies to versions of the Autoconf | ||
54 | # Macro released by the Autoconf Archive. When you make and distribute a | ||
55 | # modified version of the Autoconf Macro, you may extend this special | ||
56 | # exception to the GPL to apply to your modified version as well. | ||
57 | |||
58 | #serial 5 | ||
59 | |||
60 | AC_DEFUN([AX_CHECK_COMPILE_FLAG], | ||
61 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | ||
62 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl | ||
63 | AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ | ||
64 | ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS | ||
65 | _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" | ||
66 | AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | ||
67 | [AS_VAR_SET(CACHEVAR,[yes])], | ||
68 | [AS_VAR_SET(CACHEVAR,[no])]) | ||
69 | _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) | ||
70 | AS_VAR_IF(CACHEVAR,yes, | ||
71 | [m4_default([$2], :)], | ||
72 | [m4_default([$3], :)]) | ||
73 | AS_VAR_POPDEF([CACHEVAR])dnl | ||
74 | ])dnl AX_CHECK_COMPILE_FLAGS | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_check_link_flag.m4 b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_check_link_flag.m4 new file mode 100644 index 0000000..819409a --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_check_link_flag.m4 | |||
@@ -0,0 +1,74 @@ | |||
1 | # =========================================================================== | ||
2 | # https://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html | ||
3 | # =========================================================================== | ||
4 | # | ||
5 | # SYNOPSIS | ||
6 | # | ||
7 | # AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | ||
8 | # | ||
9 | # DESCRIPTION | ||
10 | # | ||
11 | # Check whether the given FLAG works with the linker or gives an error. | ||
12 | # (Warnings, however, are ignored) | ||
13 | # | ||
14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on | ||
15 | # success/failure. | ||
16 | # | ||
17 | # If EXTRA-FLAGS is defined, it is added to the linker's default flags | ||
18 | # when the check is done. The check is thus made with the flags: "LDFLAGS | ||
19 | # EXTRA-FLAGS FLAG". This can for example be used to force the linker to | ||
20 | # issue an error when a bad flag is given. | ||
21 | # | ||
22 | # INPUT gives an alternative input source to AC_LINK_IFELSE. | ||
23 | # | ||
24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | ||
25 | # macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG. | ||
26 | # | ||
27 | # LICENSE | ||
28 | # | ||
29 | # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> | ||
30 | # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> | ||
31 | # | ||
32 | # This program is free software: you can redistribute it and/or modify it | ||
33 | # under the terms of the GNU General Public License as published by the | ||
34 | # Free Software Foundation, either version 3 of the License, or (at your | ||
35 | # option) any later version. | ||
36 | # | ||
37 | # This program is distributed in the hope that it will be useful, but | ||
38 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
40 | # Public License for more details. | ||
41 | # | ||
42 | # You should have received a copy of the GNU General Public License along | ||
43 | # with this program. If not, see <https://www.gnu.org/licenses/>. | ||
44 | # | ||
45 | # As a special exception, the respective Autoconf Macro's copyright owner | ||
46 | # gives unlimited permission to copy, distribute and modify the configure | ||
47 | # scripts that are the output of Autoconf when processing the Macro. You | ||
48 | # need not follow the terms of the GNU General Public License when using | ||
49 | # or distributing such scripts, even though portions of the text of the | ||
50 | # Macro appear in them. The GNU General Public License (GPL) does govern | ||
51 | # all other use of the material that constitutes the Autoconf Macro. | ||
52 | # | ||
53 | # This special exception to the GPL applies to versions of the Autoconf | ||
54 | # Macro released by the Autoconf Archive. When you make and distribute a | ||
55 | # modified version of the Autoconf Macro, you may extend this special | ||
56 | # exception to the GPL to apply to your modified version as well. | ||
57 | |||
58 | #serial 5 | ||
59 | |||
60 | AC_DEFUN([AX_CHECK_LINK_FLAG], | ||
61 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | ||
62 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl | ||
63 | AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [ | ||
64 | ax_check_save_flags=$LDFLAGS | ||
65 | LDFLAGS="$LDFLAGS $4 $1" | ||
66 | AC_LINK_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | ||
67 | [AS_VAR_SET(CACHEVAR,[yes])], | ||
68 | [AS_VAR_SET(CACHEVAR,[no])]) | ||
69 | LDFLAGS=$ax_check_save_flags]) | ||
70 | AS_VAR_IF(CACHEVAR,yes, | ||
71 | [m4_default([$2], :)], | ||
72 | [m4_default([$3], :)]) | ||
73 | AS_VAR_POPDEF([CACHEVAR])dnl | ||
74 | ])dnl AX_CHECK_LINK_FLAGS | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_check_preproc_flag.m4 b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_check_preproc_flag.m4 new file mode 100644 index 0000000..4850ff3 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_check_preproc_flag.m4 | |||
@@ -0,0 +1,74 @@ | |||
1 | # =========================================================================== | ||
2 | # https://www.gnu.org/software/autoconf-archive/ax_check_preproc_flag.html | ||
3 | # =========================================================================== | ||
4 | # | ||
5 | # SYNOPSIS | ||
6 | # | ||
7 | # AX_CHECK_PREPROC_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | ||
8 | # | ||
9 | # DESCRIPTION | ||
10 | # | ||
11 | # Check whether the given FLAG works with the current language's | ||
12 | # preprocessor or gives an error. (Warnings, however, are ignored) | ||
13 | # | ||
14 | # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on | ||
15 | # success/failure. | ||
16 | # | ||
17 | # If EXTRA-FLAGS is defined, it is added to the preprocessor's default | ||
18 | # flags when the check is done. The check is thus made with the flags: | ||
19 | # "CPPFLAGS EXTRA-FLAGS FLAG". This can for example be used to force the | ||
20 | # preprocessor to issue an error when a bad flag is given. | ||
21 | # | ||
22 | # INPUT gives an alternative input source to AC_PREPROC_IFELSE. | ||
23 | # | ||
24 | # NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | ||
25 | # macro in sync with AX_CHECK_{COMPILE,LINK}_FLAG. | ||
26 | # | ||
27 | # LICENSE | ||
28 | # | ||
29 | # Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> | ||
30 | # Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> | ||
31 | # | ||
32 | # This program is free software: you can redistribute it and/or modify it | ||
33 | # under the terms of the GNU General Public License as published by the | ||
34 | # Free Software Foundation, either version 3 of the License, or (at your | ||
35 | # option) any later version. | ||
36 | # | ||
37 | # This program is distributed in the hope that it will be useful, but | ||
38 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
39 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
40 | # Public License for more details. | ||
41 | # | ||
42 | # You should have received a copy of the GNU General Public License along | ||
43 | # with this program. If not, see <https://www.gnu.org/licenses/>. | ||
44 | # | ||
45 | # As a special exception, the respective Autoconf Macro's copyright owner | ||
46 | # gives unlimited permission to copy, distribute and modify the configure | ||
47 | # scripts that are the output of Autoconf when processing the Macro. You | ||
48 | # need not follow the terms of the GNU General Public License when using | ||
49 | # or distributing such scripts, even though portions of the text of the | ||
50 | # Macro appear in them. The GNU General Public License (GPL) does govern | ||
51 | # all other use of the material that constitutes the Autoconf Macro. | ||
52 | # | ||
53 | # This special exception to the GPL applies to versions of the Autoconf | ||
54 | # Macro released by the Autoconf Archive. When you make and distribute a | ||
55 | # modified version of the Autoconf Macro, you may extend this special | ||
56 | # exception to the GPL to apply to your modified version as well. | ||
57 | |||
58 | #serial 5 | ||
59 | |||
60 | AC_DEFUN([AX_CHECK_PREPROC_FLAG], | ||
61 | [AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | ||
62 | AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]cppflags_$4_$1])dnl | ||
63 | AC_CACHE_CHECK([whether _AC_LANG preprocessor accepts $1], CACHEVAR, [ | ||
64 | ax_check_save_flags=$CPPFLAGS | ||
65 | CPPFLAGS="$CPPFLAGS $4 $1" | ||
66 | AC_PREPROC_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | ||
67 | [AS_VAR_SET(CACHEVAR,[yes])], | ||
68 | [AS_VAR_SET(CACHEVAR,[no])]) | ||
69 | CPPFLAGS=$ax_check_save_flags]) | ||
70 | AS_VAR_IF(CACHEVAR,yes, | ||
71 | [m4_default([$2], :)], | ||
72 | [m4_default([$3], :)]) | ||
73 | AS_VAR_POPDEF([CACHEVAR])dnl | ||
74 | ])dnl AX_CHECK_PREPROC_FLAGS | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_pthread.m4 b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_pthread.m4 new file mode 100644 index 0000000..d383ad5 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/ax_pthread.m4 | |||
@@ -0,0 +1,332 @@ | |||
1 | # =========================================================================== | ||
2 | # http://www.gnu.org/software/autoconf-archive/ax_pthread.html | ||
3 | # =========================================================================== | ||
4 | # | ||
5 | # SYNOPSIS | ||
6 | # | ||
7 | # AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) | ||
8 | # | ||
9 | # DESCRIPTION | ||
10 | # | ||
11 | # This macro figures out how to build C programs using POSIX threads. It | ||
12 | # sets the PTHREAD_LIBS output variable to the threads library and linker | ||
13 | # flags, and the PTHREAD_CFLAGS output variable to any special C compiler | ||
14 | # flags that are needed. (The user can also force certain compiler | ||
15 | # flags/libs to be tested by setting these environment variables.) | ||
16 | # | ||
17 | # Also sets PTHREAD_CC to any special C compiler that is needed for | ||
18 | # multi-threaded programs (defaults to the value of CC otherwise). (This | ||
19 | # is necessary on AIX to use the special cc_r compiler alias.) | ||
20 | # | ||
21 | # NOTE: You are assumed to not only compile your program with these flags, | ||
22 | # but also link it with them as well. e.g. you should link with | ||
23 | # $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS | ||
24 | # | ||
25 | # If you are only building threads programs, you may wish to use these | ||
26 | # variables in your default LIBS, CFLAGS, and CC: | ||
27 | # | ||
28 | # LIBS="$PTHREAD_LIBS $LIBS" | ||
29 | # CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | ||
30 | # CC="$PTHREAD_CC" | ||
31 | # | ||
32 | # In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant | ||
33 | # has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name | ||
34 | # (e.g. PTHREAD_CREATE_UNDETACHED on AIX). | ||
35 | # | ||
36 | # Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the | ||
37 | # PTHREAD_PRIO_INHERIT symbol is defined when compiling with | ||
38 | # PTHREAD_CFLAGS. | ||
39 | # | ||
40 | # ACTION-IF-FOUND is a list of shell commands to run if a threads library | ||
41 | # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it | ||
42 | # is not found. If ACTION-IF-FOUND is not specified, the default action | ||
43 | # will define HAVE_PTHREAD. | ||
44 | # | ||
45 | # Please let the authors know if this macro fails on any platform, or if | ||
46 | # you have any other suggestions or comments. This macro was based on work | ||
47 | # by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help | ||
48 | # from M. Frigo), as well as ac_pthread and hb_pthread macros posted by | ||
49 | # Alejandro Forero Cuervo to the autoconf macro repository. We are also | ||
50 | # grateful for the helpful feedback of numerous users. | ||
51 | # | ||
52 | # Updated for Autoconf 2.68 by Daniel Richard G. | ||
53 | # | ||
54 | # LICENSE | ||
55 | # | ||
56 | # Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu> | ||
57 | # Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG> | ||
58 | # | ||
59 | # This program is free software: you can redistribute it and/or modify it | ||
60 | # under the terms of the GNU General Public License as published by the | ||
61 | # Free Software Foundation, either version 3 of the License, or (at your | ||
62 | # option) any later version. | ||
63 | # | ||
64 | # This program is distributed in the hope that it will be useful, but | ||
65 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
66 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
67 | # Public License for more details. | ||
68 | # | ||
69 | # You should have received a copy of the GNU General Public License along | ||
70 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
71 | # | ||
72 | # As a special exception, the respective Autoconf Macro's copyright owner | ||
73 | # gives unlimited permission to copy, distribute and modify the configure | ||
74 | # scripts that are the output of Autoconf when processing the Macro. You | ||
75 | # need not follow the terms of the GNU General Public License when using | ||
76 | # or distributing such scripts, even though portions of the text of the | ||
77 | # Macro appear in them. The GNU General Public License (GPL) does govern | ||
78 | # all other use of the material that constitutes the Autoconf Macro. | ||
79 | # | ||
80 | # This special exception to the GPL applies to versions of the Autoconf | ||
81 | # Macro released by the Autoconf Archive. When you make and distribute a | ||
82 | # modified version of the Autoconf Macro, you may extend this special | ||
83 | # exception to the GPL to apply to your modified version as well. | ||
84 | |||
85 | #serial 21 | ||
86 | |||
87 | AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) | ||
88 | AC_DEFUN([AX_PTHREAD], [ | ||
89 | AC_REQUIRE([AC_CANONICAL_HOST]) | ||
90 | AC_LANG_PUSH([C]) | ||
91 | ax_pthread_ok=no | ||
92 | |||
93 | # We used to check for pthread.h first, but this fails if pthread.h | ||
94 | # requires special compiler flags (e.g. on True64 or Sequent). | ||
95 | # It gets checked for in the link test anyway. | ||
96 | |||
97 | # First of all, check if the user has set any of the PTHREAD_LIBS, | ||
98 | # etcetera environment variables, and if threads linking works using | ||
99 | # them: | ||
100 | if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then | ||
101 | save_CFLAGS="$CFLAGS" | ||
102 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | ||
103 | save_LIBS="$LIBS" | ||
104 | LIBS="$PTHREAD_LIBS $LIBS" | ||
105 | AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) | ||
106 | AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes]) | ||
107 | AC_MSG_RESULT([$ax_pthread_ok]) | ||
108 | if test x"$ax_pthread_ok" = xno; then | ||
109 | PTHREAD_LIBS="" | ||
110 | PTHREAD_CFLAGS="" | ||
111 | fi | ||
112 | LIBS="$save_LIBS" | ||
113 | CFLAGS="$save_CFLAGS" | ||
114 | fi | ||
115 | |||
116 | # We must check for the threads library under a number of different | ||
117 | # names; the ordering is very important because some systems | ||
118 | # (e.g. DEC) have both -lpthread and -lpthreads, where one of the | ||
119 | # libraries is broken (non-POSIX). | ||
120 | |||
121 | # Create a list of thread flags to try. Items starting with a "-" are | ||
122 | # C compiler flags, and other items are library names, except for "none" | ||
123 | # which indicates that we try without any flags at all, and "pthread-config" | ||
124 | # which is a program returning the flags for the Pth emulation library. | ||
125 | |||
126 | ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" | ||
127 | |||
128 | # The ordering *is* (sometimes) important. Some notes on the | ||
129 | # individual items follow: | ||
130 | |||
131 | # pthreads: AIX (must check this before -lpthread) | ||
132 | # none: in case threads are in libc; should be tried before -Kthread and | ||
133 | # other compiler flags to prevent continual compiler warnings | ||
134 | # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) | ||
135 | # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) | ||
136 | # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) | ||
137 | # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) | ||
138 | # -pthreads: Solaris/gcc | ||
139 | # -mthreads: Mingw32/gcc, Lynx/gcc | ||
140 | # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it | ||
141 | # doesn't hurt to check since this sometimes defines pthreads too; | ||
142 | # also defines -D_REENTRANT) | ||
143 | # ... -mt is also the pthreads flag for HP/aCC | ||
144 | # pthread: Linux, etcetera | ||
145 | # --thread-safe: KAI C++ | ||
146 | # pthread-config: use pthread-config program (for GNU Pth library) | ||
147 | |||
148 | case ${host_os} in | ||
149 | solaris*) | ||
150 | |||
151 | # On Solaris (at least, for some versions), libc contains stubbed | ||
152 | # (non-functional) versions of the pthreads routines, so link-based | ||
153 | # tests will erroneously succeed. (We need to link with -pthreads/-mt/ | ||
154 | # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather | ||
155 | # a function called by this macro, so we could check for that, but | ||
156 | # who knows whether they'll stub that too in a future libc.) So, | ||
157 | # we'll just look for -pthreads and -lpthread first: | ||
158 | |||
159 | ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" | ||
160 | ;; | ||
161 | |||
162 | darwin*) | ||
163 | ax_pthread_flags="-pthread $ax_pthread_flags" | ||
164 | ;; | ||
165 | esac | ||
166 | |||
167 | # Clang doesn't consider unrecognized options an error unless we specify | ||
168 | # -Werror. We throw in some extra Clang-specific options to ensure that | ||
169 | # this doesn't happen for GCC, which also accepts -Werror. | ||
170 | |||
171 | AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags]) | ||
172 | save_CFLAGS="$CFLAGS" | ||
173 | ax_pthread_extra_flags="-Werror" | ||
174 | CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" | ||
175 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])], | ||
176 | [AC_MSG_RESULT([yes])], | ||
177 | [ax_pthread_extra_flags= | ||
178 | AC_MSG_RESULT([no])]) | ||
179 | CFLAGS="$save_CFLAGS" | ||
180 | |||
181 | if test x"$ax_pthread_ok" = xno; then | ||
182 | for flag in $ax_pthread_flags; do | ||
183 | |||
184 | case $flag in | ||
185 | none) | ||
186 | AC_MSG_CHECKING([whether pthreads work without any flags]) | ||
187 | ;; | ||
188 | |||
189 | -*) | ||
190 | AC_MSG_CHECKING([whether pthreads work with $flag]) | ||
191 | PTHREAD_CFLAGS="$flag" | ||
192 | ;; | ||
193 | |||
194 | pthread-config) | ||
195 | AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) | ||
196 | if test x"$ax_pthread_config" = xno; then continue; fi | ||
197 | PTHREAD_CFLAGS="`pthread-config --cflags`" | ||
198 | PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" | ||
199 | ;; | ||
200 | |||
201 | *) | ||
202 | AC_MSG_CHECKING([for the pthreads library -l$flag]) | ||
203 | PTHREAD_LIBS="-l$flag" | ||
204 | ;; | ||
205 | esac | ||
206 | |||
207 | save_LIBS="$LIBS" | ||
208 | save_CFLAGS="$CFLAGS" | ||
209 | LIBS="$PTHREAD_LIBS $LIBS" | ||
210 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags" | ||
211 | |||
212 | # Check for various functions. We must include pthread.h, | ||
213 | # since some functions may be macros. (On the Sequent, we | ||
214 | # need a special flag -Kthread to make this header compile.) | ||
215 | # We check for pthread_join because it is in -lpthread on IRIX | ||
216 | # while pthread_create is in libc. We check for pthread_attr_init | ||
217 | # due to DEC craziness with -lpthreads. We check for | ||
218 | # pthread_cleanup_push because it is one of the few pthread | ||
219 | # functions on Solaris that doesn't have a non-functional libc stub. | ||
220 | # We try pthread_create on general principles. | ||
221 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h> | ||
222 | static void routine(void *a) { a = 0; } | ||
223 | static void *start_routine(void *a) { return a; }], | ||
224 | [pthread_t th; pthread_attr_t attr; | ||
225 | pthread_create(&th, 0, start_routine, 0); | ||
226 | pthread_join(th, 0); | ||
227 | pthread_attr_init(&attr); | ||
228 | pthread_cleanup_push(routine, 0); | ||
229 | pthread_cleanup_pop(0) /* ; */])], | ||
230 | [ax_pthread_ok=yes], | ||
231 | []) | ||
232 | |||
233 | LIBS="$save_LIBS" | ||
234 | CFLAGS="$save_CFLAGS" | ||
235 | |||
236 | AC_MSG_RESULT([$ax_pthread_ok]) | ||
237 | if test "x$ax_pthread_ok" = xyes; then | ||
238 | break; | ||
239 | fi | ||
240 | |||
241 | PTHREAD_LIBS="" | ||
242 | PTHREAD_CFLAGS="" | ||
243 | done | ||
244 | fi | ||
245 | |||
246 | # Various other checks: | ||
247 | if test "x$ax_pthread_ok" = xyes; then | ||
248 | save_LIBS="$LIBS" | ||
249 | LIBS="$PTHREAD_LIBS $LIBS" | ||
250 | save_CFLAGS="$CFLAGS" | ||
251 | CFLAGS="$CFLAGS $PTHREAD_CFLAGS" | ||
252 | |||
253 | # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. | ||
254 | AC_MSG_CHECKING([for joinable pthread attribute]) | ||
255 | attr_name=unknown | ||
256 | for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do | ||
257 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>], | ||
258 | [int attr = $attr; return attr /* ; */])], | ||
259 | [attr_name=$attr; break], | ||
260 | []) | ||
261 | done | ||
262 | AC_MSG_RESULT([$attr_name]) | ||
263 | if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then | ||
264 | AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name], | ||
265 | [Define to necessary symbol if this constant | ||
266 | uses a non-standard name on your system.]) | ||
267 | fi | ||
268 | |||
269 | AC_MSG_CHECKING([if more special flags are required for pthreads]) | ||
270 | flag=no | ||
271 | case ${host_os} in | ||
272 | aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; | ||
273 | osf* | hpux*) flag="-D_REENTRANT";; | ||
274 | solaris*) | ||
275 | if test "$GCC" = "yes"; then | ||
276 | flag="-D_REENTRANT" | ||
277 | else | ||
278 | # TODO: What about Clang on Solaris? | ||
279 | flag="-mt -D_REENTRANT" | ||
280 | fi | ||
281 | ;; | ||
282 | esac | ||
283 | AC_MSG_RESULT([$flag]) | ||
284 | if test "x$flag" != xno; then | ||
285 | PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" | ||
286 | fi | ||
287 | |||
288 | AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], | ||
289 | [ax_cv_PTHREAD_PRIO_INHERIT], [ | ||
290 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], | ||
291 | [[int i = PTHREAD_PRIO_INHERIT;]])], | ||
292 | [ax_cv_PTHREAD_PRIO_INHERIT=yes], | ||
293 | [ax_cv_PTHREAD_PRIO_INHERIT=no]) | ||
294 | ]) | ||
295 | AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"], | ||
296 | [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])]) | ||
297 | |||
298 | LIBS="$save_LIBS" | ||
299 | CFLAGS="$save_CFLAGS" | ||
300 | |||
301 | # More AIX lossage: compile with *_r variant | ||
302 | if test "x$GCC" != xyes; then | ||
303 | case $host_os in | ||
304 | aix*) | ||
305 | AS_CASE(["x/$CC"], | ||
306 | [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], | ||
307 | [#handle absolute path differently from PATH based program lookup | ||
308 | AS_CASE(["x$CC"], | ||
309 | [x/*], | ||
310 | [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], | ||
311 | [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) | ||
312 | ;; | ||
313 | esac | ||
314 | fi | ||
315 | fi | ||
316 | |||
317 | test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" | ||
318 | |||
319 | AC_SUBST([PTHREAD_LIBS]) | ||
320 | AC_SUBST([PTHREAD_CFLAGS]) | ||
321 | AC_SUBST([PTHREAD_CC]) | ||
322 | |||
323 | # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: | ||
324 | if test x"$ax_pthread_ok" = xyes; then | ||
325 | ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) | ||
326 | : | ||
327 | else | ||
328 | ax_pthread_ok=no | ||
329 | $2 | ||
330 | fi | ||
331 | AC_LANG_POP | ||
332 | ])dnl AX_PTHREAD | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/no-cmocka-configure-ac.diff b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/no-cmocka-configure-ac.diff new file mode 100644 index 0000000..9e5f2f5 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss/no-cmocka-configure-ac.diff | |||
@@ -0,0 +1,10 @@ | |||
1 | Index: TPM2.0-TSS/configure.ac | ||
2 | =================================================================== | ||
3 | --- TPM2.0-TSS.orig/configure.ac | ||
4 | +++ TPM2.0-TSS/configure.ac | ||
5 | @@ -11,5 +11,4 @@ AX_PTHREAD([], [AC_MSG_ERROR([requires p | ||
6 | AM_INIT_AUTOMAKE([foreign | ||
7 | subdir-objects]) | ||
8 | AC_CONFIG_FILES([Makefile]) | ||
9 | -PKG_CHECK_MODULES([CMOCKA],[cmocka]) | ||
10 | AC_OUTPUT | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss_git.bb b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss_git.bb new file mode 100644 index 0000000..cda3b30 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2.0-tss/tpm2.0-tss_git.bb | |||
@@ -0,0 +1,109 @@ | |||
1 | SUMMARY = "Software stack for TPM2." | ||
2 | DESCRIPTION = "tpm2.0-tss like woah." | ||
3 | SECTION = "tpm" | ||
4 | |||
5 | # This is a lie. The source for this project is covered by several licenses. | ||
6 | # We're currently working on a way to make this clear for those consuming the | ||
7 | # project. Till then I'm using 'BSD' as a place holder since the Intel license | ||
8 | # is "BSD-like". | ||
9 | LICENSE = "BSD" | ||
10 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD;md5=3775480a712fc46a69647678acb234cb" | ||
11 | |||
12 | # This doesn't seem to work. Keeping it here for completeness. Remove once | ||
13 | # it's fixed upstream. | ||
14 | DEPENDS += "autoconf-archive pkgconfig" | ||
15 | #RDEPENDS_libtss2 += "libmarshal" | ||
16 | #RDEPENDS_libtctidevice += "libmarshal" | ||
17 | |||
18 | SRC_URI = " \ | ||
19 | git://github.com/01org/TPM2.0-TSS.git;protocol=http;branch=1.x;name=TPM2.0-TSS;destsuffix=TPM2.0-TSS \ | ||
20 | " | ||
21 | |||
22 | # CAPS? SRSLY? | ||
23 | S = "${WORKDIR}/${@d.getVar('BPN',d).upper()}" | ||
24 | |||
25 | SRCREV = "1fa2f4d12449d5d639032fee28d922fe9d4877b5" | ||
26 | PV = "1.1.0+git${SRCPV}" | ||
27 | |||
28 | RRECOMMENDS_${PN} += "\ | ||
29 | kernel-module-tpm-crb \ | ||
30 | kernel-module-tpm-tis \ | ||
31 | " | ||
32 | |||
33 | TPM_DESCRIPTION = 'device/description' | ||
34 | FAMILY_MAJOR = 'TPM 2.0' | ||
35 | |||
36 | PACKAGES = " \ | ||
37 | ${PN}-dbg \ | ||
38 | libtss2 \ | ||
39 | libtss2-dev \ | ||
40 | libtss2-staticdev \ | ||
41 | libtss2-doc \ | ||
42 | libtctidevice \ | ||
43 | libtctidevice-dev \ | ||
44 | libtctidevice-staticdev \ | ||
45 | libtctisocket \ | ||
46 | libtctisocket-dev \ | ||
47 | libtctisocket-staticdev \ | ||
48 | libmarshal \ | ||
49 | libmarshal-dev \ | ||
50 | libmarshal-staticdev \ | ||
51 | " | ||
52 | |||
53 | FILES_libtss2 = "${libdir}/libsapi.so.*" | ||
54 | FILES_libtss2-dev = " \ | ||
55 | ${includedir}/sapi \ | ||
56 | ${includedir}/tcti/common.h \ | ||
57 | ${libdir}/libsapi.so \ | ||
58 | ${libdir}/pkgconfig/sapi.pc \ | ||
59 | ${libdir}/libsapi.la \ | ||
60 | " | ||
61 | FILES_libtss2-staticdev = " \ | ||
62 | ${libdir}/libsapi.a \ | ||
63 | " | ||
64 | FILES_libtss2-doc = " \ | ||
65 | ${mandir} \ | ||
66 | " | ||
67 | FILES_libtctidevice = "${libdir}/libtcti-device.so.*" | ||
68 | FILES_libtctidevice-dev = " \ | ||
69 | ${includedir}/tcti/tcti_device.h \ | ||
70 | ${libdir}/libtcti-device.so \ | ||
71 | ${libdir}/pkgconfig/tcti-device.pc \ | ||
72 | ${libdir}/libtcti-device.la \ | ||
73 | " | ||
74 | FILES_libtctidevice-staticdev = "${libdir}/libtcti-device.a" | ||
75 | FILES_libtctisocket = "${libdir}/libtcti-socket.so.*" | ||
76 | FILES_libtctisocket-dev = " \ | ||
77 | ${includedir}/tcti/tcti_socket.h \ | ||
78 | ${libdir}/libtcti-socket.so \ | ||
79 | ${libdir}/pkgconfig/tcti-socket.pc \ | ||
80 | ${libdir}/libtcti-socket.la \ | ||
81 | " | ||
82 | FILES_libtctisocket-staticdev = "${libdir}/libtcti-socket.a" | ||
83 | FILES_libmarshal = "${libdir}/libmarshal.so.*" | ||
84 | FILES_libmarshal-dev = "${libdir}/libmarshal.la ${libdir}/libmarshal.so" | ||
85 | FILES_libmarshal-staticdev = "${libdir}/libmarshal.a" | ||
86 | |||
87 | inherit autotools | ||
88 | |||
89 | # the autotools / autoconf-archive don't work as expected so we include the | ||
90 | # pthread macro ourselves for now | ||
91 | SRC_URI += " \ | ||
92 | file://ax_pthread.m4 \ | ||
93 | file://ax_check_compile_flag.m4 \ | ||
94 | file://ax_check_preproc_flag.m4 \ | ||
95 | file://ax_check_link_flag.m4 \ | ||
96 | " | ||
97 | do_configure_prepend () { | ||
98 | mkdir -p ${S}/m4 | ||
99 | cp ${WORKDIR}/ax_pthread.m4 ${S}/m4 | ||
100 | cp ${WORKDIR}/ax_check_compile_flag.m4 ${S}/m4 | ||
101 | cp ${WORKDIR}/ax_check_preproc_flag.m4 ${S}/m4 | ||
102 | cp ${WORKDIR}/ax_check_link_flag.m4 ${S}/m4 | ||
103 | # execute the bootstrap script | ||
104 | currentdir=$(pwd) | ||
105 | cd ${S} | ||
106 | ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" ./bootstrap --force | ||
107 | cd ${currentdir} | ||
108 | } | ||
109 | |||