tpm2-tcti-uefi: fix build issue for i386 machine

Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Armin Kuster
2020-02-02 20:31:35 +00:00
parent f2e9e8f96f
commit e87130f429
4 changed files with 77 additions and 12 deletions

View File

@@ -0,0 +1,25 @@
Error building for i386 target in cross env
#include <efi/x86_64/efibind.h>
ARCH is host arch, not target arch
Upstream-Status: Submitted
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Index: git/src/uefi-types.h
===================================================================
--- git.orig/src/uefi-types.h
+++ git/src/uefi-types.h
@@ -3,9 +3,9 @@
#define UEFI_TYPES_H
#ifndef EDK2_BUILD
-#if ARCH == x86_64
+#if defined(__x86_64__)
#include <efi/x86_64/efibind.h>
-#elif ARCH == ia32
+#elif defined(__i386__)
#include <efi/ia32/efibind.h>
#else
#error "Unsupported ARCH."

View File

@@ -0,0 +1,23 @@
Fix defined to match tpm2-tools 4.1.1
Upstream-Status: Submitted https://github.com/tpm2-software/tpm2-tcti-uefi/pull/81
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Index: git/example/tpm2-get-caps-fixed.c
===================================================================
--- git.orig/example/tpm2-get-caps-fixed.c
+++ git/example/tpm2-get-caps-fixed.c
@@ -140,11 +140,11 @@ dump_tpm_properties_fixed (TPMS_TAGGED_P
Print (L"TPM2_PT_INPUT_BUFFER:\n"
" value: 0x%X\n", value);
break;
- case TPM2_PT_HR_TRANSIENT_MIN:
+ case TPM2_PT_TPM2_HR_TRANSIENT_MIN:
Print (L"TPM2_PT_TPM2_HR_TRANSIENT_MIN:\n"
" value: 0x%X\n", value);
break;
- case TPM2_PT_HR_PERSISTENT_MIN:
+ case TPM2_PT_TPM2_HR_PERSISTENT_MIN:
Print (L"TPM2_PT_TPM2_HR_PERSISTENT_MIN:\n"
" value: 0x%X\n", value);
break;

View File

@@ -16,7 +16,18 @@ Index: git/configure.ac
===================================================================
--- git.orig/configure.ac
+++ git/configure.ac
@@ -81,7 +81,7 @@ AC_ARG_WITH([efi-lds],
@@ -70,10 +70,6 @@ EXTRA_CFLAGS+="-I${with_efi_includedir}
# compiler flags / search path
CFLAGS_TMP="$CFLAGS"
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
-AC_CHECK_HEADERS([efi.h efilib.h],
- [],
- [AC_MSG_ERROR([Missing gnu-efi headers.])],
- [#include <efi.h>])
CFLAGS="$CFLAGS_TMP"
# path to linker script from gnu-efi
@@ -81,7 +77,7 @@ AC_ARG_WITH([efi-lds],
AS_HELP_STRING([--with-efi-lds=LDS_PATH],[Path to gnu-efi lds file.]),
[],
[with_efi_lds="/usr/lib/elf_${ARCH}_efi.lds"])

View File

@@ -2,13 +2,15 @@ SUMMARY = "TCTI module for use with TSS2 libraries in UEFI environment"
SECTION = "security/tpm"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=500b2e742befc3da00684d8a1d5fd9da"
DEPENDS = "libtss2-dev gnu-efi-native gnu-efi pkgconfig autoconf-archive-native"
DEPENDS = "libtss2-dev libtss2-mu-dev gnu-efi-native gnu-efi pkgconfig autoconf-archive-native"
SRC_URI = "git://github.com/tpm2-software/tpm2-tcti-uefi.git \
file://configure_oe_fixup.patch \
file://0001-configure.ac-stop-inserting-host-directories-into-co.patch \
file://tpm2-get-caps-fixed.patch \
file://fix_header_file.patch \
"
SRCREV = "431c85f45dcdca5da003ed47c6e9814282476938"
SRCREV = "0241b08f069f0fdb3612f5c1b938144dbe9be811"
S = "${WORKDIR}/git"
@@ -16,6 +18,17 @@ inherit autotools pkgconfig
EFIDIR ?= "/EFI/BOOT"
EFI_ARCH_x86 = "ia32"
EFI_ARCH_x86-64 = "x86_64"
CFLAGS_append = " -I${STAGING_INCDIR}/efi -I${STAGING_INCDIR}/efi/${EFI_ARCH}"
EXTRA_OECONF_append = " \
--with-efi-includedir=${STAGING_INCDIR} \
--with-efi-crt0=${STAGING_LIBDIR}/crt0-efi-${EFI_ARCH}.o \
--with-efi-lds=${STAGING_LIBDIR}/elf_${EFI_ARCH}_efi.lds \
"
do_compile_append() {
oe_runmake example
}
@@ -25,15 +38,8 @@ do_install_append() {
install -m 0755 "${B}"/example/*.efi "${D}${EFIDIR}"
}
EFI_ARCH_x86 = "ia32"
EFI_ARCH_x86-64 = "x86_64"
COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
EXTRA_OECONF_append = "\
--with-efi-includedir=${STAGING_INCDIR}/efi \
--with-efi-crt0=${STAGING_LIBDIR_NATIVE}/crt0-efi-${EFI_ARCH}.o \
--with-efi-lds=${STAGING_LIBDIR_NATIVE}/elf_${EFI_ARCH}_efi.lds \
"
RDEPENDS_${PN} = "gnu-efi"
FILES_${PN} += "${EFIDIR}"
RDEPENDS_${PN} = "gnu-efi libtss2-mu"