[PATCH] configure: bootloader optional

29 views
Skip to first unread message

Michael Haener

unread,
Feb 21, 2022, 5:16:12 AM2/21/22
to efibootg...@googlegroups.com, Michael Haener
For native builds where only tools are needed, the libpci
detection and the bootloader build can be disabled.
---
Makefile.am | 2 ++
configure.ac | 9 ++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 7686577..f8e094a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -135,6 +135,7 @@ install-exec-hook:
#
efi_loadername = efibootguard$(MACHINE_TYPE_NAME).efi

+if BOOTLOADER
if ARCH_AARCH64
efi_sources_watchdogs =
else
@@ -249,6 +250,7 @@ $(efi_loadername): $(efi_solib)
$(AM_V_GEN) $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc -j .init_array \
-j .rela.got -j .rela.data $(objcopy_format) $< $@
+endif

$(top_builddir)/tools/bg_setenv-bg_setenv.o: $(GEN_VERSION_H)

diff --git a/configure.ac b/configure.ac
index 440631d..779ada4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,7 +179,14 @@ if test "x$PKG_CONFIG" = "xno"; then
AC_MSG_ERROR([You need to install pkg-config])
fi
PKG_CHECK_MODULES(LIBCHECK, check)
-PKG_CHECK_MODULES(LIBPCI, libpci)
+
+AC_ARG_ENABLE([bootloader],
+ AS_HELP_STRING([--disable-bootloader], [Compile the bootloader disabled, only make the tools]))
+
+AS_IF([test "x$enable_bootloader" != "xno"], [
+ PKG_CHECK_MODULES(LIBPCI, libpci)
+])
+AM_CONDITIONAL([BOOTLOADER], [test "x$enable_bootloader" != "xno"])

dnl Python
AC_PATH_PROGS(PYTHON, [python3 python3.9 python3.8 python3.7 python3.6 python2.7 python2], no)
--
2.34.1

Jan Kiszka

unread,
Feb 22, 2022, 1:58:02 AM2/22/22
to Michael Haener, efibootg...@googlegroups.com
AC_MSG_RESULT should be added for such an important control. Looks good
otherwise.

Jan

>
> dnl Python
> AC_PATH_PROGS(PYTHON, [python3 python3.9 python3.8 python3.7 python3.6 python2.7 python2], no)

--
Siemens AG, Technology
Competence Center Embedded Linux

Michael Haener

unread,
Feb 22, 2022, 3:34:43 AM2/22/22
to efibootg...@googlegroups.com, Michael Haener
---
Makefile.am | 2 ++
configure.ac | 13 ++++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 7686577..f8e094a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -135,6 +135,7 @@ install-exec-hook:
#
efi_loadername = efibootguard$(MACHINE_TYPE_NAME).efi

+if BOOTLOADER
if ARCH_AARCH64
efi_sources_watchdogs =
else
@@ -249,6 +250,7 @@ $(efi_loadername): $(efi_solib)
$(AM_V_GEN) $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \
-j .dynsym -j .rel -j .rela -j .reloc -j .init_array \
-j .rela.got -j .rela.data $(objcopy_format) $< $@
+endif

$(top_builddir)/tools/bg_setenv-bg_setenv.o: $(GEN_VERSION_H)

diff --git a/configure.ac b/configure.ac
index 440631d..87ba384 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,7 +179,16 @@ if test "x$PKG_CONFIG" = "xno"; then
AC_MSG_ERROR([You need to install pkg-config])
fi
PKG_CHECK_MODULES(LIBCHECK, check)
-PKG_CHECK_MODULES(LIBPCI, libpci)
+
+AC_ARG_ENABLE([bootloader],
+ AS_HELP_STRING([--disable-bootloader], [Compile the bootloader disabled, only make the tools]),
+ [enable_bootloader="no"],
+ [enable_bootloader="yes"])
+
+AS_IF([test "x$enable_bootloader" != "xno"], [
+ PKG_CHECK_MODULES(LIBPCI, libpci)
+])
+AM_CONDITIONAL([BOOTLOADER], [test "x$enable_bootloader" != "xno"])

dnl Python
AC_PATH_PROGS(PYTHON, [python3 python3.9 python3.8 python3.7 python3.6 python2.7 python2], no)
@@ -200,6 +209,8 @@ AC_MSG_RESULT([
arch: $ARCH
machine type: $MACHINE_TYPE_NAME

+ build efi bootloader: ${enable_bootloader}
+
prefix: ${prefix}
exec_prefix: ${exec_prefix}
libexecdir: ${libexecdir}
--
2.34.1

Michael Häner

unread,
Feb 22, 2022, 3:44:51 AM2/22/22
to EFI Boot Guard
The state is now visible in AC_MSG_RESULT.

Michael

Jan Kiszka

unread,
Feb 22, 2022, 3:45:14 AM2/22/22
to Michael Haener, efibootg...@googlegroups.com
Now you've lost the commit message. Re-add it, and please also add a
signed-off at this chance.
Yep, that's fine as well.

Jan

Michael Haener

unread,
Feb 22, 2022, 4:19:19 AM2/22/22
to efibootg...@googlegroups.com, Michael Haener
For native builds where only tools are needed, the libpci
detection and the bootloader build can be disabled.

Signed-off-by: Michael Haener <michael...@siemens.com>
--
2.34.1

Michael Häner

unread,
Feb 22, 2022, 4:23:24 AM2/22/22
to EFI Boot Guard
You are right. I have quickly corrected this.

Jan Kiszka

unread,
Feb 22, 2022, 5:13:17 AM2/22/22
to Michael Haener, efibootg...@googlegroups.com
Just realized: This is the only user of pkg-config so far. So, when
disabling the bootloader, thus removing the need for libpci, we /could/
also remove the need for pkg-config. Not a blocker, can be done on top,
therefore...

> +])
> +AM_CONDITIONAL([BOOTLOADER], [test "x$enable_bootloader" != "xno"])
>
> dnl Python
> AC_PATH_PROGS(PYTHON, [python3 python3.9 python3.8 python3.7 python3.6 python2.7 python2], no)
> @@ -200,6 +209,8 @@ AC_MSG_RESULT([
> arch: $ARCH
> machine type: $MACHINE_TYPE_NAME
>
> + build efi bootloader: ${enable_bootloader}
> +
> prefix: ${prefix}
> exec_prefix: ${exec_prefix}
> libexecdir: ${libexecdir}

...applied to next, thanks.
Reply all
Reply to author
Forward
0 new messages