+ Jan

Hi Marek,

On Sat, 28 Sept 2024 at 03:20, Marek Vasut <ma...@denx.de> wrote:
>
> Currently the enablement of OF_UPSTREAM results on the build system
> searching for DTs only in dts/upstream/ . There are platforms which
> use U-Boot specific DTBOs applied on top of U-Boot control DT during
> SPL stage, and source DTs for these are located in arch/$(ARCH)/dtb.

I would like to understand the need to maintain DTBOs separately from
DTBs. Why aren't we pushing DTBOs to Linux kernel sources as we do for
DTBs? Jan recently pushed those so-called U-Boot specific DTBOs for a
TI platform which were accepted in the Linux kernel upstream. This
patch will just deny the ability to build those DTBOs from dts
upstream tree. IMHO, this takes a step backwards on the whole notion
of OF_UPSTREAM.

If we really want a middle ground solution to allow migration to
OF_UPSTREAM easier then we need to find a way to build DTBOs from both
directories (local and upstream dts). I would imagine that will likely
complicate building and packaging DTBOs.

-Sumit

>
> Add dedicated 'dtbos' target which builds only .dtbos and not .dtbs and
> in case OF_UPSTREAM is enabled, build this target for arch/$(ARCH)/dtb
> to generate local U-Boot specific DTBOs.
>
> Adjust top level Makefile so binman would search for .dtb and .dtbo in
> both OF_UPSTREAM specific paths and arch/$(ARCH)/dtb for the .dtbo case.
>
> Signed-off-by: Marek Vasut <ma...@denx.de>
> ---
> Cc: "NXP i.MX U-Boot Team" <uboot-...@nxp.com>
> Cc: Caleb Connolly <caleb.conno...@linaro.org>
> Cc: Christoph Niedermaier <cniederma...@dh-electronics.com>
> Cc: Fabio Estevam <feste...@gmail.com>
> Cc: Heinrich Schuchardt <xypron.g...@gmx.de>
> Cc: Jonas Karlman <jo...@kwiboo.se>
> Cc: Lothar Rubusch <l.rubu...@gmail.com>
> Cc: Michal Simek <michal.si...@amd.com>
> Cc: Nobuhiro Iwamatsu <iwama...@nigauri.org>
> Cc: Rasmus Villemoes <rasmus.villem...@prevas.dk>
> Cc: Simon Glass <s...@chromium.org>
> Cc: Stefano Babic <sba...@denx.de>
> Cc: Sumit Garg <sumit.g...@linaro.org>
> Cc: Tom Rini <tr...@konsulko.com>
> Cc: u-b...@dh-electronics.com
> Cc: u-boot@lists.denx.de
> ---
>  Makefile             |  5 ++++-
>  dts/Makefile         | 11 +++++++++--
>  scripts/Makefile.dts |  5 ++++-
>  3 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 525576f987d..fba8e48681e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1194,6 +1194,8 @@ else
>  dt_dir := arch/$(ARCH)/dts
>  endif
>
> +local_dto_dir := arch/$(ARCH)/dts
> +
>  ifeq ($(CONFIG_MULTI_DTB_FIT),y)
>
>  ifeq ($(CONFIG_MULTI_DTB_FIT_LZO),y)
> @@ -1377,7 +1379,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if 
> $(BINMAN_DEBUG),-D) \
>                 build -u -d u-boot.dtb -O . -m \
>                 --allow-missing $(if 
> $(BINMAN_ALLOW_MISSING),--ignore-missing) \
>                 -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
> -               -I $(dt_dir) -a of-list=$(CONFIG_OF_LIST) \
> +               -I $(dt_dir) -I $(local_dto_dir) \
> +               -a of-list=$(CONFIG_OF_LIST) \
>                 $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
>                 -a atf-bl31-path=${BL31} \
>                 -a tee-os-path=${TEE} \
> diff --git a/dts/Makefile b/dts/Makefile
> index d6c2c9daf31..f872a867667 100644
> --- a/dts/Makefile
> +++ b/dts/Makefile
> @@ -11,12 +11,16 @@ DEVICE_TREE := unset
>  endif
>
>  ifeq ($(CONFIG_OF_UPSTREAM),y)
> +local_dtbos := local-dtbos
> +local_dtbo_dir := arch/$(ARCH)/dts
>  ifeq ($(CONFIG_ARM64),y)
>  dt_dir := dts/upstream/src/arm64
>  else
>  dt_dir := dts/upstream/src/$(ARCH)
>  endif
>  else
> +local_dtbos :=
> +local_dtbo_dir :=
>  dt_dir := arch/$(ARCH)/dts
>  endif
>
> @@ -40,7 +44,7 @@ endif
>
>  targets += dt.dtb
>
> -$(DTB): arch-dtbs
> +$(DTB): arch-dtbs $(local_dtbos)
>         $(Q)test -e $@ || (                                             \
>         echo >&2;                                                       \
>         echo >&2 "Device Tree Source ($@) is not correctly specified."; \
> @@ -49,10 +53,13 @@ $(DTB): arch-dtbs
>         echo >&2;                                                       \
>         /bin/false)
>
> -PHONY += arch-dtbs
> +PHONY += arch-dtbs local-dtbos
>  arch-dtbs:
>         $(Q)$(MAKE) $(build)=$(dt_dir) dtbs
>
> +local-dtbos:
> +       $(Q)$(MAKE) $(build)=$(local_dtbo_dir) dtbos
> +
>  ifeq ($(CONFIG_SPL_BUILD),y)
>  obj-$(CONFIG_OF_EMBED) := dt-spl.dtb.o
>  # support "out-of-tree" build for dtb-spl
> diff --git a/scripts/Makefile.dts b/scripts/Makefile.dts
> index 1fe142f2bbf..f4d3a37010a 100644
> --- a/scripts/Makefile.dts
> +++ b/scripts/Makefile.dts
> @@ -17,8 +17,11 @@ endif
>
>  targets += $(dtb-y)
>
> -PHONY += dtbs
> +PHONY += dtbs dtbos
>  dtbs: $(addprefix $(obj)/, $(dtb-y))
>         @:
>
> +dtbos: $(addprefix $(obj)/, $(filter-out %.dtb,$(dtb-y)))
> +       @:
> +
>  clean-files := *.dtb *.dtbo */*.dtb */*.dtbo *_HS
> --
> 2.45.2
>

Reply via email to