From 9834ff87ee93495982c223bea78206bda5955e89 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.lib | 12 +++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 58fdbb35e2f1..0d683e66d33b 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ *.rpm *.rsi *.s +*.scr *.so *.so.dbg *.su diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst index 9d920419a62c..d0703c2148cf 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.lib b/scripts/Makefile.lib index 01a9f567d5af..671997e3ac92 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -75,6 +75,9 @@ always-y += $(hostprogs-always-y) $(hostprogs-always-m) userprogs += $(userprogs-always-y) $(userprogs-always-m) always-y += $(userprogs-always-y) $(userprogs-always-m) +# Overlay Fixup script targets +extra-y += $(scr-y) $(dtbotxt-y) + # Add subdir path ifneq ($(obj),.) @@ -377,6 +380,15 @@ quiet_cmd_lz4_with_size = LZ4 $@ cmd_lz4_with_size = { cat $(real-prereqs) | $(LZ4) -l -c1 stdin stdout; \ $(size_append); } > $@ +# Fixup script mkimage provided by Armbian +# --------------------------------------------------------------------------- + +quiet_cmd_scr = FIXUP IMAGE $@ + cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@ + +$(obj)/%.scr: $(src)/%.scr-cmd FORCE + $(call if_changed,scr) + # U-Boot mkimage # --------------------------------------------------------------------------- -- 2.35.3