[PATCH] scripts/Makefile.lib: add -D__U_BOOT__ to dtc_cpp_flags
Tom Rini
trini at konsulko.com
Fri Jul 1 21:25:08 CEST 2022
On Fri, Jul 01, 2022 at 09:27:59AM +0200, Rasmus Villemoes wrote:
> When trying to use the exact same device tree source to build the dtbs
> used with U-Boot and linux, one often runs into various problems. For
> example, files under include/dt-bindings/ might not be completely in
> sync, so some #defines are available in linux but not in U-Boot.
>
> It's also possible that there are nodes/hardware one simply doesn't
> need or want to describe to U-Boot, e.g. to reduce the size of the
> .dtb (for SPL, there's already the whole fdtgrep machinery to deal
> with that, but not for U-Boot proper), or configuration settings like
> watchdog timeout one wants to make different between linux and U-Boot.
>
> So in order to allow such tweaks, add an explicit define of the macro
> __U_BOOT__. Since U-Boot includes linux/kconfig.h (and defines
> __ASSEMBLY__ to make that work) while linux doesn't, one could also
> use __ASSEMBLY__ or just about any known-to-be-defined CONFIG_* macro
> as a proxy, but it's much more readable, maintainable and robust if
> one's .dts has "ifdef __U_BOOT__" rather than "ifdef __ASSEMBLY__".
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> ---
> scripts/Makefile.lib | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 3db2550085..4183767a62 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -190,6 +190,7 @@ dtc_cpp_flags = -Wp,-MD,$(depfile).pre.tmp -nostdinc \
> -I$(srctree)/arch/$(ARCH)/dts/include \
> -I$(srctree)/include \
> -D__ASSEMBLY__ \
> + -D__U_BOOT__ \
> -undef -D__DTS__
>
> # Finds the multi-part object the current object will be linked into
Since this implies to me using __U_BOOT__ in the main dts file itself,
we need to bring this up on devicetree-spec. Otherwise, we could just
use the -u-boot.dtsi to remove nodes/properties, yes? And then bindings
needing to be re-synced is something to incentivize, from my point of
view, initially at least.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220701/41567e47/attachment.sig>
More information about the U-Boot
mailing list