Merge patch series "finish using .dtso for overlay source files"

Rasmus Villemoes <rasmus.villemoes@prevas.dk> says:

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.
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 82dadce..f2d768c 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
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index f66a65d..df754d1 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -305,7 +305,7 @@
 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 @@
 $(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
@@ -404,9 +422,6 @@
 		-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)
 
diff --git a/test/overlay/Makefile b/test/overlay/Makefile
index 2deec92..47937e3 100644
--- a/test/overlay/Makefile
+++ b/test/overlay/Makefile
@@ -10,5 +10,5 @@
 
 # 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 bcb29a2..256afd1 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 @@
 	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
diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py
index 80b1297..61eab51 100644
--- a/test/py/tests/test_efi_capsule/conftest.py
+++ b/test/py/tests/test_efi_capsule/conftest.py
@@ -53,7 +53,7 @@
 
         # 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 @@
                        '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