From e8aee2ab910672ac4ef3dcc8d31ca87511762b0b Mon Sep 17 00:00:00 2001 From: Lans Zhang Date: Thu, 20 Jul 2017 15:21:04 +0800 Subject: [PATCH] tpm2.0-tools: update to the latest and code style fixup Signed-off-by: Lans Zhang --- ...001-Fix-build-failure-with-glib-2.0.patch} | 16 ++++----- ...use-dynamic-linkage-with-tpm2-abrmd.patch} | 35 ++++++------------- .../tpm2.0-tools/tpm2.0-tools_git.bb | 23 ++++++------ 3 files changed, 31 insertions(+), 43 deletions(-) rename meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/{0002-Fix-build-failure-with-glib-2.0.patch => 0001-Fix-build-failure-with-glib-2.0.patch} (72%) rename meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/{0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch => 0002-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch} (59%) 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/0001-Fix-build-failure-with-glib-2.0.patch similarity index 72% rename from meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0002-Fix-build-failure-with-glib-2.0.patch rename to meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0001-Fix-build-failure-with-glib-2.0.patch index faeaf2a..80aaa0d 100644 --- 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/0001-Fix-build-failure-with-glib-2.0.patch @@ -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 -Date: Mon, 19 Jun 2017 13:54:34 +0800 -Subject: [PATCH 2/2] Fix build failure with glib-2.0 +Date: Thu, 20 Jul 2017 14:51:34 +0800 +Subject: [PATCH] Fix build failure with glib-2.0 Signed-off-by: Lans Zhang --- @@ -10,20 +10,20 @@ Signed-off-by: Lans Zhang 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am -index 68ba044..e792049 100644 +index c40c24b..2f4fa3e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ ACLOCAL_AMFLAGS = -I m4 INCLUDE_DIRS = -I$(srcdir)/src -I$(srcdir)/lib LIB_COMMON := lib/libcommon.a --AM_CFLAGS := $(INCLUDE_DIRS) $(TPM20_TSS_CFLAGS) $(EXTRA_CFLAGS) $(TCTI_TABRMD_CFLAGS) -+AM_CFLAGS := $(INCLUDE_DIRS) $(GLIB_CFLAGS) $(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) $(CRYPTO_CFLAGS) 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 -index ce781ea..08fa81c 100644 +index 8ef3b17..8db6922 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,7 @@ LT_INIT 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/0002-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch similarity index 59% rename from meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch rename to meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0002-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch index 8d91ca0..994a25a 100644 --- 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/0002-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch @@ -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 -Date: Mon, 19 Jun 2017 13:52:53 +0800 -Subject: [PATCH 1/2] tpm2-tools: use dynamic linkage with tpm2-abrmd +Date: Thu, 20 Jul 2017 15:19:51 +0800 +Subject: [PATCH] tpm2-tools: use dynamic linkage with tpm2-abrmd tpm2-abrmd has huge dependencies and they are not necessary to be involved in initramfs. Signed-off-by: Lans Zhang --- - Makefile.am | 2 +- - lib/context-util.c | 22 ++++++++++++++++++++-- - 2 files changed, 21 insertions(+), 3 deletions(-) + lib/context-util.c | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 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 -index 7de22ac..2ef181d 100644 +index 7de22ac..9814548 100644 --- a/lib/context-util.c +++ b/lib/context-util.c @@ -38,6 +38,7 @@ @@ -37,7 +23,7 @@ index 7de22ac..2ef181d 100644 #include #endif -@@ -134,10 +135,27 @@ TSS2_TCTI_CONTEXT* +@@ -134,10 +135,26 @@ TSS2_TCTI_CONTEXT* tcti_tabrmd_init (void) { TSS2_TCTI_CONTEXT *tcti_ctx; @@ -53,9 +39,8 @@ index 7de22ac..2ef181d 100644 - rc = tss2_tcti_tabrmd_init(NULL, &size); + tabrmd_handle = dlopen("libtcti-tabrmd.so.0", RTLD_LAZY); + if (!tabrmd_handle) { -+ fprintf (stderr, -+ "Unable to find out the tabrmd tcti library\n"); -+ return NULL; ++ LOG_ERR ("Unable to find out the tabrmd tcti library"); ++ return NULL; + } + + init = dlsym(tabrmd_handle, "tss2_tcti_tabrmd_init"); @@ -66,7 +51,7 @@ index 7de22ac..2ef181d 100644 if (rc != TSS2_RC_SUCCESS) { LOG_ERR ("Failed to get size for TABRMD TCTI context: 0x%" PRIx32, rc); return NULL; -@@ -148,7 +166,7 @@ tcti_tabrmd_init (void) +@@ -148,7 +165,7 @@ tcti_tabrmd_init (void) strerror (errno)); return NULL; } 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 index a914c3b..7135fd6 100644 --- 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 @@ -1,36 +1,37 @@ SUMMARY = "Tools for TPM2." DESCRIPTION = "tpm2.0-tools" -SECTION = "tpm" +SECTION = "security/tpm" LICENSE = "BSD" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=91b7c548d73ea16537799e8060cea819" 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 \ file://ax_check_compile_flag.m4 \ file://ax_check_preproc_flag.m4 \ file://ax_check_link_flag.m4 \ - file://0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch \ - file://0002-Fix-build-failure-with-glib-2.0.patch \ + file://0001-Fix-build-failure-with-glib-2.0.patch \ + file://0002-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch \ " +SRCREV = "97306d6dc1fc5f3142c50efe3189bd46ff35b5a0" S = "${WORKDIR}/${BPN}" -SRCREV = "ada4c20d23d99b4b489c6c793e4132c1d5234b66" -PV = "2.0.0+git${SRCPV}" inherit autotools pkgconfig -EXTRA_OECONF += " \ +EXTRA_OECONF += "\ --with-tcti-device \ --without-tcti-socket \ --with-tcti-tabrmd \ " -EXTRA_OEMAKE += " \ +EXTRA_OEMAKE += "\ CFLAGS="${CFLAGS} -Wno-implicit-fallthrough" \ + LIBS=-ldl \ " do_configure_prepend() { @@ -40,9 +41,11 @@ do_configure_prepend() { cp "${WORKDIR}/ax_check_link_flag.m4" "${S}/m4" # execute the bootstrap script - currentdir=$(pwd) + currentdir="$(pwd)" cd "${S}" ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" \ ./bootstrap --force cd "${currentdir}" } + +RDEPENDS_${PN} += "libtss2 libtctidevice"