From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Tue, 1 Feb 2022 21:04:08 +0300 Subject: scripts: add overlay compilation support --- .gitignore | 1 + scripts/Makefile.dtbinst | 12 +++++++++- scripts/Makefile.dtbs | 10 +++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 111111111111..222222222222 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ *.rpm *.rsi *.s +*.scr *.so *.so.dbg *.su diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst index 111111111111..222222222222 100644 --- a/scripts/Makefile.dtbinst +++ b/scripts/Makefile.dtbinst @@ -23,6 +23,11 @@ $(dst)/%: $(obj)/% $(call cmd,dtb_install) dtbs := $(patsubst $(obj)/%,%,$(call read-file, $(obj)/dtbs-list)) +vendor := $(sort $(dir $(filter %.dtb, $(dtbs)))) +subdir := $(sort $(dir $(filter %.dtbo, $(dtbs)))) + +dtbs += $(patsubst $(obj)/%,%,$(if $(subdir), $(shell cd $(srctree)/$(obj) && find $(subdir) -name '*.scr'))) +dtbs += $(patsubst $(obj)/%,%,$(if $(subdir), $(shell cd $(srctree)/$(obj) && find $(subdir) -name 'README.*-overlays'))) ifdef CONFIG_ARCH_WANT_FLAT_DTB_INSTALL @@ -33,7 +38,12 @@ endef $(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d)))) -dtbs := $(notdir $(dtbs)) +# Armbian uses subdirectories for arm +# and for arm64. +# delete the vendor's directory if the target architecture is an arm. +ifdef CONFIG_ARM +dtbs := $(patsubst $(vendor)%,%,$(dtbs)) +endif endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL diff --git a/scripts/Makefile.dtbs b/scripts/Makefile.dtbs index 111111111111..222222222222 100644 --- a/scripts/Makefile.dtbs +++ b/scripts/Makefile.dtbs @@ -123,11 +123,19 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) quiet_cmd_dtc = DTC $(quiet_dtb_check_tag) $@ cmd_dtc = \ $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \ - $(DTC) -o $@ -b 0 $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) \ + $(DTC) -@ -o $@ -b 0 $(addprefix -i,$(dir $<) $(DTC_INCLUDE)) \ $(DTC_FLAGS) -d $(depfile).dtc.tmp $(dtc-tmp) ; \ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) \ $(cmd_dtb_check) +# Fixup script mkimage provided by Armbian +# --------------------------------------------------------------------------- +quiet_cmd_scr = MKIMAGE $@ + cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@ + +$(obj)/%.scr: $(src)/%.scr-cmd FORCE + $(call if_changed,scr) + $(obj)/%.dtb: $(obj)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE $(call if_changed_dep,dtc) -- Armbian