diff options
author | Armin Kuster <akuster808@gmail.com> | 2020-02-02 20:31:35 +0000 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2020-02-10 19:13:52 -0800 |
commit | e87130f429b706465bc6d287b8881adf0cc21f18 (patch) | |
tree | 017232f26e41ac66d0fda6b37c69b2e566cbe00b | |
parent | f2e9e8f96f5a360ecfefa746842214891fd3bd33 (diff) | |
download | meta-security-e87130f429b706465bc6d287b8881adf0cc21f18.tar.gz |
tpm2-tcti-uefi: fix build issue for i386 machine
Signed-off-by: Armin Kuster <akuster808@gmail.com>
4 files changed, 77 insertions, 12 deletions
diff --git a/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/files/fix_header_file.patch b/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/files/fix_header_file.patch new file mode 100644 index 0000000..fc730e1 --- /dev/null +++ b/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/files/fix_header_file.patch | |||
@@ -0,0 +1,25 @@ | |||
1 | Error building for i386 target in cross env | ||
2 | |||
3 | #include <efi/x86_64/efibind.h> | ||
4 | |||
5 | ARCH is host arch, not target arch | ||
6 | |||
7 | Upstream-Status: Submitted | ||
8 | |||
9 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
10 | Index: git/src/uefi-types.h | ||
11 | =================================================================== | ||
12 | --- git.orig/src/uefi-types.h | ||
13 | +++ git/src/uefi-types.h | ||
14 | @@ -3,9 +3,9 @@ | ||
15 | #define UEFI_TYPES_H | ||
16 | |||
17 | #ifndef EDK2_BUILD | ||
18 | -#if ARCH == x86_64 | ||
19 | +#if defined(__x86_64__) | ||
20 | #include <efi/x86_64/efibind.h> | ||
21 | -#elif ARCH == ia32 | ||
22 | +#elif defined(__i386__) | ||
23 | #include <efi/ia32/efibind.h> | ||
24 | #else | ||
25 | #error "Unsupported ARCH." | ||
diff --git a/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/files/tpm2-get-caps-fixed.patch b/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/files/tpm2-get-caps-fixed.patch new file mode 100644 index 0000000..bc70913 --- /dev/null +++ b/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/files/tpm2-get-caps-fixed.patch | |||
@@ -0,0 +1,23 @@ | |||
1 | Fix defined to match tpm2-tools 4.1.1 | ||
2 | |||
3 | Upstream-Status: Submitted https://github.com/tpm2-software/tpm2-tcti-uefi/pull/81 | ||
4 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
5 | |||
6 | Index: git/example/tpm2-get-caps-fixed.c | ||
7 | =================================================================== | ||
8 | --- git.orig/example/tpm2-get-caps-fixed.c | ||
9 | +++ git/example/tpm2-get-caps-fixed.c | ||
10 | @@ -140,11 +140,11 @@ dump_tpm_properties_fixed (TPMS_TAGGED_P | ||
11 | Print (L"TPM2_PT_INPUT_BUFFER:\n" | ||
12 | " value: 0x%X\n", value); | ||
13 | break; | ||
14 | - case TPM2_PT_HR_TRANSIENT_MIN: | ||
15 | + case TPM2_PT_TPM2_HR_TRANSIENT_MIN: | ||
16 | Print (L"TPM2_PT_TPM2_HR_TRANSIENT_MIN:\n" | ||
17 | " value: 0x%X\n", value); | ||
18 | break; | ||
19 | - case TPM2_PT_HR_PERSISTENT_MIN: | ||
20 | + case TPM2_PT_TPM2_HR_PERSISTENT_MIN: | ||
21 | Print (L"TPM2_PT_TPM2_HR_PERSISTENT_MIN:\n" | ||
22 | " value: 0x%X\n", value); | ||
23 | break; | ||
diff --git a/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/tpm2-tcti-uefi/0001-configure.ac-stop-inserting-host-directories-into-co.patch b/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/tpm2-tcti-uefi/0001-configure.ac-stop-inserting-host-directories-into-co.patch index 3b54ddd..b3f2287 100644 --- a/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/tpm2-tcti-uefi/0001-configure.ac-stop-inserting-host-directories-into-co.patch +++ b/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/tpm2-tcti-uefi/0001-configure.ac-stop-inserting-host-directories-into-co.patch | |||
@@ -16,7 +16,18 @@ Index: git/configure.ac | |||
16 | =================================================================== | 16 | =================================================================== |
17 | --- git.orig/configure.ac | 17 | --- git.orig/configure.ac |
18 | +++ git/configure.ac | 18 | +++ git/configure.ac |
19 | @@ -81,7 +81,7 @@ AC_ARG_WITH([efi-lds], | 19 | @@ -70,10 +70,6 @@ EXTRA_CFLAGS+="-I${with_efi_includedir} |
20 | # compiler flags / search path | ||
21 | CFLAGS_TMP="$CFLAGS" | ||
22 | CFLAGS="$CFLAGS $EXTRA_CFLAGS" | ||
23 | -AC_CHECK_HEADERS([efi.h efilib.h], | ||
24 | - [], | ||
25 | - [AC_MSG_ERROR([Missing gnu-efi headers.])], | ||
26 | - [#include <efi.h>]) | ||
27 | CFLAGS="$CFLAGS_TMP" | ||
28 | |||
29 | # path to linker script from gnu-efi | ||
30 | @@ -81,7 +77,7 @@ AC_ARG_WITH([efi-lds], | ||
20 | AS_HELP_STRING([--with-efi-lds=LDS_PATH],[Path to gnu-efi lds file.]), | 31 | AS_HELP_STRING([--with-efi-lds=LDS_PATH],[Path to gnu-efi lds file.]), |
21 | [], | 32 | [], |
22 | [with_efi_lds="/usr/lib/elf_${ARCH}_efi.lds"]) | 33 | [with_efi_lds="/usr/lib/elf_${ARCH}_efi.lds"]) |
diff --git a/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/tpm2-tcti-uefi_0.9.9.bb b/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/tpm2-tcti-uefi_0.9.9.bb index f4918ec..67b36b7 100644 --- a/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/tpm2-tcti-uefi_0.9.9.bb +++ b/meta-tpm/recipes-tpm2/tpm2-tcti-uefi/tpm2-tcti-uefi_0.9.9.bb | |||
@@ -2,13 +2,15 @@ SUMMARY = "TCTI module for use with TSS2 libraries in UEFI environment" | |||
2 | SECTION = "security/tpm" | 2 | SECTION = "security/tpm" |
3 | LICENSE = "BSD-2-Clause" | 3 | LICENSE = "BSD-2-Clause" |
4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=500b2e742befc3da00684d8a1d5fd9da" | 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=500b2e742befc3da00684d8a1d5fd9da" |
5 | DEPENDS = "libtss2-dev gnu-efi-native gnu-efi pkgconfig autoconf-archive-native" | 5 | DEPENDS = "libtss2-dev libtss2-mu-dev gnu-efi-native gnu-efi pkgconfig autoconf-archive-native" |
6 | 6 | ||
7 | SRC_URI = "git://github.com/tpm2-software/tpm2-tcti-uefi.git \ | 7 | SRC_URI = "git://github.com/tpm2-software/tpm2-tcti-uefi.git \ |
8 | file://configure_oe_fixup.patch \ | 8 | file://configure_oe_fixup.patch \ |
9 | file://0001-configure.ac-stop-inserting-host-directories-into-co.patch \ | 9 | file://0001-configure.ac-stop-inserting-host-directories-into-co.patch \ |
10 | file://tpm2-get-caps-fixed.patch \ | ||
11 | file://fix_header_file.patch \ | ||
10 | " | 12 | " |
11 | SRCREV = "431c85f45dcdca5da003ed47c6e9814282476938" | 13 | SRCREV = "0241b08f069f0fdb3612f5c1b938144dbe9be811" |
12 | 14 | ||
13 | S = "${WORKDIR}/git" | 15 | S = "${WORKDIR}/git" |
14 | 16 | ||
@@ -16,6 +18,17 @@ inherit autotools pkgconfig | |||
16 | 18 | ||
17 | EFIDIR ?= "/EFI/BOOT" | 19 | EFIDIR ?= "/EFI/BOOT" |
18 | 20 | ||
21 | EFI_ARCH_x86 = "ia32" | ||
22 | EFI_ARCH_x86-64 = "x86_64" | ||
23 | |||
24 | CFLAGS_append = " -I${STAGING_INCDIR}/efi -I${STAGING_INCDIR}/efi/${EFI_ARCH}" | ||
25 | |||
26 | EXTRA_OECONF_append = " \ | ||
27 | --with-efi-includedir=${STAGING_INCDIR} \ | ||
28 | --with-efi-crt0=${STAGING_LIBDIR}/crt0-efi-${EFI_ARCH}.o \ | ||
29 | --with-efi-lds=${STAGING_LIBDIR}/elf_${EFI_ARCH}_efi.lds \ | ||
30 | " | ||
31 | |||
19 | do_compile_append() { | 32 | do_compile_append() { |
20 | oe_runmake example | 33 | oe_runmake example |
21 | } | 34 | } |
@@ -25,15 +38,8 @@ do_install_append() { | |||
25 | install -m 0755 "${B}"/example/*.efi "${D}${EFIDIR}" | 38 | install -m 0755 "${B}"/example/*.efi "${D}${EFIDIR}" |
26 | } | 39 | } |
27 | 40 | ||
28 | EFI_ARCH_x86 = "ia32" | ||
29 | EFI_ARCH_x86-64 = "x86_64" | ||
30 | |||
31 | COMPATIBLE_HOST = "(i.86|x86_64).*-linux" | 41 | COMPATIBLE_HOST = "(i.86|x86_64).*-linux" |
32 | EXTRA_OECONF_append = "\ | ||
33 | --with-efi-includedir=${STAGING_INCDIR}/efi \ | ||
34 | --with-efi-crt0=${STAGING_LIBDIR_NATIVE}/crt0-efi-${EFI_ARCH}.o \ | ||
35 | --with-efi-lds=${STAGING_LIBDIR_NATIVE}/elf_${EFI_ARCH}_efi.lds \ | ||
36 | " | ||
37 | RDEPENDS_${PN} = "gnu-efi" | ||
38 | 42 | ||
39 | FILES_${PN} += "${EFIDIR}" | 43 | FILES_${PN} += "${EFIDIR}" |
44 | |||
45 | RDEPENDS_${PN} = "gnu-efi libtss2-mu" | ||