From 06518fdf24e5fdf3561eb66c00bd8946cf5b0e58 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 10 Jul 2024 09:16:09 +0200 Subject: 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(-) (limited to 'scripts') 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 -- cgit v1.2.3 From e1ad98ed9b2868f0f2930738f63e4e58b0de9b04 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Wed, 10 Jul 2024 09:16:12 +0200 Subject: 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(-) (limited to 'scripts') 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) -- cgit v1.2.3