Skip to contentSkip to conversation

kbuild: Add wilddt function instead of listing dtbs

PATCH In review Leonard Crestez 2 participants 7 messages Jan 7, 2019 – Jan 30, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover kbuild: Add wilddt function instead of listing dtbs

The dts makefiles go through a lot of pointless churn when boards are added. Many SOCs (such as imx) have very simple naming conventions for all boards using a certain chip and board listings can be easily collapsed using wildcards.

Add a "wilddt" function and use it for imx6/7/8 and layerscape. This can be applied to many other soc families later.

Previously sent as RFC: https://lore.kernel.org/patchwork/patch/1022737/

Changes since RFC:
* Split into 3-part series
* Move the wilddt to Kbuild.include so that it's available everywhere
* Use $(srctree)/$(src) instead of $(dtstree)
* Also use wilddt in arm64/boot/dts/freescale

Series is against next-20190107, conflicts are to be expected as board list keeps changing.

Leonard Crestez (3):
kbuild: Add wilddt function
ARM: dts: imx: Use wilddt function
arm64: dts: freescale: Use wilddt function

 arch/arm/boot/dts/Makefile             | 201 ++-----------------------
 arch/arm64/boot/dts/freescale/Makefile |  25 +--
 scripts/Kbuild.include                 |   6 +
 3 files changed, 21 insertions(+), 211 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/3 kbuild: Add wilddt function

Many SOCs have very simple naming conventions for all boards using a certain chip and long dtb lists can be collapsed using wildcards.

Since this applied to many architectures add a wilddt function to Kbuild.include. Example usage:

dtb-$CONFIG_SOC_ABC123 += $(call wilddt,abc123-*)

---
 scripts/Kbuild.include | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/Kbuild.include +6 -0
index 46bf1a073f5d..6b8c0cca07c1 100644
@@ -197,10 +197,16 @@ clean := -f $(srctree)/scripts/Makefile.clean obj
 # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.headersinst obj=
 # Usage:
 # $(Q)$(MAKE) $(hdr-inst)=dir
 hdr-inst := -f $(srctree)/scripts/Makefile.headersinst obj
 
+###
+# Return list of .dtb for all .dts matching $1 in current directory
+#
+# Example usage: dtb-$CONFIG_SOC_ABC123 += $(call wilddt,abc123-*)
+wilddt = $(patsubst $(srctree)/$(src)/%.dts,%.dtb, $(wildcard $(srctree)/$(src)/$(1).dts))
+
 # Prefix -I with $(srctree) if it is not an absolute path.
 # skip if -I has no parameter
 addtree = $(if $(patsubst -I%,%,$(1)), \
 $(if $(filter-out -I/% -I./% -I../%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1)),$(1)),$(1))
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/3 ARM: dts: imx: Use wilddt function

In reply to Leonard Crestez

Use the wilddt function instead of listing imx6/7 dts files. This shrinks the makefile and avoids needing future changes when boards are added.

---
 arch/arm/boot/dts/Makefile | 201 ++-----------------------------------
 1 file changed, 11 insertions(+), 190 deletions(-)
arch/arm/boot/dts/Makefile +11 -190
index bd40148a15b2..b71c8af4cd57 100644
@@ -385,206 +385,27 @@ dtb-$(CONFIG_SOC_IMX53) += \
 	imx53-tx53-x03x.dtb \
 	imx53-tx53-x13x.dtb \
 	imx53-usbarmory.dtb \
 	imx53-voipac-bsb.dtb
 dtb-$(CONFIG_SOC_IMX6Q) += \
