From cba49f2deab481045408d5452ac8c84fc03bccd5 Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Thu, 6 Apr 2017 14:12:11 +0100 Subject: [PATCH 1/3] build-sys: correctly search for gnu-efi header When the user provides the --with-efi-includedir we incorrectly search for the header at /usr/include not the provided location. This patch changes the check to use the provided value so that non-standard header locations are supported. This situation occurs commonly when cross-compiling systemd because the GNU EFI headers and library will not be installed into the root locations but highly likely a temporary system root. --- configure.ac | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 3835413ad5..a95e984375 100644 --- a/configure.ac +++ b/configure.ac @@ -1306,7 +1306,13 @@ AC_SUBST([EFI_MACHINE_TYPE_NAME]) have_gnuefi=no AC_ARG_ENABLE(gnuefi, AS_HELP_STRING([--enable-gnuefi], [enable optional gnuefi support])) AS_IF([test "x$enable_gnuefi" != "xno"], [ - AC_CHECK_HEADERS(efi/${EFI_ARCH}/efibind.h, + AC_ARG_WITH(efi-includedir, + AS_HELP_STRING([--with-efi-includedir=PATH], [path to EFI include directory]), + [EFI_INC_DIR="$withval"], [EFI_INC_DIR="/usr/include"] + ) + AC_SUBST([EFI_INC_DIR]) + + AC_CHECK_HEADERS(${EFI_INC_DIR}/efi/${EFI_ARCH}/efibind.h, [AC_DEFINE(HAVE_GNUEFI, 1, [Define if gnuefi is available]) have_gnuefi=yes], [AS_IF([test "x$enable_gnuefi" = xyes], @@ -1335,12 +1341,6 @@ AS_IF([test "x$enable_gnuefi" != "xno"], [ [AS_IF([test "x$enable_gnuefi" = xyes], [AC_MSG_ERROR([*** gnuefi support requested but files not found])], [have_gnuefi=no])]) - - AC_ARG_WITH(efi-includedir, - AS_HELP_STRING([--with-efi-includedir=PATH], [path to EFI include directory]), - [EFI_INC_DIR="$withval"], [EFI_INC_DIR="/usr/include"] - ) - AC_SUBST([EFI_INC_DIR]) ]) AM_CONDITIONAL(HAVE_GNUEFI, [test "x$have_gnuefi" = xyes]) From cf8e2953b56281e7008a8757340801d427c994e9 Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Thu, 6 Apr 2017 14:12:15 +0100 Subject: [PATCH 2/3] build-sys: correct ARM32 GNU EFI boot binary build Due to ARM not having an EFI capable objcopy we need to use the binary output argument. This is correctly set up for AArch64 but is missed when building for ARM32. This patch adds the ARCH_ARM automake define which can then be used in the makefile to determine if to use the correct linker flags. The addition of the ARM32 flags is a copy and paste from the AArch64 to create a logical OR for the ARCH_AARCH64 and ARCH_ARM variables. I couldn't figure out a better way to create the conditional with basic Make language constructs. --- Makefile.am | 5 +++++ configure.ac | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Makefile.am b/Makefile.am index 2a5610740e..5cd38d991b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2978,10 +2978,15 @@ if ARCH_AARCH64 efi_ldflags += --defsym=EFI_SUBSYSTEM=0xa EFI_FORMAT = -O binary else +if ARCH_ARM +efi_ldflags += --defsym=EFI_SUBSYSTEM=0xa +EFI_FORMAT = -O binary +else EFI_FORMAT = --target=efi-app-$(EFI_ARCH) endif endif endif +endif # ------------------------------------------------------------------------------ systemd_boot_headers = \ diff --git a/configure.ac b/configure.ac index a95e984375..b5868f4be7 100644 --- a/configure.ac +++ b/configure.ac @@ -57,6 +57,7 @@ AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is SET_ARCH(X86_64, x86_64*) SET_ARCH(IA32, i*86*) SET_ARCH(MIPS, mips*) +SET_ARCH(ARM, arm*) SET_ARCH(AARCH64, aarch64*) # i18n stuff for the PolicyKit policy files, heck whether intltool can be found, disable NLS otherwise @@ -1297,6 +1298,9 @@ AM_COND_IF(ARCH_IA32, [ AM_COND_IF(ARCH_X86_64, [ EFI_MACHINE_TYPE_NAME=x64]) +AM_COND_IF(ARCH_ARM, [ + EFI_MACHINE_TYPE_NAME=arm]) + AM_COND_IF(ARCH_AARCH64, [ EFI_MACHINE_TYPE_NAME=aa64]) From 6b5cf3ea621a5bfd218cd2249e066a52c0e73657 Mon Sep 17 00:00:00 2001 From: Matt Clarkson Date: Thu, 6 Apr 2017 14:12:17 +0100 Subject: [PATCH 3/3] build-sys: correct blkid.h includes When using pkg-config to determine the include flags for blkid the flags are returned as: $ pkg-config blkid --cflags -I/usr/include/blkid -I/usr/include/uuid We use the include which would be correct when using the default compiler /usr/include header search path. However, when cross-compiling the blkid.h will not be installed at /usr/include and highly likely in a temporary system root. It is futher compounded if the cross-compile packages are split up and the blkid package is not available in the same sysroot as the compiler. Regardless of the compilation setup, the correct include path should be if using the pkg-config returned CFLAGS. --- src/basic/blkid-util.h | 2 +- src/boot/bootctl.c | 2 +- src/gpt-auto-generator/gpt-auto-generator.c | 2 +- src/nspawn/nspawn.c | 2 +- src/udev/udev-builtin-blkid.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/basic/blkid-util.h b/src/basic/blkid-util.h index 7aa75eb091..1b9cace040 100644 --- a/src/basic/blkid-util.h +++ b/src/basic/blkid-util.h @@ -20,7 +20,7 @@ ***/ #ifdef HAVE_BLKID -#include +#include #endif #include "util.h" diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index 155bf278b2..3358dc32a5 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -19,7 +19,7 @@ ***/ #include -#include +#include #include #include #include diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index 80f676e477..3578e2513c 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -17,7 +17,7 @@ along with systemd; If not, see . ***/ -#include +#include #include #include #include diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 1fc0501c2e..ff2a078853 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -18,7 +18,7 @@ ***/ #ifdef HAVE_BLKID -#include +#include #endif #include #include diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index 9037aa1304..6319403620 100644 --- a/src/udev/udev-builtin-blkid.c +++ b/src/udev/udev-builtin-blkid.c @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -#include +#include #include #include #include