tpm2.0-tools: update to the latest and code style fixup

Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
This commit is contained in:
Lans Zhang
2017-07-20 15:21:04 +08:00
parent e874405319
commit e8aee2ab91
3 changed files with 31 additions and 43 deletions

View File

@@ -1,7 +1,7 @@
From 53f9b2f63c5370f4d269bf08d940cc8576fcbbf4 Mon Sep 17 00:00:00 2001 From 1f8d526bad6a0317bde32a0278fbabe2492e7c62 Mon Sep 17 00:00:00 2001
From: Lans Zhang <jia.zhang@windriver.com> From: Lans Zhang <jia.zhang@windriver.com>
Date: Mon, 19 Jun 2017 13:54:34 +0800 Date: Thu, 20 Jul 2017 14:51:34 +0800
Subject: [PATCH 2/2] Fix build failure with glib-2.0 Subject: [PATCH] Fix build failure with glib-2.0
Signed-off-by: Lans Zhang <jia.zhang@windriver.com> Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
--- ---
@@ -10,20 +10,20 @@ Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
2 files changed, 2 insertions(+), 1 deletion(-) 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am diff --git a/Makefile.am b/Makefile.am
index 68ba044..e792049 100644 index c40c24b..2f4fa3e 100644
--- a/Makefile.am --- a/Makefile.am
+++ b/Makefile.am +++ b/Makefile.am
@@ -35,7 +35,7 @@ ACLOCAL_AMFLAGS = -I m4 @@ -35,7 +35,7 @@ ACLOCAL_AMFLAGS = -I m4
INCLUDE_DIRS = -I$(srcdir)/src -I$(srcdir)/lib INCLUDE_DIRS = -I$(srcdir)/src -I$(srcdir)/lib
LIB_COMMON := lib/libcommon.a LIB_COMMON := lib/libcommon.a
-AM_CFLAGS := $(INCLUDE_DIRS) $(TPM20_TSS_CFLAGS) $(EXTRA_CFLAGS) $(TCTI_TABRMD_CFLAGS) -AM_CFLAGS := $(INCLUDE_DIRS) $(TPM20_TSS_CFLAGS) $(EXTRA_CFLAGS) $(TCTI_TABRMD_CFLAGS) $(CRYPTO_CFLAGS)
+AM_CFLAGS := $(INCLUDE_DIRS) $(GLIB_CFLAGS) $(TPM20_TSS_CFLAGS) $(EXTRA_CFLAGS) $(TCTI_TABRMD_CFLAGS) +AM_CFLAGS := $(INCLUDE_DIRS) $(GLIB_CFLAGS) $(TPM20_TSS_CFLAGS) $(EXTRA_CFLAGS) $(TCTI_TABRMD_CFLAGS) $(CRYPTO_CFLAGS)
AM_LDFLAGS := $(EXTRA_LDFLAGS) AM_LDFLAGS := $(EXTRA_LDFLAGS)
LDADD = $(LIB_COMMON) $(TPM20_TSS_LIBS) $(TCTI_SOCK_LIBS) $(TCTI_DEV_LIBS) $(TCTI_TABRMD_LIBS) -ldl LDADD = $(LIB_COMMON) $(TPM20_TSS_LIBS) $(TCTI_SOCK_LIBS) $(TCTI_DEV_LIBS) $(TCTI_TABRMD_LIBS) $(CRYPTO_LIBS)
diff --git a/configure.ac b/configure.ac diff --git a/configure.ac b/configure.ac
index ce781ea..08fa81c 100644 index 8ef3b17..8db6922 100644
--- a/configure.ac --- a/configure.ac
+++ b/configure.ac +++ b/configure.ac
@@ -6,6 +6,7 @@ LT_INIT @@ -6,6 +6,7 @@ LT_INIT

View File

