fix dtb overlay compilation and installation

* rename .dts sources in overlay directory as *.dtso
 * change "target +=" line in "dts-y +=" in overlay Makefile
 * remove "always +=" line in overlay Makefile
 * add .scr compilation support in kernel scripts/Makefile.lib
 * patch kernel scripts/Makefile.dtbinst to avoid flattening overlay
   directory

for the last two points, see
general-add-overlay-compilation-support.patch
This commit is contained in:
Paolo Sabatino 2024-06-02 22:02:11 +02:00 committed by Igor
parent 724573bf7a
commit af5a766940
42 changed files with 44 additions and 86 deletions

View File

@ -1,10 +1,10 @@
config:
# Just some info stuff; not used by the patching scripts
name: rockchip-6.7
name: rockchip-6.9
kind: kernel
type: mainline # or: vendor
branch: linux-6.7.y
last-known-good-tag: v6.7.0
branch: linux-6.9.y
last-known-good-tag: v6.9.3
maintainers:
- { github: paolo.sabatino, name: Paolo Sabatino, email: paolo.sabatino@gmail.com, armbian-forum: jock }

View File

@ -48,8 +48,7 @@ dtbotxt-$(CONFIG_ARCH_ROCKCHIP) += \
README.rk322x-overlays \
README.rockchip-overlays
targets += $(dtbo-y) $(scr-y) $(dtbotxt-y)
dtb-y += $(dtbo-y) $(scr-y) $(dtbotxt-y)
always := $(dtbo-y) $(scr-y) $(dtbotxt-y)
clean-files := *.dtbo *.scr

View File

@ -1,99 +1,58 @@
diff --git a/arch/arm/boot/.gitignore b/arch/arm/boot/.gitignore
index 3c79f859..4e5c1d59 100644
--- a/arch/arm/boot/.gitignore
+++ b/arch/arm/boot/.gitignore
@@ -3,3 +3,5 @@ zImage
xipImage
bootpImage
uImage
+*.dtb*
+*.scr
From 088e1cd9b9dd113f0a5e9e19a7f31c37532e002a Mon Sep 17 00:00:00 2001
From: Paolo Sabatino <paolo.sabatino@gmail.com>
Date: Sun, 2 Jun 2024 21:53:01 +0200
Subject: [PATCH] compile .scr and install overlays in right path
---
scripts/Makefile.dtbinst | 2 +-
scripts/Makefile.lib | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
index 50d580d77..94bd15617 100644
index 67956f6496a5..1882d264306c 100644
--- a/scripts/Makefile.dtbinst
+++ b/scripts/Makefile.dtbinst
@@ -18,9 +18,12 @@ include scripts/Kbuild.include
include $(src)/Makefile
@@ -33,7 +33,7 @@ endef
dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
+dtbos := $(addprefix $(dst)/overlay/, $(dtbo-y))
+scrs := $(addprefix $(dst)/overlay/, $(scr-y))
+readmes := $(addprefix $(dst)/overlay/, $(dtbotxt-y))
subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
$(foreach d, $(sort $(dir $(dtbs))), $(eval $(call gen_install_rules,$(d))))
-__dtbs_install: $(dtbs) $(subdirs)
+__dtbs_install: $(dtbs) $(dtbos) $(scrs) $(readmes) $(subdirs)
@:
-dtbs := $(notdir $(dtbs))
+dtbs := $(subst rockchip/,,$(dtbs))
quiet_cmd_dtb_install = INSTALL $@
@@ -29,6 +32,18 @@ quiet_cmd_dtb_install = INSTALL $@
$(dst)/%.dtb: $(obj)/%.dtb
$(call cmd,dtb_install)
endif # CONFIG_ARCH_WANT_FLAT_DTB_INSTALL
+$(dst)/overlay/%.dtbo: $(obj)/%.dtbo
+ $(call cmd,dtb_install)
+
+$(dst)/overlay/%.scr: $(obj)/%.scr
+ $(call cmd,dtb_install)
+
+$(dst)/overlay/README.rockchip-overlays: $(src)/README.rockchip-overlays
+ $(call cmd,dtb_install)
+
+$(dst)/overlay/README.rk322x-overlays: $(src)/README.rk322x-overlays
+ $(call cmd,dtb_install)
+
PHONY += $(subdirs)
$(subdirs):
$(Q)$(MAKE) $(dtbinst)=$@ dst=$(patsubst $(obj)/%,$(dst)/%,$@)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 58c05e5d..2b95dda9 100644
index 3179747cbd2c..59925208734a 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -278,6 +278,9 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
# ---------------------------------------------------------------------------
DTC ?= $(objtree)/scripts/dtc/dtc
+# Overlay support
+DTC_FLAGS += -@ -Wno-unit_address_format -Wno-simple_bus_reg
+
# Disable noisy checks by default
ifeq ($(KBUILD_ENABLE_EXTRA_GCC_CHECKS),)
DTC_FLAGS += -Wno-unit_address_vs_reg \
@@ -324,6 +327,23 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
$(obj)/%.dtb: $(src)/%.dts FORCE
$(call if_changed_dep,dtc)
+quiet_cmd_dtco = DTCO $@
+cmd_dtco = mkdir -p $(dir ${dtc-tmp}) ; \
+ $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
+ $(DTC) -O dtb -o $@ -b 0 \
+ -i $(dir $<) $(DTC_FLAGS) \
+ -d $(depfile).dtc.tmp $(dtc-tmp) ; \
+ cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
+
+$(obj)/%.dtbo: $(src)/%.dts FORCE
+ $(call if_changed_dep,dtco)
+
@@ -398,7 +398,7 @@ $(obj)/%.dtbo.S: $(obj)/%.dtbo FORCE
quiet_cmd_dtc = DTC $@
cmd_dtc = $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
- $(DTC) -o $@ -b 0 \
+ $(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)
@@ -423,12 +423,18 @@ quiet_cmd_dtb = $(quiet_cmd_dtc)
cmd_dtb = $(cmd_dtc)
endif
+quiet_cmd_scr = MKIMAGE $@
+cmd_scr = mkimage -C none -A $(ARCH) -T script -d $< $@
+
$(obj)/%.dtb: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
$(call if_changed_dep,dtb)
$(obj)/%.dtbo: $(src)/%.dtso $(DTC) FORCE
$(call if_changed_dep,dtc)
+$(obj)/%.scr: $(src)/%.scr-cmd FORCE
+ $(call if_changed,scr)
+
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
# Bzip2
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 41c50f9461e5..387659d5b252 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -79,6 +79,9 @@ header-test-y += $(filter-out $(header-test-), \
--
2.34.1
extra-$(CONFIG_HEADER_TEST) += $(addsuffix .s, $(header-test-y) $(header-test-m))
+# Overlay targets
+extra-y += $(dtbo-y) $(scr-y) $(dtbotxt-y)
+
# Add subdir path
extra-y := $(addprefix $(obj)/,$(extra-y))

View File

@ -35,7 +35,7 @@
patches.armbian/dts-tinkerboard-sdmmc-properties.patch
patches.armbian/dts-tinkerboard-spi-interface.patch
patches.armbian/dts-veyron-flag-cache-flush.patch
-patches.armbian/general-add-overlay-compilation-support.patch
patches.armbian/general-add-overlay-compilation-support.patch
patches.armbian/general-add-overlay-configfs.patch
patches.armbian/general-add-restart-handler-for-act8846.patch
patches.armbian/general-dwc2-fix-wait-peripheral.patch