mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Christian Melki <christian.melki@t2data.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH] rules/kernel.make: Add a choice to let kernel build dtbs.
Date: Wed,  8 Sep 2021 10:36:40 +0200	[thread overview]
Message-ID: <20210908083640.3366557-1-christian.melki@t2data.com> (raw)

Instead of having Ptxdist build dtbs, let the kernel do it.
Some projects have a rather complicated set of includes and partly
out-of-tree dts structures (Nvidia?), so it is easier to let
the vendor kernel do it. This is similar to what Yocto and Buildroot can do.
The high level find might seem a bit excessive, but some vendor kernels
place built dtbs in rather strange places.
---
 platforms/kernel.in |  9 +++++++++
 rules/kernel.make   | 10 +++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/platforms/kernel.in b/platforms/kernel.in
index ff3cc8df4..1f867e548 100644
--- a/platforms/kernel.in
+++ b/platforms/kernel.in
@@ -180,6 +180,15 @@ menuconfig KERNEL_DTB
 
 if KERNEL_DTB
 
+config KERNEL_BUILD_DTBS
+	bool "Let kernel build dtbs"
+	help
+	  Instead of letting ptxdist compile a specified DTS into a DTB,
+	  it can call upon the kernel make to compile all dtbs that are
+	  relevant for your platforms.
+	  Ptxdist will only copy the resulting dtb files that are
+	  specified in KERNEL_DTS.
+
 config KERNEL_DTS_PATH
 	string "path to source dts file"
 	default "${PTXDIST_PLATFORMCONFIG_SUBDIR}/dts:${KERNEL_DIR}/arch/${GENERIC_KERNEL_ARCH}/boot/dts"
diff --git a/rules/kernel.make b/rules/kernel.make
index 9caff6779..63d2e1c9c 100644
--- a/rules/kernel.make
+++ b/rules/kernel.make
@@ -191,7 +191,8 @@ KERNEL_MAKE_OPT		= \
 	$(call kernel/deprecated, KERNEL_MAKE_OPT) \
 	$(KERNEL_SHARED_OPT) \
 	$(KERNEL_IMAGE) \
-	$(call ptx/ifdef, PTXCONF_KERNEL_MODULES,modules)
+	$(call ptx/ifdef, PTXCONF_KERNEL_MODULES,modules) \
+	$(call ptx/ifdef, PTXCONF_KERNEL_BUILD_DTBS,dtbs)
 
 KERNEL_TOOL_PERF_OPTS	:= \
 	-C $(KERNEL_DIR)/tools/perf \
@@ -263,7 +264,14 @@ $(STATEDIR)/kernel.install:
 ifdef PTXCONF_KERNEL_MODULES_INSTALL
 	@$(call world/install, KERNEL)
 endif
+ifdef PTXCONF_KERNEL_BUILD_DTBS
+	@mkdir -p $(KERNEL_PKGDIR)/boot
+	@$(foreach dtb, $(KERNEL_DTB_FILES), \
+		echo -e "Installing $(dtb) ...\n"$(ptx/nl) \
+		find $(KERNEL_BUILD_DIR) -name $(dtb) -exec cp "{}" $(KERNEL_PKGDIR)/boot/$(dtb) \;)
+else
 	@$(call world/dtb, KERNEL)
+endif
 	@$(call touch)
 
 # ----------------------------------------------------------------------------
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


                 reply	other threads:[~2021-09-08  8:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210908083640.3366557-1-christian.melki@t2data.com \
    --to=christian.melki@t2data.com \
    --cc=ptxdist@pengutronix.de \
    /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