
Always prioritizing u-boot includes causes problems when trying to migrate boards to OF_UPSTREAM that have divergent devicetree files with respect to the upstream ones.
For example, migrating a board based on `imx6ul.dtsi` to OF_UPSTREAM breaks it, as there are some missing defines in the local dtsi file; the solutions would be to either patch it, which defeats the purpose of OF_UPSTREAM, or delete it entirely. This last option would then break all the other boards which have not yet been migrated to OF_UPSTREAM.
The opposite problem also exists: by always prioritizing upstream includes, if changes are made in the kernel headers and devicetree files that are not backwards compatible, again all boards which have not been migrated to OF_UPSTREAM will break.
This patch fixes this problem by prioritizing upstream includes when `CONFIG_OF_UPSTREAM=y`, while keeping current prioritization when it is not.
Signed-off-by: Patrick Barsanti patrick.barsanti@amarulasolutions.com --- Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/Makefile b/Makefile index 79b28c2d81..899ae664ca 100644 --- a/Makefile +++ b/Makefile @@ -826,6 +826,19 @@ KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g)
# Use UBOOTINCLUDE when you must reference the include/ directory. # Needed to be compatible with the O= option +ifeq ($(CONFIG_OF_UPSTREAM),y) +UBOOTINCLUDE := \ + -I$(srctree)/dts/upstream/include \ + -Iinclude \ + $(if $(KBUILD_SRC), -I$(srctree)/include) \ + $(if $(CONFIG_$(SPL_)SYS_THUMB_BUILD), \ + $(if $(CONFIG_HAS_THUMB2), \ + $(if $(CONFIG_CPU_V7M), \ + -I$(srctree)/arch/arm/thumb1/include), \ + -I$(srctree)/arch/arm/thumb1/include)) \ + -I$(srctree)/arch/$(ARCH)/include \ + -include $(srctree)/include/linux/kconfig.h +else UBOOTINCLUDE := \ -Iinclude \ $(if $(KBUILD_SRC), -I$(srctree)/include) \ @@ -837,6 +850,7 @@ UBOOTINCLUDE := \ -I$(srctree)/arch/$(ARCH)/include \ -include $(srctree)/include/linux/kconfig.h \ -I$(srctree)/dts/upstream/include +endif
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)