Linux kbuild/kconfig development
 help / color / mirror / Atom feed
* Building out of tree dtbs
@ 2024-10-15 20:16 Chris Packham
  2024-10-15 21:01 ` Chris Packham
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Packham @ 2024-10-15 20:16 UTC (permalink / raw)
  To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org

(resend without HTML part)

Hi,

I just noticed with the latest 6.12-rc I'm no longer able to build an 
out of tree dtb by just copying it into arch/$ARCH/boot/dts (at least 
for ARCH=mips and ARCH=arm64) and running `make my-board.dtb`. I believe 
buildroot relies on this as well[1].

Is this an intentional change? Is it too late to undo it (or provide an 
alternative way of having out of tree dts that make use of in-tree dtsi).

Thanks,
Chris

--

[1] - 
https://gitlab.com/buildroot.org/buildroot/-/blob/master/linux/linux.mk?ref_type=heads#L516


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Building out of tree dtbs
  2024-10-15 20:16 Building out of tree dtbs Chris Packham
@ 2024-10-15 21:01 ` Chris Packham
  2024-10-15 21:28   ` [PATCH] kbuild: Restore the ability to build " Chris Packham
  2024-10-31 12:41   ` Building " Rob Herring
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Packham @ 2024-10-15 21:01 UTC (permalink / raw)
  To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org, Masahiro Yamada


On 16/10/24 09:16, Chris Packham wrote:
> (resend without HTML part)
>
> Hi,
>
> I just noticed with the latest 6.12-rc I'm no longer able to build an 
> out of tree dtb by just copying it into arch/$ARCH/boot/dts (at least 
> for ARCH=mips and ARCH=arm64) and running `make my-board.dtb`. I 
> believe buildroot relies on this as well[1].

A simple repro is

make ARCH=arm mvebu_v7_defconfig
cp arch/arm/boot/dts/marvell/armada-385-db-ap.dts 
arch/arm/boot/dts/myboard.dts
make ARCH=arm myboard.dtb

>
> Is this an intentional change? Is it too late to undo it (or provide 
> an alternative way of having out of tree dts that make use of in-tree 
> dtsi).
Looks like this is caused by commit e7e2941300d2 ("kbuild: split device 
tree build rules into scripts/Makefile.dtbs"). The conditional include 
of Makefile.dtbs isn't satisfied when building an out of tree dtb.
>
> Thanks,
> Chris
>
> -- 
>
> [1] - 
> https://gitlab.com/buildroot.org/buildroot/-/blob/master/linux/linux.mk?ref_type=heads#L516
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] kbuild: Restore the ability to build out of tree dtbs
  2024-10-15 21:01 ` Chris Packham
@ 2024-10-15 21:28   ` Chris Packham
  2024-10-16 13:47     ` kernel test robot
  2024-10-31 12:41   ` Building " Rob Herring
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Packham @ 2024-10-15 21:28 UTC (permalink / raw)
  To: masahiroy, nathan, nicolas; +Cc: linux-kbuild, linux-kernel, Chris Packham

A build pattern to handle out of tree dtbs is to copy the .dts file into
the kernel source tree and run `make myboard.dtb`. This is supported by
the wildcard %.dtb rule in the Makefile but recent changes to split the
dtb handling out of scripts/Makefile.build stopped this from working.
Restore this functionality by looking for the relevant file extensions
in $(MAKECMDGOALS) instead of $(targets).

Fixes: e7e2941300d2 ("kbuild: split device tree build rules into scripts/Makefile.dtbs")
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---

Notes:
    This seems to address the problem building out of tree dtbs. I think it
    is correct because as far as I can tell nothing will pull .dtb and
    friends into $(targets) and we explicity check for a non-empty $(dtb-y).

 scripts/Makefile.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 8f423a1faf50..58404c1c5eda 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -449,7 +449,7 @@ ifneq ($(userprogs),)
 include $(srctree)/scripts/Makefile.userprogs
 endif
 
-ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(targets)),)
+ifneq ($(need-dtbslist)$(dtb-y)$(dtb-)$(filter %.dtb %.dtb.o %.dtbo.o,$(MAKECMDGOALS)),)
 include $(srctree)/scripts/Makefile.dtbs
 endif
 
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: Restore the ability to build out of tree dtbs
  2024-10-15 21:28   ` [PATCH] kbuild: Restore the ability to build " Chris Packham
@ 2024-10-16 13:47     ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2024-10-16 13:47 UTC (permalink / raw)
  To: Chris Packham, masahiroy, nathan, nicolas
  Cc: oe-kbuild-all, linux-kbuild, linux-kernel, Chris Packham

Hi Chris,

kernel test robot noticed the following build errors:

[auto build test ERROR on masahiroy-kbuild/for-next]
[also build test ERROR on masahiroy-kbuild/fixes linus/master v6.12-rc3 next-20241016]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Chris-Packham/kbuild-Restore-the-ability-to-build-out-of-tree-dtbs/20241016-053034
base:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next
patch link:    https://lore.kernel.org/r/20241015212830.3899891-1-chris.packham%40alliedtelesis.co.nz
patch subject: [PATCH] kbuild: Restore the ability to build out of tree dtbs
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
config: openrisc-defconfig (https://download.01.org/0day-ci/archive/20241016/202410161857.7osnf6AX-lkp@intel.com/config)
compiler: or1k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241016/202410161857.7osnf6AX-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202410161857.7osnf6AX-lkp@intel.com/

All errors (new ones prefixed by >>):

>> make[5]: *** No rule to make target 'arch/openrisc/boot/dts/or1ksim.dtb.o', needed by 'arch/openrisc/boot/dts/built-in.a'.
   make[5]: Target 'arch/openrisc/boot/dts/' not remade because of errors.

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Building out of tree dtbs
  2024-10-15 21:01 ` Chris Packham
  2024-10-15 21:28   ` [PATCH] kbuild: Restore the ability to build " Chris Packham
@ 2024-10-31 12:41   ` Rob Herring
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2024-10-31 12:41 UTC (permalink / raw)
  To: Chris Packham
  Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-kbuild@vger.kernel.org, Masahiro Yamada

On Tue, Oct 15, 2024 at 4:01 PM Chris Packham
<Chris.Packham@alliedtelesis.co.nz> wrote:
>
>
> On 16/10/24 09:16, Chris Packham wrote:
> > (resend without HTML part)
> >
> > Hi,
> >
> > I just noticed with the latest 6.12-rc I'm no longer able to build an
> > out of tree dtb by just copying it into arch/$ARCH/boot/dts (at least
> > for ARCH=mips and ARCH=arm64) and running `make my-board.dtb`. I
> > believe buildroot relies on this as well[1].
>
> A simple repro is
>
> make ARCH=arm mvebu_v7_defconfig
> cp arch/arm/boot/dts/marvell/armada-385-db-ap.dts
> arch/arm/boot/dts/myboard.dts
> make ARCH=arm myboard.dtb
>
> >
> > Is this an intentional change? Is it too late to undo it (or provide
> > an alternative way of having out of tree dts that make use of in-tree
> > dtsi).
> Looks like this is caused by commit e7e2941300d2 ("kbuild: split device
> tree build rules into scripts/Makefile.dtbs"). The conditional include
> of Makefile.dtbs isn't satisfied when building an out of tree dtb.

News to me that used to work. That's not supported behavior. Only
targets listed in 'dtbs-' are supported.

Rob

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-31 12:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 20:16 Building out of tree dtbs Chris Packham
2024-10-15 21:01 ` Chris Packham
2024-10-15 21:28   ` [PATCH] kbuild: Restore the ability to build " Chris Packham
2024-10-16 13:47     ` kernel test robot
2024-10-31 12:41   ` Building " Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox