Patrick Georgi submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved Paul Menzel: Looks good to me, but someone else must approve Felix Held: Looks good to me, approved Krystian Hebel: Looks good to me, but someone else must approve
util/ifdtool/Makefile: Fix building as standalone tool

Commit f1e401c6cb70 (util/cbfstool/flashmap/fmap.c: fix fmaptool
endianness bugs on BE) makes use of endianness conversion macros
in cbfstool's FMAP code, which is also used by ifdtool. At least
on Linux, the <endian.h> header provides these helpers, but only
when `__USE_MISC` is defined, which is defined in the <ctypes.h>
header when `_DEFAULT_SOURCE` is defined. This was accounted for
in `Makefile.inc`, but not in `Makefile`. As a result, trying to
build ifdtool as a standalone tool (i.e. not as part of building
a coreboot image) results in build errors because the endianness
conversion macros are not defined.

Define `_DEFAULT_SOURCE` in `Makefile` to fix the build errors.

Change-Id: I8c2bbc07ddd87d885e2d6f5c7f2bd501e5c4e3b0
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59663
Reviewed-by: Patrick Georgi <patrick@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M util/ifdtool/Makefile
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/util/ifdtool/Makefile b/util/ifdtool/Makefile
index e8d818c..473dc08 100644
--- a/util/ifdtool/Makefile
+++ b/util/ifdtool/Makefile
@@ -11,6 +11,7 @@
CFLAGS += -I../../src/commonlib/include -I../../src/commonlib/bsd/include
CFLAGS += -I../cbfstool/flashmap
CFLAGS += -include ../../src/commonlib/bsd/include/commonlib/bsd/compiler.h
+CFLAGS += -D_DEFAULT_SOURCE # for endianness converting functions
LDFLAGS =

OBJS = ifdtool.o

To view, visit change 59663. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I8c2bbc07ddd87d885e2d6f5c7f2bd501e5c4e3b0
Gerrit-Change-Number: 59663
Gerrit-PatchSet: 2
Gerrit-Owner: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Julius Werner <jwerner@chromium.org>
Gerrit-Reviewer: Krystian Hebel <krystian.hebel@3mdeb.com>
Gerrit-Reviewer: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
Gerrit-Reviewer: Patrick Georgi <patrick@coreboot.org>
Gerrit-Reviewer: Paul Menzel <paulepanter@mailbox.org>
Gerrit-Reviewer: Stefan Reinauer <stefan.reinauer@coreboot.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged