[PATCH v2 0/5] finish using .dtso for overlay source files

This is a followup to the patches that landed in 2024.01 and nearly made sure that source files for producing .dtbo files use the .dtso extension. In the same release, a few new .dts files snuck in, and there was also some test code involving .dtbo -> .dtbo.S -> .dtbo.o I didn't really know how to handle at the time. This should finish the job, bring us in sync with linux (at least in this respect), and drop the .dts -> .dtbo build rule.
Patch 3 depends on 2, and patch 5 depends on the rest.
v2: Fix oversight in the imx8mp-dhcom files.
Now actually tested on CI, and seems to pass except for the known cyclic false positive:
https://dev.azure.com/u-boot/u-boot/_build/results?buildId=8897&view=log...
Rasmus Villemoes (5): arm64: dts: imx8mp: rename DHCOM SoM overlays to .dtso kbuild: Allow DTB overlays to built into .dtbo.S files test: overlay: rename overlay source files to .dtso test/py: efi_capsule: rename device tree overlay source to .dtso kbuild: Disallow DTB overlays to built from .dts named source files
...> imx8mp-dhcom-pdk-overlay-eth2xfast.dtso} | 0 ... => imx8mp-dhcom-pdk3-overlay-rev100.dtso} | 0 ...> imx8mp-dhcom-som-overlay-eth1xfast.dtso} | 0 ...> imx8mp-dhcom-som-overlay-eth2xfast.dtso} | 2 +- ...s => imx8mp-dhcom-som-overlay-rev100.dtso} | 0 scripts/Makefile.lib | 23 +++++++++++++++---- test/overlay/Makefile | 4 ++-- test/overlay/cmd_ut_overlay.c | 8 +++---- ...cked.dts => test-fdt-overlay-stacked.dtso} | 0 ...-fdt-overlay.dts => test-fdt-overlay.dtso} | 0 test/py/tests/test_efi_capsule/conftest.py | 6 ++--- .../{version.dts => version.dtso} | 0 12 files changed, 29 insertions(+), 14 deletions(-) rename arch/arm/dts/{imx8mp-dhcom-pdk-overlay-eth2xfast.dts => imx8mp-dhcom-pdk-overlay-eth2xfast.dtso} (100%) rename arch/arm/dts/{imx8mp-dhcom-pdk3-overlay-rev100.dts => imx8mp-dhcom-pdk3-overlay-rev100.dtso} (100%) rename arch/arm/dts/{imx8mp-dhcom-som-overlay-eth1xfast.dts => imx8mp-dhcom-som-overlay-eth1xfast.dtso} (100%) rename arch/arm/dts/{imx8mp-dhcom-som-overlay-eth2xfast.dts => imx8mp-dhcom-som-overlay-eth2xfast.dtso} (91%) rename arch/arm/dts/{imx8mp-dhcom-som-overlay-rev100.dts => imx8mp-dhcom-som-overlay-rev100.dtso} (100%) rename test/overlay/{test-fdt-overlay-stacked.dts => test-fdt-overlay-stacked.dtso} (100%) rename test/overlay/{test-fdt-overlay.dts => test-fdt-overlay.dtso} (100%) rename test/py/tests/test_efi_capsule/{version.dts => version.dtso} (100%)

Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo. No functional change, as we currently have rules for producing a foo.dtbo from either foo.dts or foo.dtso.
Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources.
Cc: Marek Vasut marex@denx.de Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk --- ...ay-eth2xfast.dts => imx8mp-dhcom-pdk-overlay-eth2xfast.dtso} | 0 ...overlay-rev100.dts => imx8mp-dhcom-pdk3-overlay-rev100.dtso} | 0 ...ay-eth1xfast.dts => imx8mp-dhcom-som-overlay-eth1xfast.dtso} | 0 ...ay-eth2xfast.dts => imx8mp-dhcom-som-overlay-eth2xfast.dtso} | 2 +- ...-overlay-rev100.dts => imx8mp-dhcom-som-overlay-rev100.dtso} | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename arch/arm/dts/{imx8mp-dhcom-pdk-overlay-eth2xfast.dts => imx8mp-dhcom-pdk-overlay-eth2xfast.dtso} (100%) rename arch/arm/dts/{imx8mp-dhcom-pdk3-overlay-rev100.dts => imx8mp-dhcom-pdk3-overlay-rev100.dtso} (100%) rename arch/arm/dts/{imx8mp-dhcom-som-overlay-eth1xfast.dts => imx8mp-dhcom-som-overlay-eth1xfast.dtso} (100%) rename arch/arm/dts/{imx8mp-dhcom-som-overlay-eth2xfast.dts => imx8mp-dhcom-som-overlay-eth2xfast.dtso} (91%) rename arch/arm/dts/{imx8mp-dhcom-som-overlay-rev100.dts => imx8mp-dhcom-som-overlay-rev100.dtso} (100%)
diff --git a/arch/arm/dts/imx8mp-dhcom-pdk-overlay-eth2xfast.dts b/arch/arm/dts/imx8mp-dhcom-pdk-overlay-eth2xfast.dtso similarity index 100% rename from arch/arm/dts/imx8mp-dhcom-pdk-overlay-eth2xfast.dts rename to arch/arm/dts/imx8mp-dhcom-pdk-overlay-eth2xfast.dtso diff --git a/arch/arm/dts/imx8mp-dhcom-pdk3-overlay-rev100.dts b/arch/arm/dts/imx8mp-dhcom-pdk3-overlay-rev100.dtso similarity index 100% rename from arch/arm/dts/imx8mp-dhcom-pdk3-overlay-rev100.dts rename to arch/arm/dts/imx8mp-dhcom-pdk3-overlay-rev100.dtso diff --git a/arch/arm/dts/imx8mp-dhcom-som-overlay-eth1xfast.dts b/arch/arm/dts/imx8mp-dhcom-som-overlay-eth1xfast.dtso similarity index 100% rename from arch/arm/dts/imx8mp-dhcom-som-overlay-eth1xfast.dts rename to arch/arm/dts/imx8mp-dhcom-som-overlay-eth1xfast.dtso diff --git a/arch/arm/dts/imx8mp-dhcom-som-overlay-eth2xfast.dts b/arch/arm/dts/imx8mp-dhcom-som-overlay-eth2xfast.dtso similarity index 91% rename from arch/arm/dts/imx8mp-dhcom-som-overlay-eth2xfast.dts rename to arch/arm/dts/imx8mp-dhcom-som-overlay-eth2xfast.dtso index 82dadcea96c..f2d768cdf91 100644 --- a/arch/arm/dts/imx8mp-dhcom-som-overlay-eth2xfast.dts +++ b/arch/arm/dts/imx8mp-dhcom-som-overlay-eth2xfast.dtso @@ -2,7 +2,7 @@ /* * Copyright (C) 2023 Marek Vasut marex@denx.de */ -#include "imx8mp-dhcom-som-overlay-eth1xfast.dts" +#include "imx8mp-dhcom-som-overlay-eth1xfast.dtso"
/* Dual RMII 100/Full Fast ethernet on this SoM variant. */
diff --git a/arch/arm/dts/imx8mp-dhcom-som-overlay-rev100.dts b/arch/arm/dts/imx8mp-dhcom-som-overlay-rev100.dtso similarity index 100% rename from arch/arm/dts/imx8mp-dhcom-som-overlay-rev100.dts rename to arch/arm/dts/imx8mp-dhcom-som-overlay-rev100.dtso

On 7/10/24 9:16 AM, Rasmus Villemoes wrote:
Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo. No functional change, as we currently have rules for producing a foo.dtbo from either foo.dts or foo.dtso.
Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources.
Cc: Marek Vasut marex@denx.de Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk
Reviewed-by: Marek Vasut marex@denx.de
Thanks!

[linux commit 941214a512d8, modified for U-Boot by removing the include of vmlinux.lds.h and replacing STRUCT_ALIGNMENT by 16.]
DTB files can be built into the kernel by converting them to assembly files then assembling them into object files. We extend this here for DTB overlays with the .dtso extensions.
We change the start and end delimiting tag prefix to make it clear that this data came from overlay files.
Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk --- scripts/Makefile.lib | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 3e68d5aa803..549c3619472 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -305,7 +305,7 @@ endif DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
# Generate an assembly file to wrap the output of the device tree compiler -quiet_cmd_dt_S_dtb= DTB $@ +quiet_cmd_dt_S_dtb= DTBS $@ # Modified for U-Boot cmd_dt_S_dtb= \ ( \ @@ -322,6 +322,24 @@ cmd_dt_S_dtb= \ $(obj)/%.dtb.S: $(obj)/%.dtb $(call cmd,dt_S_dtb)
+# Generate an assembly file to wrap the output of the device tree compiler +quiet_cmd_dt_S_dtbo= DTBOS $@ +# Modified for U-Boot +cmd_dt_S_dtbo= \ +{ \ + echo '.section .dtb.init.rodata,"a"'; \ + echo '.balign 16'; \ + echo '.global __dtbo_$(subst -,_,$(*F))_begin'; \ + echo '__dtbo_$(subst -,_,$(*F))_begin:'; \ + echo '.incbin "$<" '; \ + echo '__dtbo_$(subst -,_,$(*F))_end:'; \ + echo '.global __dtbo_$(subst -,_,$(*F))_end'; \ + echo '.balign 16'; \ +} > $@ + +$(obj)/%.dtbo.S: $(obj)/%.dtbo + $(call cmd,dt_S_dtbo) + ifeq ($(CONFIG_OF_LIBFDT_OVERLAY),y) DTC_FLAGS += -@ endif

On Wed, 10 Jul 2024 at 09:17, Rasmus Villemoes rasmus.villemoes@prevas.dk wrote:
[linux commit 941214a512d8, modified for U-Boot by removing the include of vmlinux.lds.h and replacing STRUCT_ALIGNMENT by 16.]
DTB files can be built into the kernel by converting them to assembly files then assembling them into object files. We extend this here for DTB overlays with the .dtso extensions.
We change the start and end delimiting tag prefix to make it clear that this data came from overlay files.
Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk
scripts/Makefile.lib | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 3e68d5aa803..549c3619472 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -305,7 +305,7 @@ endif DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
# Generate an assembly file to wrap the output of the device tree compiler -quiet_cmd_dt_S_dtb= DTB $@ +quiet_cmd_dt_S_dtb= DTBS $@ # Modified for U-Boot cmd_dt_S_dtb= \ ( \ @@ -322,6 +322,24 @@ cmd_dt_S_dtb= \ $(obj)/%.dtb.S: $(obj)/%.dtb $(call cmd,dt_S_dtb)
+# Generate an assembly file to wrap the output of the device tree compiler +quiet_cmd_dt_S_dtbo= DTBOS $@ +# Modified for U-Boot +cmd_dt_S_dtbo= \ +{ \
echo '.section .dtb.init.rodata,"a"'; \
echo '.balign 16'; \
echo '.global __dtbo_$(subst -,_,$(*F))_begin'; \
echo '__dtbo_$(subst -,_,$(*F))_begin:'; \
echo '.incbin "$<" '; \
echo '__dtbo_$(subst -,_,$(*F))_end:'; \
echo '.global __dtbo_$(subst -,_,$(*F))_end'; \
echo '.balign 16'; \
+} > $@
+$(obj)/%.dtbo.S: $(obj)/%.dtbo
$(call cmd,dt_S_dtbo)
ifeq ($(CONFIG_OF_LIBFDT_OVERLAY),y) DTC_FLAGS += -@ endif -- 2.45.2

Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo.
In this case, the files are really meant to be compiled to .dtbo -> .dtbo.S -> .dtbo.o that get embedded in the image, which means that the begin/end symbols generated by the makefile rule changes to __dtbo_ rather than __dtb, so the consuming .c file needs updating, but this should not result in any functional change.
Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources.
Cc: Maxime Ripard maxime.ripard@free-electrons.com Cc: Simon Glass sjg@chromium.org Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk --- test/overlay/Makefile | 4 ++-- test/overlay/cmd_ut_overlay.c | 8 ++++---- ...-overlay-stacked.dts => test-fdt-overlay-stacked.dtso} | 0 .../{test-fdt-overlay.dts => test-fdt-overlay.dtso} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename test/overlay/{test-fdt-overlay-stacked.dts => test-fdt-overlay-stacked.dtso} (100%) rename test/overlay/{test-fdt-overlay.dts => test-fdt-overlay.dtso} (100%)
diff --git a/test/overlay/Makefile b/test/overlay/Makefile index 2deec929abf..47937e3c108 100644 --- a/test/overlay/Makefile +++ b/test/overlay/Makefile @@ -10,5 +10,5 @@ DTC_FLAGS += -@
# DT overlays obj-y += test-fdt-base.dtb.o -obj-y += test-fdt-overlay.dtb.o -obj-y += test-fdt-overlay-stacked.dtb.o +obj-y += test-fdt-overlay.dtbo.o +obj-y += test-fdt-overlay-stacked.dtbo.o diff --git a/test/overlay/cmd_ut_overlay.c b/test/overlay/cmd_ut_overlay.c index bcb29a26e21..256afd115d2 100644 --- a/test/overlay/cmd_ut_overlay.c +++ b/test/overlay/cmd_ut_overlay.c @@ -21,8 +21,8 @@ #define FDT_COPY_SIZE (4 * SZ_1K)
extern u32 __dtb_test_fdt_base_begin; -extern u32 __dtb_test_fdt_overlay_begin; -extern u32 __dtb_test_fdt_overlay_stacked_begin; +extern u32 __dtbo_test_fdt_overlay_begin; +extern u32 __dtbo_test_fdt_overlay_stacked_begin;
static void *fdt;
@@ -216,8 +216,8 @@ int do_ut_overlay(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) const int n_ents = UNIT_TEST_SUITE_COUNT(overlay_test); struct unit_test_state *uts; void *fdt_base = &__dtb_test_fdt_base_begin; - void *fdt_overlay = &__dtb_test_fdt_overlay_begin; - void *fdt_overlay_stacked = &__dtb_test_fdt_overlay_stacked_begin; + void *fdt_overlay = &__dtbo_test_fdt_overlay_begin; + void *fdt_overlay_stacked = &__dtbo_test_fdt_overlay_stacked_begin; void *fdt_overlay_copy, *fdt_overlay_stacked_copy; int ret = -ENOMEM;
diff --git a/test/overlay/test-fdt-overlay-stacked.dts b/test/overlay/test-fdt-overlay-stacked.dtso similarity index 100% rename from test/overlay/test-fdt-overlay-stacked.dts rename to test/overlay/test-fdt-overlay-stacked.dtso diff --git a/test/overlay/test-fdt-overlay.dts b/test/overlay/test-fdt-overlay.dtso similarity index 100% rename from test/overlay/test-fdt-overlay.dts rename to test/overlay/test-fdt-overlay.dtso

On Wed, 10 Jul 2024 at 09:17, Rasmus Villemoes rasmus.villemoes@prevas.dk wrote:
Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo.
In this case, the files are really meant to be compiled to .dtbo -> .dtbo.S -> .dtbo.o that get embedded in the image, which means that the begin/end symbols generated by the makefile rule changes to __dtbo_ rather than __dtb, so the consuming .c file needs updating, but this should not result in any functional change.
Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources.
Cc: Maxime Ripard maxime.ripard@free-electrons.com Cc: Simon Glass sjg@chromium.org Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk
test/overlay/Makefile | 4 ++-- test/overlay/cmd_ut_overlay.c | 8 ++++---- ...-overlay-stacked.dts => test-fdt-overlay-stacked.dtso} | 0 .../{test-fdt-overlay.dts => test-fdt-overlay.dtso} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename test/overlay/{test-fdt-overlay-stacked.dts => test-fdt-overlay-stacked.dtso} (100%) rename test/overlay/{test-fdt-overlay.dts => test-fdt-overlay.dtso} (100%)
Reviewed-by: Simon Glass sjg@chromium.org

Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo.
Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources, and eventually eliminating all .dts -> .dtbo instances.
This also matches the documentation update done in commit 4fb7e570d6b.
Cc: Masahisa Kojima kojima.masahisa@socionext.com Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk --- test/py/tests/test_efi_capsule/conftest.py | 6 +++--- .../py/tests/test_efi_capsule/{version.dts => version.dtso} | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename test/py/tests/test_efi_capsule/{version.dts => version.dtso} (100%)
diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py index 80b12977d6f..61eab5112a1 100644 --- a/test/py/tests/test_efi_capsule/conftest.py +++ b/test/py/tests/test_efi_capsule/conftest.py @@ -53,7 +53,7 @@ def efi_capsule_data(request, u_boot_config):
# Update dtb to add the version information check_call('cd %s; ' - 'cp %s/test/py/tests/test_efi_capsule/version.dts .' + 'cp %s/test/py/tests/test_efi_capsule/version.dtso .' % (data_dir, u_boot_config.source_dir), shell=True)
if capsule_auth_enabled: @@ -61,13 +61,13 @@ def efi_capsule_data(request, u_boot_config): 'cp %s/arch/sandbox/dts/test.dtb test_sig.dtb' % (data_dir, u_boot_config.build_dir), shell=True) check_call('cd %s; ' - 'dtc -@ -I dts -O dtb -o version.dtbo version.dts; ' + 'dtc -@ -I dts -O dtb -o version.dtbo version.dtso; ' 'fdtoverlay -i test_sig.dtb ' '-o test_ver.dtb version.dtbo' % (data_dir), shell=True) else: check_call('cd %s; ' - 'dtc -@ -I dts -O dtb -o version.dtbo version.dts; ' + 'dtc -@ -I dts -O dtb -o version.dtbo version.dtso; ' 'fdtoverlay -i %s/arch/sandbox/dts/test.dtb ' '-o test_ver.dtb version.dtbo' % (data_dir, u_boot_config.build_dir), shell=True) diff --git a/test/py/tests/test_efi_capsule/version.dts b/test/py/tests/test_efi_capsule/version.dtso similarity index 100% rename from test/py/tests/test_efi_capsule/version.dts rename to test/py/tests/test_efi_capsule/version.dtso