-	imx6dl-apf6dev.dtb \
-	imx6dl-aristainetos_4.dtb \
-	imx6dl-aristainetos_7.dtb \
-	imx6dl-aristainetos2_4.dtb \
-	imx6dl-aristainetos2_7.dtb \
-	imx6dl-colibri-eval-v3.dtb \
-	imx6dl-cubox-i.dtb \
-	imx6dl-cubox-i-emmc-som-v15.dtb \
-	imx6dl-cubox-i-som-v15.dtb \
-	imx6dl-dfi-fs700-m60.dtb \
-	imx6dl-emcon-avari.dtb \
-	imx6dl-gw51xx.dtb \
-	imx6dl-gw52xx.dtb \
-	imx6dl-gw53xx.dtb \
-	imx6dl-gw54xx.dtb \
-	imx6dl-gw551x.dtb \
-	imx6dl-gw552x.dtb \
-	imx6dl-gw553x.dtb \
-	imx6dl-gw560x.dtb \
-	imx6dl-gw5903.dtb \
-	imx6dl-gw5904.dtb \
-	imx6dl-hummingboard.dtb \
-	imx6dl-hummingboard-emmc-som-v15.dtb \
-	imx6dl-hummingboard-som-v15.dtb \
-	imx6dl-hummingboard2.dtb \
-	imx6dl-hummingboard2-emmc-som-v15.dtb \
-	imx6dl-hummingboard2-som-v15.dtb \
-	imx6dl-icore.dtb \
-	imx6dl-icore-mipi.dtb \
-	imx6dl-icore-rqs.dtb \
-	imx6dl-mamoj.dtb \
-	imx6dl-nit6xlite.dtb \
-	imx6dl-nitrogen6x.dtb \
-	imx6dl-phytec-mira-rdk-nand.dtb \
-	imx6dl-phytec-pbab01.dtb \
-	imx6dl-rex-basic.dtb \
-	imx6dl-riotboard.dtb \
-	imx6dl-sabreauto.dtb \
-	imx6dl-sabrelite.dtb \
-	imx6dl-sabresd.dtb \
-	imx6dl-savageboard.dtb \
-	imx6dl-ts4900.dtb \
-	imx6dl-ts7970.dtb \
-	imx6dl-tx6dl-comtft.dtb \
-	imx6dl-tx6s-8034.dtb \
-	imx6dl-tx6s-8034-mb7.dtb \
-	imx6dl-tx6s-8035.dtb \
-	imx6dl-tx6s-8035-mb7.dtb \
-	imx6dl-tx6u-801x.dtb \
-	imx6dl-tx6u-80xx-mb7.dtb \
-	imx6dl-tx6u-8033.dtb \
-	imx6dl-tx6u-8033-mb7.dtb \
-	imx6dl-tx6u-811x.dtb \
-	imx6dl-tx6u-81xx-mb7.dtb \
-	imx6dl-udoo.dtb \
-	imx6dl-wandboard.dtb \
-	imx6dl-wandboard-revb1.dtb \
-	imx6dl-wandboard-revd1.dtb \
-	imx6q-apalis-eval.dtb \
-	imx6q-apalis-ixora.dtb \
-	imx6q-apalis-ixora-v1.1.dtb \
-	imx6q-apf6dev.dtb \
-	imx6q-arm2.dtb \
-	imx6q-b450v3.dtb \
-	imx6q-b650v3.dtb \
-	imx6q-b850v3.dtb \
-	imx6q-cm-fx6.dtb \
-	imx6q-cubox-i.dtb \
-	imx6q-cubox-i-emmc-som-v15.dtb \
-	imx6q-cubox-i-som-v15.dtb \
-	imx6q-dfi-fs700-m60.dtb \
-	imx6q-dhcom-pdk2.dtb \
-	imx6q-display5-tianma-tm070-1280x768.dtb \
-	imx6q-dmo-edmqmx6.dtb \
-	imx6q-dms-ba16.dtb \
-	imx6q-emcon-avari.dtb \
-	imx6q-evi.dtb \
-	imx6q-gk802.dtb \
-	imx6q-gw51xx.dtb \
-	imx6q-gw52xx.dtb \
-	imx6q-gw53xx.dtb \
-	imx6q-gw5400-a.dtb \
-	imx6q-gw54xx.dtb \
-	imx6q-gw551x.dtb \
-	imx6q-gw552x.dtb \
-	imx6q-gw553x.dtb \
-	imx6q-gw560x.dtb \
-	imx6q-gw5903.dtb \
-	imx6q-gw5904.dtb \
-	imx6q-h100.dtb \
-	imx6q-hummingboard.dtb \
-	imx6q-hummingboard-emmc-som-v15.dtb \
-	imx6q-hummingboard-som-v15.dtb \
-	imx6q-hummingboard2.dtb \
-	imx6q-hummingboard2-emmc-som-v15.dtb \
-	imx6q-hummingboard2-som-v15.dtb \
-	imx6q-icore.dtb \
-	imx6q-icore-mipi.dtb \
-	imx6q-icore-ofcap10.dtb \
-	imx6q-icore-ofcap12.dtb \
-	imx6q-icore-rqs.dtb \
-	imx6q-kp-tpc.dtb \
-	imx6q-marsboard.dtb \
-	imx6q-mccmon6.dtb \
-	imx6q-nitrogen6x.dtb \
-	imx6q-nitrogen6_max.dtb \
-	imx6q-nitrogen6_som2.dtb \
-	imx6q-novena.dtb \
-	imx6q-phytec-mira-rdk-emmc.dtb \
-	imx6q-phytec-mira-rdk-nand.dtb \
-	imx6q-phytec-pbab01.dtb \
-	imx6q-pistachio.dtb \
-	imx6q-rex-pro.dtb \
-	imx6q-sabreauto.dtb \
-	imx6q-sabrelite.dtb \
-	imx6q-sabresd.dtb \
-	imx6q-savageboard.dtb \
-	imx6q-sbc6x.dtb \
-	imx6q-tbs2910.dtb \
-	imx6q-ts4900.dtb \
-	imx6q-ts7970.dtb \
-	imx6q-tx6q-1010.dtb \
-	imx6q-tx6q-1010-comtft.dtb \
-	imx6q-tx6q-1020.dtb \
-	imx6q-tx6q-1020-comtft.dtb \
-	imx6q-tx6q-1036.dtb \
-	imx6q-tx6q-1036-mb7.dtb \
-	imx6q-tx6q-10x0-mb7.dtb \
-	imx6q-tx6q-1110.dtb \
-	imx6q-tx6q-11x0-mb7.dtb \
-	imx6q-udoo.dtb \
-	imx6q-utilite-pro.dtb \
-	imx6q-var-dt6customboard.dtb \
-	imx6q-wandboard.dtb \
-	imx6q-wandboard-revb1.dtb \
-	imx6q-wandboard-revd1.dtb \
-	imx6q-zii-rdu2.dtb \
-	imx6qp-nitrogen6_max.dtb \
-	imx6qp-nitrogen6_som2.dtb \
-	imx6qp-phytec-mira-rdk-nand.dtb \
-	imx6qp-sabreauto.dtb \
-	imx6qp-sabresd.dtb \
-	imx6qp-tx6qp-8037.dtb \
-	imx6qp-tx6qp-8037-mb7.dtb \
-	imx6qp-tx6qp-8137.dtb \
-	imx6qp-tx6qp-8137-mb7.dtb \
-	imx6qp-wandboard-revd1.dtb \
-	imx6qp-zii-rdu2.dtb
+	$(call wilddt,imx6dl-*) \
+	$(call wilddt,imx6q-*) \
+	$(call wilddt,imx6qp-*)
 dtb-$(CONFIG_SOC_IMX6SL) += \
