From 3b7653db7b638c6033ad24f87325a6b4a4895dee Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 10 Jul 2024 09:16:08 +0200 Subject: [PATCH 1/5] arm64: dts: imx8mp: rename DHCOM SoM overlays to .dtso 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 Signed-off-by: Rasmus Villemoes Reviewed-by: Marek Vasut --- ...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 */ -#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 From 06518fdf24e5fdf3561eb66c00bd8946cf5b0e58 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 10 Jul 2024 09:16:09 +0200 Subject: [PATCH 2/5] kbuild: Allow DTB overlays to built into .dtbo.S files [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 --- 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 From 03e36e38e86a123be148259c7dc97da6ceab700e Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 10 Jul 2024 09:16:10 +0200 Subject: [PATCH 3/5] test: overlay: rename overlay source files to .dtso 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 Cc: Simon Glass Signed-off-by: Rasmus Villemoes --- 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 From 7c996f244374ef7a3dac6d8effe1152ee21b9ef6 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 10 Jul 2024 09:16:11 +0200 Subject: [PATCH 4/5] test/py: efi_capsule: rename device tree overlay source to .dtso 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 Signed-off-by: Rasmus Villemoes --- 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 From e1ad98ed9b2868f0f2930738f63e4e58b0de9b04 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 10 Jul 2024 09:16:12 +0200 Subject: [PATCH 5/5] kbuild: Disallow DTB overlays to built from .dts named source files [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 --- 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)