From 0cf59095088e7edbc589007aa1e046a5620da261 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Fri, 26 Nov 2021 11:39:35 +0100 Subject: mips, mipsel: kernel-*: rework device-tree handling This ports the kernel template part of PTXdist commit f50cd1449e934730: | commit f50cd1449e9347309b1050b0b738882dac1954e9 | Author: Michael Olbrich | Date: 2021-07-09 17:25:41 | | rework device-tree handling | | It's not really possible to build a dtb by itself. A lot of included dtsi | and header files are needed. So build the device-trees with the package | that provides these files. Currently that's the kernel package. | | This also means, that other kernel packages can have their own device-trees | as well. | | Signed-off-by: Michael Olbrich Set KERNEL_*_DTS to the current values of PTXCONF_DTC_OFTREE_DTS from the platformconfig, as this symbol will vanish when migrating to the next PTXdist version. Link: https://git.pengutronix.de/cgit/ptxdist/commit/?id=f50cd1449e9347309b10 Signed-off-by: Roland Hieber Link: https://lore.pengutronix.de/20211126103937.2856148-3-rhi@pengutronix.de Signed-off-by: Robert Schwebel --- configs/platform-mips/rules/kernel-ar9331.make | 31 +++++++++++++++++++++++++ configs/platform-mips/rules/kernel-malta.make | 31 +++++++++++++++++++++++++ configs/platform-mipsel/rules/kernel-malta.make | 31 +++++++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/configs/platform-mips/rules/kernel-ar9331.make b/configs/platform-mips/rules/kernel-ar9331.make index b4a33fb..7b9782d 100644 --- a/configs/platform-mips/rules/kernel-ar9331.make +++ b/configs/platform-mips/rules/kernel-ar9331.make @@ -25,10 +25,16 @@ KERNEL_AR9331_DIR := $(BUILDDIR)/$(KERNEL_AR9331) KERNEL_AR9331_BUILD_DIR := $(KERNEL_AR9331_DIR)-build KERNEL_AR9331_CONFIG := $(call ptx/in-platformconfigdir, kernelconfig-ar9331) KERNEL_AR9331_REF_CONFIG := $(call ptx/in-platformconfigdir, kernelconfig) +KERNEL_AR9331_DTS_PATH := ${PTXDIST_PLATFORMCONFIG_SUBDIR}/dts:${KERNEL_AR9331_DIR}/arch/${GENERIC_KERNEL_ARCH}/boot/dts/qca +KERNEL_AR9331_DTS := ar9331_dpt_module.dts +KERNEL_AR9331_DTB_FILES := $(addsuffix .dtb,$(basename $(KERNEL_AR9331_DTS))) KERNEL_AR9331_LICENSE := GPL-2.0-only KERNEL_AR9331_LICENSE_FILES := KERNEL_AR9331_BUILD_OOT := KEEP +# track changes to devices-trees in the BSP +$(call world/dts-cfghash-file, KERNEL_AR9331) + # ---------------------------------------------------------------------------- # Prepare # ---------------------------------------------------------------------------- @@ -90,6 +96,12 @@ KERNEL_AR9331_INSTALL_OPT := \ $(call kernel-opts, KERNEL_AR9331) \ modules_install +$(STATEDIR)/kernel-ar9331.install: + @$(call targetinfo) + @$(call world/install, KERNEL_AR9331) + @$(call world/dtb, KERNEL_AR9331) + @$(call touch) + # ---------------------------------------------------------------------------- # Target-Install # ---------------------------------------------------------------------------- @@ -101,6 +113,11 @@ $(STATEDIR)/kernel-ar9331.targetinstall: install -v -m 644 $(image) \ $(IMAGEDIR)/$(notdir $(image))-ar9331$(ptx/nl)) + @$(foreach dtb ,$(KERNEL_AR9331_DTB_FILES), \ + echo -e "Installing $(dtb) ...\n"$(ptx/nl) \ + install -D -m0644 $(KERNEL_AR9331_PKGDIR)/boot/$(dtb) \ + $(IMAGEDIR)/$(dtb)$(ptx/nl)) + @$(call install_init, kernel-ar9331) @$(call install_fixup, kernel-ar9331, PRIORITY,optional) @$(call install_fixup, kernel-ar9331, SECTION,base) @@ -110,6 +127,10 @@ $(STATEDIR)/kernel-ar9331.targetinstall: @$(call install_copy, kernel-ar9331, 0, 0, 0644, \ $(IMAGEDIR)/vmlinuz-ar9331, /boot/vmlinuz-ar9331, n) + @$(foreach dtb, $(KERNEL_AR9331_DTB_FILES), \ + $(call install_copy, kernel-ar9331, 0, 0, 0644, -, \ + /boot/$(dtb), n)$(ptx/nl)) + @$(call install_glob, kernel-ar9331, 0, 0, -, /lib/modules, *.ko,, n) @$(call install_glob, kernel-ar9331, 0, 0, -, /lib/modules,, *.ko */build */source, n) @@ -117,6 +138,16 @@ $(STATEDIR)/kernel-ar9331.targetinstall: @$(call touch) +# ---------------------------------------------------------------------------- +# Clean +# ---------------------------------------------------------------------------- + +$(STATEDIR)/kernel-ar9331.clean: + @$(call targetinfo) + @$(call clean_pkg, KERNEL_AR9331) + @$(foreach dtb,$(KERNEL_AR9331_DTB_FILES), \ + rm -vf $(IMAGEDIR)/$(dtb)$(ptx/nl)) + # ---------------------------------------------------------------------------- # oldconfig / menuconfig # ---------------------------------------------------------------------------- diff --git a/configs/platform-mips/rules/kernel-malta.make b/configs/platform-mips/rules/kernel-malta.make index 1d8b72c..c5028b9 100644 --- a/configs/platform-mips/rules/kernel-malta.make +++ b/configs/platform-mips/rules/kernel-malta.make @@ -25,10 +25,16 @@ KERNEL_MALTA_DIR := $(BUILDDIR)/$(KERNEL_MALTA) KERNEL_MALTA_BUILD_DIR := $(KERNEL_MALTA_DIR)-build KERNEL_MALTA_CONFIG := $(call ptx/in-platformconfigdir, kernelconfig-malta) KERNEL_MALTA_REF_CONFIG := $(call ptx/in-platformconfigdir, kernelconfig) +KERNEL_MALTA_DTS_PATH := ${PTXDIST_PLATFORMCONFIG_SUBDIR}/dts:${KERNEL_MALTA_DIR}/arch/${GENERIC_KERNEL_ARCH}/boot/dts/mti +KERNEL_MALTA_DTS := malta.dts +KERNEL_MALTA_DTB_FILES := $(addsuffix .dtb,$(basename $(KERNEL_MALTA_DTS))) KERNEL_MALTA_LICENSE := GPL-2.0-only KERNEL_MALTA_LICENSE_FILES := KERNEL_MALTA_BUILD_OOT := KEEP +# track changes to devices-trees in the BSP +$(call world/dts-cfghash-file, KERNEL_MALTA) + # ---------------------------------------------------------------------------- # Prepare # ---------------------------------------------------------------------------- @@ -90,6 +96,12 @@ KERNEL_MALTA_INSTALL_OPT := \ $(call kernel-opts, KERNEL_MALTA) \ modules_install +$(STATEDIR)/kernel-malta.install: + @$(call targetinfo) + @$(call world/install, KERNEL_MALTA) + @$(call world/dtb, KERNEL_MALTA) + @$(call touch) + # ---------------------------------------------------------------------------- # Target-Install # ---------------------------------------------------------------------------- @@ -101,6 +113,11 @@ $(STATEDIR)/kernel-malta.targetinstall: install -v -m 644 $(image) \ $(IMAGEDIR)/$(notdir $(image))-malta$(ptx/nl)) + @$(foreach dtb ,$(KERNEL_MALTA_DTB_FILES), \ + echo -e "Installing $(dtb) ...\n"$(ptx/nl) \ + install -D -m0644 $(KERNEL_MALTA_PKGDIR)/boot/$(dtb) \ + $(IMAGEDIR)/$(dtb)$(ptx/nl)) + @$(call install_init, kernel-malta) @$(call install_fixup, kernel-malta, PRIORITY,optional) @$(call install_fixup, kernel-malta, SECTION,base) @@ -110,6 +127,10 @@ $(STATEDIR)/kernel-malta.targetinstall: @$(call install_copy, kernel-malta, 0, 0, 0644, \ $(IMAGEDIR)/vmlinuz-malta, /boot/vmlinuz-malta, n) + @$(foreach dtb, $(KERNEL_MALTA_DTB_FILES), \ + $(call install_copy, kernel-malta, 0, 0, 0644, -, \ + /boot/$(dtb), n)$(ptx/nl)) + @$(call install_glob, kernel-malta, 0, 0, -, /lib/modules, *.ko,, n) @$(call install_glob, kernel-malta, 0, 0, -, /lib/modules,, *.ko */build */source, n) @@ -117,6 +138,16 @@ $(STATEDIR)/kernel-malta.targetinstall: @$(call touch) +# ---------------------------------------------------------------------------- +# Clean +# ---------------------------------------------------------------------------- + +$(STATEDIR)/kernel-malta.clean: + @$(call targetinfo) + @$(call clean_pkg, KERNEL_MALTA) + @$(foreach dtb,$(KERNEL_MALTA_DTB_FILES), \ + rm -vf $(IMAGEDIR)/$(dtb)$(ptx/nl)) + # ---------------------------------------------------------------------------- # oldconfig / menuconfig # ---------------------------------------------------------------------------- diff --git a/configs/platform-mipsel/rules/kernel-malta.make b/configs/platform-mipsel/rules/kernel-malta.make index 94f49b8..c2bea47 100644 --- a/configs/platform-mipsel/rules/kernel-malta.make +++ b/configs/platform-mipsel/rules/kernel-malta.make @@ -25,10 +25,16 @@ KERNEL_MALTA_DIR := $(BUILDDIR)/$(KERNEL_MALTA) KERNEL_MALTA_BUILD_DIR := $(KERNEL_MALTA_DIR)-build KERNEL_MALTA_CONFIG := $(call ptx/in-platformconfigdir, kernelconfig-malta) KERNEL_MALTA_REF_CONFIG := $(call ptx/in-platformconfigdir, kernelconfig) +KERNEL_MALTA_DTS_PATH := ${PTXDIST_PLATFORMCONFIG_SUBDIR}/dts:${KERNEL_MALTA_DIR}/arch/${GENERIC_KERNEL_ARCH}/boot/dts/mti +KERNEL_MALTA_DTS := malta.dts +KERNEL_MALTA_DTB_FILES := $(addsuffix .dtb,$(basename $(KERNEL_MALTA_DTS))) KERNEL_MALTA_LICENSE := GPL-2.0-only KERNEL_MALTA_LICENSE_FILES := KERNEL_MALTA_BUILD_OOT := KEEP +# track changes to devices-trees in the BSP +$(call world/dts-cfghash-file, KERNEL_MALTA) + # ---------------------------------------------------------------------------- # Prepare # ---------------------------------------------------------------------------- @@ -90,6 +96,12 @@ KERNEL_MALTA_INSTALL_OPT := \ $(call kernel-opts, KERNEL_MALTA) \ modules_install +$(STATEDIR)/kernel-malta.install: + @$(call targetinfo) + @$(call world/install, KERNEL_MALTA) + @$(call world/dtb, KERNEL_MALTA) + @$(call touch) + # ---------------------------------------------------------------------------- # Target-Install # ---------------------------------------------------------------------------- @@ -101,6 +113,11 @@ $(STATEDIR)/kernel-malta.targetinstall: install -v -m 644 $(image) \ $(IMAGEDIR)/$(notdir $(image))-malta$(ptx/nl)) + @$(foreach dtb ,$(KERNEL_MALTA_DTB_FILES), \ + echo -e "Installing $(dtb) ...\n"$(ptx/nl) \ + install -D -m0644 $(KERNEL_MALTA_PKGDIR)/boot/$(dtb) \ + $(IMAGEDIR)/$(dtb)$(ptx/nl)) + @$(call install_init, kernel-malta) @$(call install_fixup, kernel-malta, PRIORITY,optional) @$(call install_fixup, kernel-malta, SECTION,base) @@ -110,6 +127,10 @@ $(STATEDIR)/kernel-malta.targetinstall: @$(call install_copy, kernel-malta, 0, 0, 0644, \ $(IMAGEDIR)/vmlinuz-malta, /boot/vmlinuz-malta, n) + @$(foreach dtb, $(KERNEL_MALTA_DTB_FILES), \ + $(call install_copy, kernel-malta, 0, 0, 0644, -, \ + /boot/$(dtb), n)$(ptx/nl)) + @$(call install_glob, kernel-malta, 0, 0, -, /lib/modules, *.ko,, n) @$(call install_glob, kernel-malta, 0, 0, -, /lib/modules,, *.ko */build */source, n) @@ -117,6 +138,16 @@ $(STATEDIR)/kernel-malta.targetinstall: @$(call touch) +# ---------------------------------------------------------------------------- +# Clean +# ---------------------------------------------------------------------------- + +$(STATEDIR)/kernel-malta.clean: + @$(call targetinfo) + @$(call clean_pkg, KERNEL_MALTA) + @$(foreach dtb,$(KERNEL_MALTA_DTB_FILES), \ + rm -vf $(IMAGEDIR)/$(dtb)$(ptx/nl)) + # ---------------------------------------------------------------------------- # oldconfig / menuconfig # ---------------------------------------------------------------------------- -- cgit v1.2.3