The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Michal Simek <monstr@monstr.eu>
Cc: linux-kernel@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 3/4] microblaze: prevent linux.bin from containing a built-in DTB
Date: Wed, 15 Jan 2025 03:13:53 +0900	[thread overview]
Message-ID: <20250114181359.4192564-3-masahiroy@kernel.org> (raw)
In-Reply-To: <20250114181359.4192564-1-masahiroy@kernel.org>

MicroBlaze is the only architecture that specifies the built-in DTB
directly via the command line (i.e., 'make simpleImage.*').

All other architectures supporting a builtin DTB use a CONFIG option
to specify the DTB.

Kbuild supports building multiple targets in a single command. Running
'make foo bar' should produce the same output as executing 'make foo'
and 'make bar' separately.

The oddity in MicroBlaze does not align with the Kbuild philosophy.

For example:

  $ make all simpleImage.foo

This creates both linux.bin (since 'all' depends on linux.bin) and
simpleImage.foo.

It generates linux.bin containing foo.dtb, while linux.bin generated
by 'make all' contains no DTB.

Michal Simek requires that linux.bin contain no built-in DTB. [1]
Therefore, the linux.bin generated in the example above is considered
invalid.

This commit introduces a sanity check to avoid creating such an invalid
linux.bin.

Similarly, you cannot do 'make simpleImage.foo simpleImage.bar' since
it is unclear which DTB (foo.dtb or bar.dtb) should be included. This
command will fail without an explicit check.

[1]: https://lore.kernel.org/all/d2bdfbfd-3721-407f-991e-566d48392add@amd.com/

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 arch/microblaze/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 02e6be9c5b0d..670a1690aa73 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -66,6 +66,7 @@ PHONY += linux.bin linux.bin.gz linux.bin.ub
 linux.bin.ub linux.bin.gz: linux.bin
 linux.bin: vmlinux
 linux.bin linux.bin.gz linux.bin.ub:
+	$(if $(filter simpleImage.%, $(MAKECMDGOALS)),$(error You cannot build linux.bin and simpleImage.* at the same time))
 	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 	@echo 'Kernel: $(boot)/$@ is ready' ' (#'$(or $(KBUILD_BUILD_VERSION),`cat .version`)')'
 
-- 
2.43.0


  parent reply	other threads:[~2025-01-14 18:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 18:13 [PATCH 1/4] microblaze: fix 'FORCE prerequisite is missing' warning Masahiro Yamada
2025-01-14 18:13 ` [PATCH 2/4] microblaze: merge build rules for linux.bin and simpleImage.$(DTB) Masahiro Yamada
2025-01-14 18:13 ` Masahiro Yamada [this message]
2025-01-14 18:13 ` [PATCH 4/4] microblaze: remove unnecessary system.dts Masahiro Yamada
2025-01-31 22:25   ` Rob Herring
2025-02-01  3:42     ` Masahiro Yamada
2025-02-03 11:17       ` Michal Simek
2025-05-13  4:50         ` Masahiro Yamada
2025-06-10  7:49           ` Michal Simek

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=20250114181359.4192564-3-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monstr@monstr.eu \
    /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