On Wed, 10 Jul 2024 at 09:18, Rasmus Villemoes rasmus.villemoes@prevas.dk wrote:
Distinguish more clearly between source files meant for producing .dtb from those meant for producing .dtbo.
Note that in the linux tree, all device tree overlay sources have been renamed to .dtso, and the .dts->.dtbo rule is gone since v6.5 (commit 81d362732bac). So this is also a step towards staying closer to linux with respect to both Kbuild and device tree sources, and eventually eliminating all .dts -> .dtbo instances.
This also matches the documentation update done in commit 4fb7e570d6b.
Cc: Masahisa Kojima kojima.masahisa@socionext.com Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk
test/py/tests/test_efi_capsule/conftest.py | 6 +++--- .../py/tests/test_efi_capsule/{version.dts => version.dtso} | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename test/py/tests/test_efi_capsule/{version.dts => version.dtso} (100%)
Reviewed-by: Simon Glass sjg@chromium.org

[equivalent to linux commit 81d362732bac]
As a follow up to the series allowing DTB overlays to built from .dtso files. Now that all overlays have been renamed, remove the ability to build from overlays from .dts files to prevent any files with the old name from accidental being added.
Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk --- scripts/Makefile.lib | 3 --- 1 file changed, 3 deletions(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 549c3619472..d6fbf9a7659 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -416,9 +416,6 @@ cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \ -d $(depfile).dtc.tmp $(dtc-tmp) ; \ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
-$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE - $(call if_changed_dep,dtco) - $(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE $(call if_changed_dep,dtco)

On Wed, 10 Jul 2024 at 09:18, Rasmus Villemoes rasmus.villemoes@prevas.dk wrote:
[equivalent to linux commit 81d362732bac]
As a follow up to the series allowing DTB overlays to built from .dtso files. Now that all overlays have been renamed, remove the ability to build from overlays from .dts files to prevent any files with the old name from accidental being added.
Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk
scripts/Makefile.lib | 3 --- 1 file changed, 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, 10 Jul 2024 09:16:07 +0200, Rasmus Villemoes wrote:
This is a followup to the patches that landed in 2024.01 and nearly made sure that source files for producing .dtbo files use the .dtso extension. In the same release, a few new .dts files snuck in, and there was also some test code involving .dtbo -> .dtbo.S -> .dtbo.o I didn't really know how to handle at the time. This should finish the job, bring us in sync with linux (at least in this respect), and drop the .dts -> .dtbo build rule.
[...]
Applied to u-boot/master, thanks!
participants (4)
-
Marek Vasut
-
Rasmus Villemoes
-
Simon Glass
-
Tom Rini