All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Cc: linux-kbuild@vger.kernel.org,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kbuild: fix compilation of dtb specified on command-line without make rule
Date: Mon, 24 Nov 2025 07:07:47 -0600	[thread overview]
Message-ID: <20251124130747.GA3957523-robh@kernel.org> (raw)
In-Reply-To: <20251120140645.478623-1-thomas.de_schampheleire@nokia.com>

On Thu, Nov 20, 2025 at 03:06:43PM +0100, Thomas De Schampheleire wrote:
> Since commit e7e2941300d2 ("kbuild: split device tree build rules into
> scripts/Makefile.dtbs"), it is no longer possible to compile a device tree
> blob that is not specified in a make rule
> like:
>     dtb-$(CONFIG_FOO) += foo.dtb
> 
> Before the mentioned commit, one could copy a dts file to e.g.
> arch/arm64/boot/dts/ (or a new subdirectory) and then convert it to a dtb
> file using:
>     make ARCH=arm64 foo.dtb

News to me this was ever possible.

> 
> In this scenario, both 'dtb-y' and 'dtb-' are empty, and the inclusion of
> scripts/Makefile.dtbs relies on 'targets' to contain the MAKECMDGOALS. The
> value of 'targets', however, is only final later in the code.
> 
> Move the conditional include of scripts/Makefile.dtbs down to where the
> value of 'targets' is final.

This breaks 'make dtbs' (and just 'make' for arm64).


> 
> Fixes: e7e2941300d2 ("kbuild: split device tree build rules into scripts/Makefile.dtbs")
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> ---
>  scripts/Makefile.build | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index d0ee33a487be..6e0f9e922c68 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -527,10 +527,6 @@ ifneq ($(userprogs),)
>  include $(srctree)/scripts/Makefile.userprogs
>  endif
>  
> -ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(targets)),)
> -include $(srctree)/scripts/Makefile.dtbs
> -endif
> -
>  # Build
>  # ---------------------------------------------------------------------------
>  
> @@ -568,6 +564,11 @@ FORCE:
>  targets += $(filter-out $(single-subdir-goals), $(MAKECMDGOALS))
>  targets := $(filter-out $(PHONY), $(targets))
>  
> +# Now that targets is fully known, include dtb rules if needed
> +ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(targets)),)
> +include $(srctree)/scripts/Makefile.dtbs
> +endif
> +
>  # Read all saved command lines and dependencies for the $(targets) we
>  # may be building above, using $(if_changed{,_dep}). As an
>  # optimization, we don't need to read them if the target does not
> 
> base-commit: deab487e0f9b39ae4603e22d7d00908ebfc9753c
> -- 
> 2.51.0
> 

  parent reply	other threads:[~2025-11-24 13:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20 14:06 [PATCH] kbuild: fix compilation of dtb specified on command-line without make rule Thomas De Schampheleire
2025-11-21  6:42 ` Nathan Chancellor
2025-11-21 19:46   ` Nicolas Schier
2025-11-24 13:07 ` Rob Herring [this message]
2025-11-25 10:52   ` Thomas De Schampheleire
2025-11-25 13:25     ` Rob Herring
  -- strict thread matches above, loose matches on Subject: below --
2025-11-20 15:18 kernel test robot
2025-11-20 15:29 kernel test robot

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=20251124130747.GA3957523-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=thomas.de_schampheleire@nokia.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.