-	imx6sl-evk.dtb \
-	imx6sl-warp.dtb
+	$(call wilddt,imx6sl-*)
 dtb-$(CONFIG_SOC_IMX6SLL) += \
-	imx6sll-evk.dtb
+	$(call wilddt,imx6sll-*)
 dtb-$(CONFIG_SOC_IMX6SX) += \
-	imx6sx-nitrogen6sx.dtb \
-	imx6sx-sabreauto.dtb \
-	imx6sx-sdb-reva.dtb \
-	imx6sx-sdb-sai.dtb \
-	imx6sx-sdb.dtb \
-	imx6sx-softing-vining-2000.dtb \
-	imx6sx-udoo-neo-basic.dtb \
-	imx6sx-udoo-neo-extended.dtb \
-	imx6sx-udoo-neo-full.dtb
+	$(call wilddt,imx6sx-*)
 dtb-$(CONFIG_SOC_IMX6UL) += \
-	imx6ul-14x14-evk.dtb \
-	imx6ul-ccimx6ulsbcexpress.dtb \
-	imx6ul-ccimx6ulsbcpro.dtb \
-	imx6ul-geam.dtb \
-	imx6ul-isiot-emmc.dtb \
-	imx6ul-isiot-nand.dtb \
-	imx6ul-liteboard.dtb \
-	imx6ul-opos6uldev.dtb \
-	imx6ul-pico-hobbit.dtb \
-	imx6ul-pico-pi.dtb \
-	imx6ul-tx6ul-0010.dtb \
-	imx6ul-tx6ul-0011.dtb \
-	imx6ul-tx6ul-mainboard.dtb \
-	imx6ull-14x14-evk.dtb \
-	imx6ull-colibri-eval-v3.dtb \
-	imx6ull-colibri-wifi-eval-v3.dtb \
-	imx6ulz-14x14-evk.dtb
+	$(call wilddt,imx6ul-*) \
+	$(call wilddt,imx6ull-*) \
+	$(call wilddt,imx6ulz-*)
 dtb-$(CONFIG_SOC_IMX7D) += \
-	imx7d-cl-som-imx7.dtb \
-	imx7d-colibri-emmc-eval-v3.dtb \
-	imx7d-colibri-eval-v3.dtb \
-	imx7d-nitrogen7.dtb \
-	imx7d-pico-hobbit.dtb \
-	imx7d-pico-pi.dtb \
-	imx7d-sbc-imx7.dtb \
-	imx7d-sdb.dtb \
-	imx7d-sdb-reva.dtb \
-	imx7d-sdb-sht11.dtb \
-	imx7s-colibri-eval-v3.dtb \
-	imx7s-warp.dtb
+	$(call wilddt,imx7[ds]-*)
 dtb-$(CONFIG_SOC_IMX7ULP) += \
