From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Felix Singer <felixsinger@posteo.net>,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 05/13] kbuild: restrict dtbs target to enabled DTs by default
Date: Sun, 12 Jan 2025 09:34:24 +0100 [thread overview]
Message-ID: <20250112083432.320215-6-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250112083432.320215-1-a.fatoum@pengutronix.de>
Our existing dtbs target is fairly primitive and builds just all device
trees in the architecture folder without regard to whether they are even
wired in the Makefile or not.
Now that we have a list of all device trees in the form of dtbs-list,
let's rework the dtbs target to make use of it. The old behavior of
building all device trees can still be achieved by enabling
CONFIG_OF_ALL_DTBS.
In order to have dtbs-list updated always, it's also added to the
dependencies of the images target. That way, a FIT image target that
will be added in a later commit can reliably depend on that file to be
available.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Makefile | 22 +++++++++++++++++-----
drivers/of/Kconfig | 11 +++++++++++
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 82f90373cbbd..75e994e5ac1a 100644
--- a/Makefile
+++ b/Makefile
@@ -1114,10 +1114,22 @@ endif
ifneq ($(dtstree),)
-PHONY += dtbs
-all_dtbs += $(patsubst $(srctree)/%.dts,$(objtree)/%.dtb,$(wildcard $(srctree)/$(dtstree)/*.dts))
-targets += $(all_dtbs)
-dtbs: $(all_dtbs)
+%.dtb: dtbs_prepare
+ $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+
+%.dtbo: dtbs_prepare
+ $(Q)$(MAKE) $(build)=$(dtstree) $(dtstree)/$@
+
+PHONY += dtbs dtbs_prepare
+dtbs: dtbs_prepare
+ $(Q)$(MAKE) $(build)=$(dtstree) need-dtbslist=1
+
+dtbs_prepare: include/config/kernel.release scripts_dtc
+
+ifdef CONFIG_OFDEVICE
+images: dtbs
+images/%: dtbs
+endif
endif
@@ -1322,7 +1334,7 @@ help:
@echo ''
@$(if $(dtstree), \
echo ' Devicetree:'; \
- echo ' * dtbs - Build device tree blobs for all boards'; \
+ echo ' * dtbs - Build device tree blobs for enabled boards'; \
echo '')
@$(if $(boards), \
$(foreach b, $(boards), \
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 6c9aedf355b4..ebc8842f5e38 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -3,6 +3,17 @@ config OFTREE
select DTC
bool
+config OF_ALL_DTBS
+ bool "Build all Device Tree Blobs"
+ depends on OFTREE && COMPILE_TEST
+ select DTC
+ help
+ This option builds all possible Device Tree Blobs (DTBs) for the
+ current architecture.
+
+ If unsure, say N here, but this option is safe to enable.
+
+
config OFTREE_MEM_GENERIC
depends on OFTREE
depends on PPC || ARM || EFI_PAYLOAD || OPENRISC || SANDBOX || RISCV || KVX
--
2.39.5
next prev parent reply other threads:[~2025-01-12 8:35 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-12 8:34 [PATCH 00/13] images: add barebox FIT image target Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 01/13] ARM: dts: add device trees for the QEMU Virt machine Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 02/13] treewide: collect the name of all board device trees Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 03/13] kbuild: collect available device trees in dtbs-list Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 04/13] scripts: add new scripts_dtc target Ahmad Fatoum
2025-01-12 8:34 ` Ahmad Fatoum [this message]
2025-01-12 8:34 ` [PATCH 06/13] kbuild: improve make help description Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 07/13] kbuild: allow dependency on any file in images/ Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 08/13] arch: maintain Linux kernel and mkimage ARCH mapping in Kconfig Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 09/13] arch: make BOARD_GENERIC_DT a user-selectable option across archs Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 10/13] images: add barebox FIT image target Ahmad Fatoum
2025-01-17 8:32 ` Sascha Hauer
2025-01-17 9:03 ` Ahmad Fatoum
2025-01-20 7:19 ` Sascha Hauer
2025-01-12 8:34 ` [PATCH 11/13] MAKEALL: rename target in symbols to more appropiate defconfig Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 12/13] MAKEALL: add support for building arbitrary targets Ahmad Fatoum
2025-01-12 8:34 ` [PATCH 13/13] ci: container: add python3-libfdt dependency for barebox.fit Ahmad Fatoum
2025-01-14 8:18 ` [PATCH 00/13] images: add barebox FIT image target Sascha Hauer
2025-01-21 8:07 ` (subset) " Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250112083432.320215-6-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=felixsinger@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox