All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Proper Out-of-tree Devicetree Source
@ 2020-11-12  2:53 Garret Kelly
  2020-11-12 22:14 ` Brandon Maier
  0 siblings, 1 reply; 4+ messages in thread
From: Garret Kelly @ 2020-11-12  2:53 UTC (permalink / raw)
  To: buildroot

Hi buildroot!
I'm trying to figure out the right way to use an out-of-tree device
tree (for uboot, to begin with, but definitely also TF-A and Linux).
So far, I've found that setting BR2_TARGET_UBOOT_CUSTOM_DTS_PATH
results in the files named there being copied into the arch/arm/dts
directory in the uboot build directory. However, these files aren't
referenced by the arch/arm/dts/Makefile, and therefore the DTBs are
never built.

I found that I could add "dtb-y=whatever.dtb" to
BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS, which does result in the DTS getting
compiled, but seems a little hacky. Not that I mind.

I was thinking about adding the dtb-y inclusion trick to uboot.mk, but
I realized as I was doing this that "DTS source files" probably also
implies .dtsi files, and so those can't be added. I suppose I could
filter out non-.dts files from being turned into targets, that might
be the most ergonomic way.

Kind of as an aside: I then started wondering if there shouldn't be
something like BR2_TARGET_DTS_SOURCE which is used to automatically
configure uboot, TF-A, and Linux devicetree configurations so that you
can easily share a single set of devicetree source among the
packages...

Garret

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

* [Buildroot] Proper Out-of-tree Devicetree Source
  2020-11-12  2:53 [Buildroot] Proper Out-of-tree Devicetree Source Garret Kelly
@ 2020-11-12 22:14 ` Brandon Maier
  2020-11-12 22:27   ` Robert Hancock
  0 siblings, 1 reply; 4+ messages in thread
From: Brandon Maier @ 2020-11-12 22:14 UTC (permalink / raw)
  To: buildroot

On Wed, Nov 11, 2020 at 8:57 PM Garret Kelly <garret.kelly@gmail.com> wrote:
>
> Hi buildroot!
> I'm trying to figure out the right way to use an out-of-tree device
> tree (for uboot, to begin with, but definitely also TF-A and Linux).
> So far, I've found that setting BR2_TARGET_UBOOT_CUSTOM_DTS_PATH
> results in the files named there being copied into the arch/arm/dts
> directory in the uboot build directory. However, these files aren't
> referenced by the arch/arm/dts/Makefile, and therefore the DTBs are
> never built.

Same, I recently was trying to build a custom DTS with U-Boot and this
is the behaviour I saw. From talking on the U-Boot IRC it doesn't seem
there is an "officially" supported way to build external dts without
manually patching the dts into the Makefile.

> I found that I could add "dtb-y=whatever.dtb" to
> BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS, which does result in the DTS getting
> compiled, but seems a little hacky. Not that I mind.

I don't have a problem with it if it works. Otherwise U-Boot would
need to be updated to properly support this. For example Linux
supports this with a special dtb target[1].

[1] https://elixir.bootlin.com/linux/v5.9.8/source/Makefile#L1333

> I was thinking about adding the dtb-y inclusion trick to uboot.mk, but
> I realized as I was doing this that "DTS source files" probably also
> implies .dtsi files, and so those can't be added. I suppose I could
> filter out non-.dts files from being turned into targets, that might
> be the most ergonomic way.

This appears to be what BR2_LINUX_KERNEL_CUSTOM_DTS_PATH does[2], so
it seems like there is at least precedent.

[2] https://git.busybox.net/buildroot/tree/linux/linux.mk?h=2020.11-rc1#n175

- Brandon Maier

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

* [Buildroot] Proper Out-of-tree Devicetree Source
  2020-11-12 22:14 ` Brandon Maier
@ 2020-11-12 22:27   ` Robert Hancock
  2020-11-13 17:10     ` Brandon Maier
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Hancock @ 2020-11-12 22:27 UTC (permalink / raw)
  To: buildroot