@@ -1,32 +1,18 @@
From 9aee7b2bc400a336f0a938ce80eba51707662612 Mon Sep 17 00:00:00 2001 From b328bb108cc926274ca20cc722d8d8ad91f19d60 Mon Sep 17 00:00:00 2001
From: Lans Zhang <jia.zhang@windriver.com> From: Lans Zhang <jia.zhang@windriver.com>
Date: Mon, 19 Jun 2017 13:52:53 +0800 Date: Thu, 20 Jul 2017 15:19:51 +0800
Subject: [PATCH 1/2] tpm2-tools: use dynamic linkage with tpm2-abrmd Subject: [PATCH] tpm2-tools: use dynamic linkage with tpm2-abrmd
tpm2-abrmd has huge dependencies and they are not necessary to be involved tpm2-abrmd has huge dependencies and they are not necessary to be involved
in initramfs. in initramfs.
Signed-off-by: Lans Zhang <jia.zhang@windriver.com> Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
--- ---
Makefile.am | 2 +- lib/context-util.c | 21 +++++++++++++++++++--
lib/context-util.c | 22 ++++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index a3c43f8..68ba044 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,7 +38,7 @@ LIB_COMMON := lib/libcommon.a
AM_CFLAGS := $(INCLUDE_DIRS) $(TPM20_TSS_CFLAGS) $(EXTRA_CFLAGS) $(TCTI_TABRMD_CFLAGS)
AM_LDFLAGS := $(EXTRA_LDFLAGS)
-LDADD = $(LIB_COMMON) $(TPM20_TSS_LIBS) $(TCTI_SOCK_LIBS) $(TCTI_DEV_LIBS) $(TCTI_TABRMD_LIBS)
+LDADD = $(LIB_COMMON) $(TPM20_TSS_LIBS) $(TCTI_SOCK_LIBS) $(TCTI_DEV_LIBS) $(TCTI_TABRMD_LIBS) -ldl
sbin_PROGRAMS = \
tools/tpm2_create \
diff --git a/lib/context-util.c b/lib/context-util.c diff --git a/lib/context-util.c b/lib/context-util.c
index 7de22ac..2ef181d 100644 index 7de22ac..9814548 100644
--- a/lib/context-util.c --- a/lib/context-util.c
+++ b/lib/context-util.c +++ b/lib/context-util.c
@@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
@@ -37,7 +23,7 @@ index 7de22ac..2ef181d 100644
#include <tcti/tcti-tabrmd.h> #include <tcti/tcti-tabrmd.h>
#endif #endif
@@ -134,10 +135,27 @@ TSS2_TCTI_CONTEXT* @@ -134,10 +135,26 @@ TSS2_TCTI_CONTEXT*
tcti_tabrmd_init (void) tcti_tabrmd_init (void)
{ {
TSS2_TCTI_CONTEXT *tcti_ctx; TSS2_TCTI_CONTEXT *tcti_ctx;
@@ -53,8 +39,7 @@ index 7de22ac..2ef181d 100644
- rc = tss2_tcti_tabrmd_init(NULL, &size); - rc = tss2_tcti_tabrmd_init(NULL, &size);
+ tabrmd_handle = dlopen("libtcti-tabrmd.so.0", RTLD_LAZY); + tabrmd_handle = dlopen("libtcti-tabrmd.so.0", RTLD_LAZY);
+ if (!tabrmd_handle) { + if (!tabrmd_handle) {
+ fprintf (stderr, + LOG_ERR ("Unable to find out the tabrmd tcti library");
+ "Unable to find out the tabrmd tcti library\n");
+ return NULL; + return NULL;
+ } + }
+ +
@@ -66,7 +51,7 @@ index 7de22ac..2ef181d 100644
if (rc != TSS2_RC_SUCCESS) { if (rc != TSS2_RC_SUCCESS) {
LOG_ERR ("Failed to get size for TABRMD TCTI context: 0x%" PRIx32, rc); LOG_ERR ("Failed to get size for TABRMD TCTI context: 0x%" PRIx32, rc);
return NULL; return NULL;
@@ -148,7 +166,7 @@ tcti_tabrmd_init (void) @@ -148,7 +165,7 @@ tcti_tabrmd_init (void)
strerror (errno)); strerror (errno));
return NULL; return NULL;
} }

View File

@@ -1,36 +1,37 @@
SUMMARY = "Tools for TPM2." SUMMARY = "Tools for TPM2."
DESCRIPTION = "tpm2.0-tools" DESCRIPTION = "tpm2.0-tools"
SECTION = "tpm" SECTION = "security/tpm"
LICENSE = "BSD" LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=91b7c548d73ea16537799e8060cea819" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=91b7c548d73ea16537799e8060cea819"
DEPENDS += "tpm2.0-tss tpm2-abrmd openssl curl autoconf-archive pkgconfig" DEPENDS += "tpm2.0-tss tpm2-abrmd openssl curl autoconf-archive pkgconfig"
RDEPENDS_${PN} += "libtss2 libtctidevice"
SRC_URI = " \ PV = "2.1.0+git${SRCPV}"
SRC_URI = "\
git://github.com/01org/tpm2.0-tools.git;branch=master;name=tpm2.0-tools;destsuffix=tpm2.0-tools \ git://github.com/01org/tpm2.0-tools.git;branch=master;name=tpm2.0-tools;destsuffix=tpm2.0-tools \
file://ax_check_compile_flag.m4 \ file://ax_check_compile_flag.m4 \
file://ax_check_preproc_flag.m4 \ file://ax_check_preproc_flag.m4 \
file://ax_check_link_flag.m4 \ file://ax_check_link_flag.m4 \
file://0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch \ file://0001-Fix-build-failure-with-glib-2.0.patch \
file://0002-Fix-build-failure-with-glib-2.0.patch \ file://0002-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch \
" "
SRCREV = "97306d6dc1fc5f3142c50efe3189bd46ff35b5a0"
S = "${WORKDIR}/${BPN}" S = "${WORKDIR}/${BPN}"
SRCREV = "ada4c20d23d99b4b489c6c793e4132c1d5234b66"
PV = "2.0.0+git${SRCPV}"
inherit autotools pkgconfig inherit autotools pkgconfig
EXTRA_OECONF += " \ EXTRA_OECONF += "\
--with-tcti-device \ --with-tcti-device \
--without-tcti-socket \ --without-tcti-socket \
--with-tcti-tabrmd \ --with-tcti-tabrmd \
" "
EXTRA_OEMAKE += " \ EXTRA_OEMAKE += "\
CFLAGS="${CFLAGS} -Wno-implicit-fallthrough" \ CFLAGS="${CFLAGS} -Wno-implicit-fallthrough" \
LIBS=-ldl \
" "
do_configure_prepend() { do_configure_prepend() {
@@ -40,9 +41,11 @@ do_configure_prepend() {
cp "${WORKDIR}/ax_check_link_flag.m4" "${S}/m4" cp "${WORKDIR}/ax_check_link_flag.m4" "${S}/m4"
# execute the bootstrap script # execute the bootstrap script
currentdir=$(pwd) currentdir="$(pwd)"
cd "${S}" cd "${S}"
ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" \ ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" \
./bootstrap --force ./bootstrap --force
cd "${currentdir}" cd "${currentdir}"
} }
RDEPENDS_${PN} += "libtss2 libtctidevice"