-	imx7ulp-evk.dtb
+	$(call wilddt,imx7ulp-*)
 dtb-$(CONFIG_SOC_LS1021A) += \
 	ls1021a-moxa-uc-8410a.dtb \
 	ls1021a-qds.dtb \
 	ls1021a-twr.dtb
 dtb-$(CONFIG_SOC_VF610) += \
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/3 arm64: dts: freescale: Use wilddt function

In reply to Leonard Crestez

Use the wilddt function instead of listing dts files. This shrinks the makefile and avoids needing future changes when boards are added.

---
 arch/arm64/boot/dts/freescale/Makefile | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)
arch/arm64/boot/dts/freescale/Makefile +4 -21
index f9be2426f83c..ab28e485179d 100644
@@ -1,22 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1012a-frdm.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1012a-frwy.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1012a-qds.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1012a-rdb.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1028a-qds.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1028a-rdb.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1043a-qds.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1043a-rdb.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1046a-qds.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1046a-rdb.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1088a-qds.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1088a-rdb.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2080a-qds.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2080a-rdb.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2080a-simu.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2088a-qds.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls2088a-rdb.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-qds.dtb
-dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-lx2160a-rdb.dtb
-
-dtb-$(CONFIG_ARCH_MXC) += imx8mq-evk.dtb
+dtb-$(CONFIG_ARCH_LAYERSCAPE) += \
+	$(call wilddt,fsl-ls*) \
+	$(call wilddt,fsl-lx*)
+dtb-$(CONFIG_ARCH_MXC) += $(call wilddt,imx*)
Signature · 1 line
2.17.1
#4 lore raw
In reply to Leonard Crestez
Quoted 9 lines · Leonard Crestez

The dts makefiles go through a lot of pointless churn when boards are added. Many SOCs (such as imx) have very simple naming conventions for all boards using a certain chip and board listings can be easily collapsed using wildcards.

Add a "wilddt" function and use it for imx6/7/8 and layerscape. This can be applied to many other soc families later.

Previously sent as RFC: https://lore.kernel.org/patchwork/patch/1022737/

Any feedback? This should be reviewed by kbuild and arm-soc

I think this is a worthwhile cleanup, are there any corner cases or more exotic setup I should try in order to validate this series?

--
Regards,
Leonard

#5 lore raw
Quoted 10 lines · Leonard Crestez
Quoted 8 lines · Leonard Crestez

The dts makefiles go through a lot of pointless churn when boards are added. Many SOCs (such as imx) have very simple naming conventions for all boards using a certain chip and board listings can be easily collapsed using wildcards.

Add a "wilddt" function and use it for imx6/7/8 and layerscape. This can be applied to many other soc families later.

Quoted 6 lines
Quoted 1 line

Previously sent as RFC: https://lore.kernel.org/patchwork/patch/1022737/

Any feedback? This should be reviewed by kbuild and arm-soc

I think this is a worthwhile cleanup, are there any corner cases or more exotic setup I should try in order to validate this series?

Personally, I prefer explicit listing
because I can browse the Makefile to get a quick idea of which boards are compiled.

I like this to be consistent.

- Exploit wildcard for all platforms

or

- Do not do this at all

But, I am pessimistic about the former
when I look at AT91 platform.

Signature · 2 lines
Best Regards
Masahiro Yamada
#6 lore raw
Quoted 8 lines · Masahiro Yamada
Quoted 7 lines · Leonard Crestez
Quoted 5 lines · Leonard Crestez

The dts makefiles go through a lot of pointless churn when boards are added. Many SOCs (such as imx) have very simple naming conventions for all boards using a certain chip and board listings can be easily collapsed using wildcards.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Add a "wilddt" function and use it for imx6/7/8 and layerscape. This can be applied to many other soc families later.

Any feedback? This should be reviewed by kbuild and arm-soc

Personally, I prefer explicit listing
because I can browse the Makefile to get a quick idea of which boards are compiled.

Or you can just ls soc-*.dts?

Quoted 6 lines

I like this to be consistent.
- Exploit wildcard for all platforms
- Do not do this at all

But, I am pessimistic about the former
when I look at AT91 platform.

I can try to resend in a form that uses a wildcard for most platforms but skips those with very few SOCs or confusing conventions (like at91).

--
Regards,
Leonard