[PATCH 3/9] scripts: Makefile.lib: Pass __UBOOT__ to DTC's CPP

Pierre-Clément Tosi ptosi at google.com
Wed Mar 16 16:39:42 CET 2022

Some headers included (possibly indirectly) from .dts files might have
U-Boot specific content relying on the __UBOOT__ macro passed to CPP
when building C code. In that case, it would be sensible for DTC to see
that content instead of the non-U-Boot one. To do so, pass the macro to
the pre-processor when generate DTC inputs.

Signed-off-by: Pierre-Clément Tosi <ptosi at google.com>
Cc: Simon Glass <sjg at chromium.org>
 scripts/Makefile.lib | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index c14da10de7..d7b548dce8 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -192,6 +192,7 @@ dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
 		 -I$(srctree)/arch/$(ARCH)/include                       \
 		 -include $(srctree)/include/linux/kconfig.h             \
 		 -D__ASSEMBLY__                                          \
+		 -D__UBOOT__                                             \
 		 -undef -D__DTS__
 # Finds the multi-part object the current object will be linked into

More information about the U-Boot mailing list