On Thu, 2020-11-12 at 16:14 -0600, Brandon Maier wrote:
> On Wed, Nov 11, 2020 at 8:57 PM Garret Kelly <garret.kelly@gmail.com>
> wrote:
> > Hi buildroot!
> > I'm trying to figure out the right way to use an out-of-tree device
> > tree (for uboot, to begin with, but definitely also TF-A and
> > Linux).
> > So far, I've found that setting BR2_TARGET_UBOOT_CUSTOM_DTS_PATH
> > results in the files named there being copied into the arch/arm/dts
> > directory in the uboot build directory. However, these files aren't
> > referenced by the arch/arm/dts/Makefile, and therefore the DTBs are
> > never built.
> 
> Same, I recently was trying to build a custom DTS with U-Boot and
> this
> is the behaviour I saw. From talking on the U-Boot IRC it doesn't
> seem
> there is an "officially" supported way to build external dts without
> manually patching the dts into the Makefile.
> 
> > I found that I could add "dtb-y=whatever.dtb" to
> > BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS, which does result in the DTS
> > getting
> > compiled, but seems a little hacky. Not that I mind.
> 
> I don't have a problem with it if it works. Otherwise U-Boot would
> need to be updated to properly support this. For example Linux
> supports this with a special dtb target[1].

In general U-Boot needs some level of board-specific support for things
like memory initialization, so I believe usually one would patch U-Boot 
to add in that support and the reference to that board's .dts files at
the same time.

Specifying a custom .dts for Linux makes more sense as the kernel build
itself can be generic, but there is not really such a thing as a
generic U-Boot build across boards unless they are very similar.

> 
> [1] 
> https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Felixir.bootlin.com%2Flinux%2Fv5.9.8%2Fsource%2FMakefile%23L1333&amp;data=04%7C01%7Crobert.hancock%40calian.com%7C9a73abd8e5e0486aca0308d88758697e%7C23b57807562f49ad92c43bb0f07a1fdf%7C0%7C0%7C637408161089689701%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=uXsp%2FC08O1onRPwp4e%2Fb%2BXdFGFox52cAK%2Fgq57ZWKvk%3D&amp;reserved=0
> 
> > I was thinking about adding the dtb-y inclusion trick to uboot.mk,
> > but
> > I realized as I was doing this that "DTS source files" probably
> > also
> > implies .dtsi files, and so those can't be added. I suppose I could
> > filter out non-.dts files from being turned into targets, that
> > might
> > be the most ergonomic way.
> 
> This appears to be what BR2_LINUX_KERNEL_CUSTOM_DTS_PATH does[2], so
> it seems like there is at least precedent.
> 
> [2] 
> https://can01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.busybox.net%2Fbuildroot%2Ftree%2Flinux%2Flinux.mk%3Fh%3D2020.11-rc1%23n175&amp;data=04%7C01%7Crobert.hancock%40calian.com%7C9a73abd8e5e0486aca0308d88758697e%7C23b57807562f49ad92c43bb0f07a1fdf%7C0%7C0%7C637408161089689701%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=p6TazGhd0IlFlZPFplGSijuUgcK9VlLgdhUKtKCmciI%3D&amp;reserved=0
> 
-- 
Robert Hancock
Senior Hardware Designer, Calian Advanced Technologies
www.calian.com

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

* [Buildroot] Proper Out-of-tree Devicetree Source
  2020-11-12 22:27   ` Robert Hancock
@ 2020-11-13 17:10     ` Brandon Maier
  0 siblings, 0 replies; 4+ messages in thread
From: Brandon Maier @ 2020-11-13 17:10 UTC (permalink / raw)
  To: buildroot

On Thu, Nov 12, 2020 at 4:28 PM Robert Hancock
<robert.hancock@calian.com> wrote:
>
> In general U-Boot needs some level of board-specific support for things
> like memory initialization, so I believe usually one would patch U-Boot
> to add in that support and the reference to that board's .dts files at
> the same time.
>
> Specifying a custom .dts for Linux makes more sense as the kernel build
> itself can be generic, but there is not really such a thing as a
> generic U-Boot build across boards unless they are very similar.
>

At least in our case they are very similar. We have a platform based
on the ZynqMP SoC, and the U-Boot ZynqMP code is almost all common,
configuration is handled by U-Boot KConfig, U-Boot env file, and
Xilinx's ps7/psu init. The only thing I am patching onto U-Boot is the
dts.

Buildroot already has an option to copy the dts into U-Boot. And we do
that as the dts uses the common zynqmp dtsi from U-Boot. Adding
support to build the dts is the only missing piece for us to not need
to patch U-Boot.

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

end of thread, other threads:[~2020-11-13 17:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12  2:53 [Buildroot] Proper Out-of-tree Devicetree Source Garret Kelly
2020-11-12 22:14 ` Brandon Maier
2020-11-12 22:27   ` Robert Hancock
2020-11-13 17:10     ` Brandon Maier

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.