]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
kbuild: fix compilation of dtb specified on command-line without make rule
authorThomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Wed, 26 Nov 2025 10:00:16 +0000 (11:00 +0100)
committerNicolas Schier <nsc@kernel.org>
Sat, 27 Dec 2025 19:48:01 +0000 (20:48 +0100)
commitb08fc4d0ec2466558f6d5511434efdfabbddf2a6
treee7060ea5f99ee4509770119f10a521f44e64a710
parent07fe35b766a6fcd4ec8214e5066b7b0056b6ec6a
kbuild: fix compilation of dtb specified on command-line without make rule

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

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. Since Makefile.dtbs updates 'always-y' which is
used as a prerequisite in the build rule, the build rule also needs to move
down.

Fixes: e7e2941300d2 ("kbuild: split device tree build rules into scripts/Makefile.dtbs")
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20251126100017.1162330-1-thomas.de_schampheleire@nokia.com
Signed-off-by: Nicolas Schier <nsc@kernel.org>
scripts/Makefile.build