From 6d42002a941b273ef304acffa46ac6a2ee2e8b01 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: [PATCH] scripts: add overlay compilation support --- .gitignore | 1 + scripts/Makefile.dtbinst | 16 ++++++++++++++-- scripts/Makefile.lib | 9 +++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9fd4c9533b3d..efb1568385db 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 4405d5b67578..6e3f7fa513d5 100644 --- a/scripts/Makefile.dtbinst +++ b/scripts/Makefile.dtbinst @@ -19,8 +19,10 @@ include $(kbuild-file) dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-))) subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m)) +script-files := $(addprefix $(dst)/, $(scr-y)) +readme-files := $(addprefix $(dst)/, $(dtbotxt-y)) -__dtbs_install: $(dtbs) $(subdirs) +__dtbs_install: $(dtbs) $(script-files) $(readme-files) $(subdirs) @: quiet_cmd_dtb_install = INSTALL $@ @@ -32,8 +34,18 @@ $(dst)/%.dtb: $(obj)/%.dtb $(dst)/%.dtbo: $(obj)/%.dtbo $(call cmd,dtb_install) +$(dst)/%.scr: $(obj)/%.scr + $(call cmd,dtb_install) + +$(dst)/README.%-overlays: $(obj)/README.%-overlays + $(call cmd,dtb_install) + PHONY += $(subdirs) $(subdirs): - $(Q)$(MAKE) $(dtbinst)=$@ dst=$(if $(CONFIG_ARCH_WANT_FLAT_DTB_INSTALL),$(dst),$(patsubst $(obj)/%,$(dst)/%,$@)) + $(Q)if [ $(subst $(obj)/,,$@) = overlay ]; then \ + $(MAKE) $(dtbinst)=$@ dst=$(patsubst $(obj)/%,$(dst)/%,$@); \ + else \ + $(MAKE) $(dtbinst)=$@ dst=$(if $(CONFIG_ARCH_WANT_FLAT_DTB_INSTALL),$(dst),$(patsubst $(obj)/%,$(dst)/%,$@)); \ + fi .PHONY: $(PHONY) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 903e980bc775..2a72c4668ae7 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -88,6 +88,9 @@ base-dtb-y := $(foreach m, $(multi-dtb-y), $(firstword $(call suffix-search, $m, always-y += $(dtb-y) +# Overlay Fixup script targets +extra-y += $(scr-y) $(dtbotxt-y) + # Add subdir path ifneq ($(obj),.) @@ -422,6 +425,12 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE $(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE $(call if_changed_dep,dtc) +quiet_cmd_scr = MKIMAGE $@ +cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@ + +$(obj)/%.scr: $(src)/%.scr-cmd FORCE + $(call if_changed,scr) + dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) # Bzip2 -- 2.34.1