summaryrefslogtreecommitdiff
path: root/scripts/Makefile.lib
diff options
context:
space:
mode:
authorAndrew Davis <afd@ti.com>2022-10-24 12:34:29 -0500
committerRob Herring <robh@kernel.org>2022-10-26 09:01:34 -0500
commit941214a512d8c80d47e720c17ec17e8539175e93 (patch)
tree02e2f9bd44b6b59ed65e6731c775dcb533be08d2 /scripts/Makefile.lib
parent363547d2191cbc32ca954ba75d72908712398ff2 (diff)
kbuild: Allow DTB overlays to built into .dtbo.S files
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. [Based on patch by Frank Rowand <frank.rowand@sony.com>] Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Frank Rowand <frowand.list@gmail.com> Tested-by: Frank Rowand <frowand.list@gmail.com> Link: https://lore.kernel.org/r/20221024173434.32518-3-afd@ti.com Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r--scripts/Makefile.lib20
1 files changed, 19 insertions, 1 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0376a6f18bfb..250b9fd73f6d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -358,7 +358,7 @@ DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
# 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 $@
cmd_dt_S_dtb= \
{ \
echo '\#include <asm-generic/vmlinux.lds.h>'; \
@@ -375,6 +375,24 @@ cmd_dt_S_dtb= \
$(obj)/%.dtb.S: $(obj)/%.dtb FORCE
$(call if_changed,dt_S_dtb)
+# Generate an assembly file to wrap the output of the device tree compiler
+quiet_cmd_dt_S_dtbo= DTBOS $@
+cmd_dt_S_dtbo= \
+{ \
+ echo '\#include <asm-generic/vmlinux.lds.h>'; \
+ echo '.section .dtb.init.rodata,"a"'; \
+ echo '.balign STRUCT_ALIGNMENT'; \
+ 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 STRUCT_ALIGNMENT'; \
+} > $@
+
+$(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
+ $(call if_changed,dt_S_dtbo)
+
quiet_cmd_dtc = DTC $@
cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
$(DTC) -o $@ -b 0 \