diff options
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> | 2018-02-19 16:56:31 +0100 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@bootlin.com> | 2018-02-25 22:40:17 +0100 |
commit | baae5156ce37e8b2775f04710f7d1c8e97e4114c (patch) | |
tree | 84709dd820a398a69d045bbcda75c07cc7930104 /boot/uboot | |
parent | eb1a45f4c1e01fa1af7ad3dbbd6b2bade7fc958d (diff) | |
download | buildroot-baae5156ce37e8b2775f04710f7d1c8e97e4114c.tar.gz buildroot-baae5156ce37e8b2775f04710f7d1c8e97e4114c.zip |
uboot: use local fdt headers
After commit b8c3e941731d ("package/dtc: qemu system build need libfdt")
changed the dtc install target from 'install-bin' to 'install', uboot
compilation failures occurred because libfdt related headers were now
suddenly taken from output/host/include rather than from the uboot sources
itself.
Commit 3a6573ccee26 ("uboot: use local libfdt.h") solved this by patching
one specific uboot source file, tools/fdtgrep.c, to replace '<...>'-style
includes by '"..."'-style includes.
However, depending on the uboot version, this may not be enough: there may
be other references to fdt header files. In particular taking into account
that it is not uncommon to have vendor-provided uboot trees which have
custom changes.
The root of the problem is that the uboot.mk file passes the host compiler
as follows:
UBOOT_MAKE_OPTS += \
...
HOSTCC="$(HOSTCC) $(HOST_CFLAGS)" \
...
where HOST_CFLAGS contains the string '-I$(HOST_DIR)/include'
The uboot makefiles then use constructs of the form:
$(CC) $(CPPFLAGS) $(CFLAGS) .....
where CPPFLAGS may contain -I references pointing to local directories.
On the expanded compiler command-line, Buildroot's '-I$(HOST_DIR)/include'
is thus present _before_ any -I to local directories, and thus takes
precedence. And that becomes a problem for header files present both
locally as in the Buildroot host directory, which is the case for libfdt.
To fix this problem without having to patch u-boot sources, use '-idirafter'
rather than '-I' to pass the Buildroot host include directory. '-idirafter'
is basically the same thing, but adds the specified directory at the end
of the include precedence chain, rather than at the beginning.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'boot/uboot')
-rw-r--r-- | boot/uboot/uboot.mk | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk index d2f241cd8b..977f44cad8 100644 --- a/boot/uboot/uboot.mk +++ b/boot/uboot/uboot.mk @@ -131,7 +131,7 @@ endif UBOOT_MAKE_OPTS += \ CROSS_COMPILE="$(TARGET_CROSS)" \ ARCH=$(UBOOT_ARCH) \ - HOSTCC="$(HOSTCC) $(HOST_CFLAGS)" \ + HOSTCC="$(HOSTCC) $(subst -I/,-idirafter /,$(subst -I /,-idirafter /,$(HOST_CFLAGS)))" \ HOSTLDFLAGS="$(HOST_LDFLAGS)" ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y) |