[PATCH v2 1/4] configure: Add libelf as a requirement

Maxiwell S. Garcia maxiwell at linux.ibm.com
Tue Sep 24 08:30:21 AEST 2019


With this library, petitboot is able to open the ELF binary to check
information, like annotation in ELF notes section.

Signed-off-by: Maxiwell S. Garcia <maxiwell at linux.ibm.com>
---
 configure.ac         | 6 ++++++
 discover/Makefile.am | 3 ++-
 utils/Makefile.am    | 3 ++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5d541fb..f3382e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,11 @@ AC_CHECK_LIB([udev], [udev_new],
 	[AC_MSG_FAILURE([The libudev development library is required by petitboot.  Try installing the package libudev-dev or libudev-devel.])]
 )
 
+AC_CHECK_LIB([elf], [elf_begin],
+	[ELF_LIBS=-lelf],
+	[AC_MSG_FAILURE([The libelf development library is required by petitboot.  Try installing the package libelf-dev or elfutils-libelf-devel.])]
+)
+
 PKG_CHECK_EXISTS(libudev >= 218, [old_udev=no], [old_udev=yes])
 if test "$old_udev" = "yes" ; then
       AC_DEFINE(UDEV_LOGGING, 1, [Support old udev logging interface])
@@ -476,6 +481,7 @@ AS_IF(
 )
  
 AC_SUBST([UDEV_LIBS])
+AC_SUBST([ELF_LIBS])
 AC_SUBST([DEVMAPPER_LIBS])
 AC_SUBST([CRYPT_LIBS])
 AC_SUBST([FDT_LIBS])
diff --git a/discover/Makefile.am b/discover/Makefile.am
index bfe33fa..e2d0e93 100644
--- a/discover/Makefile.am
+++ b/discover/Makefile.am
@@ -58,7 +58,8 @@ discover_pb_discover_LDADD = \
 	discover/native/native-parser.ro \
 	discover/platform.ro \
 	$(core_lib) \
-	$(UDEV_LIBS)
+	$(UDEV_LIBS) \
+	$(ELF_LIBS)
 
 discover_pb_discover_LDFLAGS = \
 	$(AM_LDFLAGS) \
diff --git a/utils/Makefile.am b/utils/Makefile.am
index a523430..8788150 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -18,7 +18,8 @@ dist_pkglibexec_SCRIPTS = utils/pb-console
 sbin_PROGRAMS += utils/pb-event utils/pb-config
 
 utils_pb_config_LDADD = $(top_builddir)/lib/libpbcore.la \
-		  $(top_builddir)/discover/platform.ro
+		  $(top_builddir)/discover/platform.ro \
+		  $(ELF_LIBS)
 
 utils_hooks_30_dtb_updates_SOURCES = utils/hooks/30-dtb-updates.c
 utils_hooks_30_dtb_updates_LDADD = $(top_builddir)/lib/libpbcore.la \
-- 
2.20.1



More information about the Petitboot mailing list