diff --git a/fwupdate.spec.in b/fwupdate.spec.in index 267ddc1..b249ed1 100644 --- a/fwupdate.spec.in +++ b/fwupdate.spec.in @@ -12,7 +12,10 @@ BuildRequires: efivar-devel >= %{efivar_version} BuildRequires: gnu-efi gnu-efi-devel BuildRequires: pesign BuildRequires: elfutils popt-devel git gettext pkgconfig -BuildRequires: systemd libsmbios-devel +BuildRequires: systemd +%ifarch x86_64 %{ix86} +BuildRequires: libsmbios-devel +%endif ExclusiveArch: x86_64 %{ix86} aarch64 Source0: https://github.com/rhinstaller/fwupdate/releases/download/%{name}-%{version}/%{name}-%{version}.tar.bz2 diff --git a/linux/Makefile b/linux/Makefile index 28f46d3..5122e48 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -6,7 +6,14 @@ include $(TOPDIR)/Make.defaults LIB_LIBS= pthread BIN_LIBS= popt pthread -PKLIBS = efivar efiboot libsmbios_c +PKLIBS = efivar efiboot +HAVE_LIBSMBIOS=no +ifeq ($(ARCH),x86_64) + HAVE_LIBSMBIOS=yes +endif +ifeq ($(ARCH),ia32) + HAVE_LIBSMBIOS=yes +endif CFLAGS ?= -g -O0 PJONES = BIN_CCLDFLAGS = $(foreach lib,$(BIN_LIBS),-l$(lib)) \ @@ -18,6 +25,10 @@ LIB_CCLDFLAGS = $(foreach lib,$(LIB_LIBS),-l$(lib)) \ $(shell pkg-config --libs-only-l --libs-only-other $(pklib))) \ $(LDFLAGS) -shared -fPIC -Wl,-z,relro,-z,now +ifeq ($(HAVE_LIBSMBIOS),yes) + PKLIBS += libsmbios_c + CFLAGS += -DFWUPDATE_HAVE_LIBSMBIOS__ +endif BUILDFLAGS := $(CFLAGS) -Wall -Wextra -Werror -Wno-error=cpp \ -Wno-unused-result -Wno-unused-function \ -Wsign-compare -Werror=sign-compare \ diff --git a/linux/libfwup.c b/linux/libfwup.c index da8af8b..079fbe5 100644 --- a/linux/libfwup.c +++ b/linux/libfwup.c @@ -32,9 +32,12 @@ static int verbose; #include "error.h" +#ifdef FWUPDATE_HAVE_LIBSMBIOS__ #include + #define DELL_CAPSULE_FIRMWARE_UPDATES_ENABLED 0x0461 #define DELL_CAPSULE_FIRMWARE_UPDATES_DISABLED 0x0462 +#endif static char *arch_names_32[] = { #if defined(__x86_64__) || defined(__i386__) || defined(__i686__) @@ -98,6 +101,7 @@ efidp_end_entire(efidp_header *dp) int fwup_esrt_disabled(void) { +#ifdef FWUPDATE_HAVE_LIBSMBIOS__ if (!token_is_bool(DELL_CAPSULE_FIRMWARE_UPDATES_DISABLED)) return -1; if (!token_is_active(DELL_CAPSULE_FIRMWARE_UPDATES_DISABLED)) @@ -107,6 +111,9 @@ fwup_esrt_disabled(void) return -2; } return 2; +#else + return -1; +#endif } /* @@ -122,6 +129,7 @@ fwup_esrt_disabled(void) int fwup_enable_esrt(void) { +#ifdef FWUPDATE_HAVE_LIBSMBIOS__ int rc; rc = fwup_supported(); /* can't enable or already enabled */ @@ -148,6 +156,10 @@ fwup_enable_esrt(void) return -3; } return 2; +#else + errno = ENOSYS; + return -1; +#endif } /*