All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] buildroot config for installing kernel and dtbs to rootfs?
@ 2021-09-30  1:51 Tim Harvey
  2021-09-30  2:13 ` Fabio Estevam
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2021-09-30  1:51 UTC (permalink / raw)
  To: buildroot

Greetings,

I see the buildroot has the ability to build dtb's from the kernel
source (BR2_LINUX_KENREL_DTS*) but I haven't seen any configs that
instruct buildroot to copy the dtb's or kernel image to the root
filesystem.

Is there a config for this and if not what do people usually do for this?

Thanks,

Tim
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] buildroot config for installing kernel and dtbs to rootfs?
  2021-09-30  1:51 [Buildroot] buildroot config for installing kernel and dtbs to rootfs? Tim Harvey
@ 2021-09-30  2:13 ` Fabio Estevam
  2021-09-30 15:21   ` Tim Harvey
  0 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2021-09-30  2:13 UTC (permalink / raw)
  To: Tim Harvey; +Cc: buildroot

Hi Tim,

On Wed, Sep 29, 2021 at 10:52 PM Tim Harvey <tharvey@gateworks.com> wrote:
>
> Greetings,
>
> I see the buildroot has the ability to build dtb's from the kernel
> source (BR2_LINUX_KENREL_DTS*) but I haven't seen any configs that
> instruct buildroot to copy the dtb's or kernel image to the root
> filesystem.
>
> Is there a config for this and if not what do people usually do for this?

It is BR2_LINUX_KERNEL_INSTALL_TARGET=y.

configs/wandboard_defconfig is an example that selects
BR2_LINUX_KERNEL_INSTALL_TARGET=y
and install zImage and dtbs into the rootfs.

Regards,

Fabio Estevam
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] buildroot config for installing kernel and dtbs to rootfs?
  2021-09-30  2:13 ` Fabio Estevam
@ 2021-09-30 15:21   ` Tim Harvey
  2021-10-01 14:38     ` Tim Harvey
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2021-09-30 15:21 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: buildroot

On Wed, Sep 29, 2021 at 7:13 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> Hi Tim,
>
> On Wed, Sep 29, 2021 at 10:52 PM Tim Harvey <tharvey@gateworks.com> wrote:
> >
> > Greetings,
> >
> > I see the buildroot has the ability to build dtb's from the kernel
> > source (BR2_LINUX_KENREL_DTS*) but I haven't seen any configs that
> > instruct buildroot to copy the dtb's or kernel image to the root
> > filesystem.
> >
> > Is there a config for this and if not what do people usually do for this?
>
> It is BR2_LINUX_KERNEL_INSTALL_TARGET=y.
>
> configs/wandboard_defconfig is an example that selects
> BR2_LINUX_KERNEL_INSTALL_TARGET=y
> and install zImage and dtbs into the rootfs.
>

Thanks Fabio, I didn't see it because I had BR2_TARGET_ROOTFS_INITRAMFS=y.

BR2_LINUX_KERNEL_INSTALL_TARGET only installs the kernel image. It
looks like perhaps to install dtbs you need
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh".
It seems to me installing of the dtbs to the rootfs should be moved
into a defconfig like the kernel image for those who are trying to
simply generate a tarball but not an image?

Best regards,

Tim
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] buildroot config for installing kernel and dtbs to rootfs?
  2021-09-30 15:21   ` Tim Harvey
@ 2021-10-01 14:38     ` Tim Harvey
  2021-10-03 10:52       ` Arnout Vandecappelle
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2021-10-01 14:38 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: buildroot

On Thu, Sep 30, 2021 at 8:21 AM Tim Harvey <tharvey@gateworks.com> wrote:
>
> On Wed, Sep 29, 2021 at 7:13 PM Fabio Estevam <festevam@gmail.com> wrote:
> >
> > Hi Tim,
> >
> > On Wed, Sep 29, 2021 at 10:52 PM Tim Harvey <tharvey@gateworks.com> wrote:
> > >
> > > Greetings,
> > >
> > > I see the buildroot has the ability to build dtb's from the kernel
> > > source (BR2_LINUX_KENREL_DTS*) but I haven't seen any configs that
> > > instruct buildroot to copy the dtb's or kernel image to the root
> > > filesystem.
> > >
> > > Is there a config for this and if not what do people usually do for this?
> >
> > It is BR2_LINUX_KERNEL_INSTALL_TARGET=y.
> >
> > configs/wandboard_defconfig is an example that selects
> > BR2_LINUX_KERNEL_INSTALL_TARGET=y
> > and install zImage and dtbs into the rootfs.
> >
>
> Thanks Fabio, I didn't see it because I had BR2_TARGET_ROOTFS_INITRAMFS=y.
>
> BR2_LINUX_KERNEL_INSTALL_TARGET only installs the kernel image. It
> looks like perhaps to install dtbs you need
> BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh".
> It seems to me installing of the dtbs to the rootfs should be moved
> into a defconfig like the kernel image for those who are trying to
> simply generate a tarball but not an image?
>

Fabio,

Digging into the image creation used for freescale_imx8mmevk_defconfig
things seem flawed to me or at least limited.

I'm still trying to wrap my head around what
BR2_LINUX_KERNEL_INTREE_DTS_NAME is trying to accomplish but one thing
I see is that board/freescale/common/imx/imx8-bootloader-prepare.sh
and board/freescale/common/imx/post-image.sh are creating images
assuming the U-Boot dtb and the Linux kernel dtb are one and the same
which is wrong. There are specific details that differ between the two
especially if you are trying to boot different kernels with differing
support. It's always best to decouple these. The other thing I'm
noticing is that these scripts assume one dtb per image which is
limiting. It looks like imx8mm-venice is the only U-Boot board that
supports multiple dtbs for imx8mm but for imx6 there are many.

So I think we need a way to make linux.mk copy desired kernel dtbs to
BINARIES_DIR separate from desired u-boot dtbs. This means we probably
need different DTB defines for each.

I also don't see any bootscript creation facility in buildroot which
seems to be something that may be desirable as well. For example the
freescale_imx8mmevk_defconfig only boots because it's U-Boot default
environment tries distro-config first which requires a bootscript then
falls back to a hard-coded loading of the kernel/fdt from the
filesystem thus no bootscript is needed. I'm not sure how many boards
in U-Boot have a hard coded fallback like that?

Best regards,

Tim
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] buildroot config for installing kernel and dtbs to rootfs?
  2021-10-01 14:38     ` Tim Harvey
@ 2021-10-03 10:52       ` Arnout Vandecappelle
  2021-10-07 20:13         ` Tim Harvey
  0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2021-10-03 10:52 UTC (permalink / raw)
  To: Tim Harvey, Fabio Estevam; +Cc: buildroot



On 01/10/2021 16:38, Tim Harvey wrote:
> On Thu, Sep 30, 2021 at 8:21 AM Tim Harvey <tharvey@gateworks.com> wrote:
>>
>> On Wed, Sep 29, 2021 at 7:13 PM Fabio Estevam <festevam@gmail.com> wrote:
>>>
>>> Hi Tim,
>>>
>>> On Wed, Sep 29, 2021 at 10:52 PM Tim Harvey <tharvey@gateworks.com> wrote:
>>>>
>>>> Greetings,
>>>>
>>>> I see the buildroot has the ability to build dtb's from the kernel
>>>> source (BR2_LINUX_KENREL_DTS*) but I haven't seen any configs that
>>>> instruct buildroot to copy the dtb's or kernel image to the root
>>>> filesystem.
>>>>
>>>> Is there a config for this and if not what do people usually do for this?
>>>
>>> It is BR2_LINUX_KERNEL_INSTALL_TARGET=y.
>>>
>>> configs/wandboard_defconfig is an example that selects
>>> BR2_LINUX_KERNEL_INSTALL_TARGET=y
>>> and install zImage and dtbs into the rootfs.
>>>
>>
>> Thanks Fabio, I didn't see it because I had BR2_TARGET_ROOTFS_INITRAMFS=y.
>>
>> BR2_LINUX_KERNEL_INSTALL_TARGET only installs the kernel image. It
>> looks like perhaps to install dtbs you need
>> BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh".
>> It seems to me installing of the dtbs to the rootfs should be moved
>> into a defconfig like the kernel image for those who are trying to
>> simply generate a tarball but not an image?
>>
> 
> Fabio,
> 
> Digging into the image creation used for freescale_imx8mmevk_defconfig
> things seem flawed to me or at least limited.
> 
> I'm still trying to wrap my head around what
> BR2_LINUX_KERNEL_INTREE_DTS_NAME is trying to accomplish

  Very simple: to use a dts that is in the kernel source.

> but one thing
> I see is that board/freescale/common/imx/imx8-bootloader-prepare.sh
> and board/freescale/common/imx/post-image.sh are creating images
> assuming the U-Boot dtb and the Linux kernel dtb are one and the same
> which is wrong.

  Saying that it is wrong is a bit exaggerated. You can say that they're not 
necessarily the same. The intention is that device trees are OS-independent, so 
the *intention* is that the same device tree works for both U-Boot and the 
kernel. That said, indeed, in practice it is sometimes not the case. That said, 
the parts that are actually used by U-Boot usually don't change any more, so 
usually it's fine to use the kernel's dtb for U-Boot as well. In particular, for 
the imx8mm EVK, this is the case.


> There are specific details that differ between the two
> especially if you are trying to boot different kernels with differing
> support.

  If you're going to boot two different kernels, you're going to need two 
different Buildroot configurations anyway. So you're also going to have two 
different dtbs. Which one of those you're going to use for U-Boot, or maybe you 
use the dts that comes with U-Boot.


> It's always best to decouple these.

  They are decoupled by default. Normally you'd generate a U-Boot binary that 
has the dtb (as specified in the U-Boot config) linked in. I'm not sure why for 
imx8mmevk it's done differently.


> The other thing I'm
> noticing is that these scripts assume one dtb per image which is
> limiting.

  I think you're not entirely up to speed with what the configs/ and board/ 
directories are meant to be. They are just minimal example configurations to get 
a minimal working system on a specific board. The idea is that you start from 
such a config, boot it on the board to be sure you have a working baseline, and 
then start customising. In particular, it is not the intention to use the 
scripts in board/ as-is. You'd make a copy and adapt them to your specific needs.


> It looks like imx8mm-venice is the only U-Boot board that
> supports multiple dtbs for imx8mm but for imx6 there are many.
> 
> So I think we need a way to make linux.mk copy desired kernel dtbs to
> BINARIES_DIR separate from desired u-boot dtbs.

  This is already the case - cfr. BR2_TARGET_UBOOT_CUSTOM_DTS_PATH.

  What is maybe missing is to copy the U-Boot dtbs to BINARIES_DIR. Currently, 
it's assumed to be linked in with the U-Boot binary and not copied explicitly.


> This means we probably
> need different DTB defines for each.
> 
> I also don't see any bootscript creation facility in buildroot which
> seems to be something that may be desirable as well.

  Do you mean calling mkimage on a U-Boot script? That is done in e.g. 
board/boundarydevices/common/post-build.sh

  We don't have support in the Buildroot config for it, because there's just too 
many different ways that you want to generate boot scripts. It's much more 
flexible to do in a post-image script.


> For example the
> freescale_imx8mmevk_defconfig only boots because it's U-Boot default
> environment tries distro-config first which requires a bootscript then
> falls back to a hard-coded loading of the kernel/fdt from the
> filesystem thus no bootscript is needed. I'm not sure how many boards
> in U-Boot have a hard coded fallback like that?

  For most new boards we prefer to use the extlinux.conf approach. But in the 
end, it's mostly up to the person contributing the defconfig to use what they 
prefer.

  Regards,
  Arnout

> 
> Best regards,
> 
> Tim
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] buildroot config for installing kernel and dtbs to rootfs?
  2021-10-03 10:52       ` Arnout Vandecappelle
@ 2021-10-07 20:13         ` Tim Harvey
  2021-10-09 14:17           ` Fabio Estevam
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Harvey @ 2021-10-07 20:13 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: Fabio Estevam, buildroot

On Sun, Oct 3, 2021 at 3:52 AM Arnout Vandecappelle <arnout@mind.be> wrote:
>
>
>
> On 01/10/2021 16:38, Tim Harvey wrote:
> > On Thu, Sep 30, 2021 at 8:21 AM Tim Harvey <tharvey@gateworks.com> wrote:
> >>
> >> On Wed, Sep 29, 2021 at 7:13 PM Fabio Estevam <festevam@gmail.com> wrote:
> >>>
> >>> Hi Tim,
> >>>
> >>> On Wed, Sep 29, 2021 at 10:52 PM Tim Harvey <tharvey@gateworks.com> wrote:
> >>>>
> >>>> Greetings,
> >>>>
> >>>> I see the buildroot has the ability to build dtb's from the kernel
> >>>> source (BR2_LINUX_KENREL_DTS*) but I haven't seen any configs that
> >>>> instruct buildroot to copy the dtb's or kernel image to the root
> >>>> filesystem.
> >>>>
> >>>> Is there a config for this and if not what do people usually do for this?
> >>>
> >>> It is BR2_LINUX_KERNEL_INSTALL_TARGET=y.
> >>>
> >>> configs/wandboard_defconfig is an example that selects
> >>> BR2_LINUX_KERNEL_INSTALL_TARGET=y
> >>> and install zImage and dtbs into the rootfs.
> >>>
> >>
> >> Thanks Fabio, I didn't see it because I had BR2_TARGET_ROOTFS_INITRAMFS=y.
> >>
> >> BR2_LINUX_KERNEL_INSTALL_TARGET only installs the kernel image. It
> >> looks like perhaps to install dtbs you need
> >> BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh".
> >> It seems to me installing of the dtbs to the rootfs should be moved
> >> into a defconfig like the kernel image for those who are trying to
> >> simply generate a tarball but not an image?
> >>
> >
> > Fabio,
> >
> > Digging into the image creation used for freescale_imx8mmevk_defconfig
> > things seem flawed to me or at least limited.
> >
> > I'm still trying to wrap my head around what
> > BR2_LINUX_KERNEL_INTREE_DTS_NAME is trying to accomplish
>
>   Very simple: to use a dts that is in the kernel source.

Ok, I see that the dtb installation to BINARIES_DIR wasn't working for
me because I needed to append the 'freescale' path as the imx8m dtb's
are in arch/arm64/boot/dts/freescale. Once I do that the 'kernel' dtbs
are built and copied to output/images as I was hoping for.

>
> > but one thing
> > I see is that board/freescale/common/imx/imx8-bootloader-prepare.sh
> > and board/freescale/common/imx/post-image.sh are creating images
> > assuming the U-Boot dtb and the Linux kernel dtb are one and the same
> > which is wrong.
>
>   Saying that it is wrong is a bit exaggerated. You can say that they're not
> necessarily the same. The intention is that device trees are OS-independent, so
> the *intention* is that the same device tree works for both U-Boot and the
> kernel. That said, indeed, in practice it is sometimes not the case. That said,
> the parts that are actually used by U-Boot usually don't change any more, so
> usually it's fine to use the kernel's dtb for U-Boot as well. In particular, for
> the imx8mm EVK, this is the case.
>
>
> > There are specific details that differ between the two
> > especially if you are trying to boot different kernels with differing
> > support.
>
>   If you're going to boot two different kernels, you're going to need two
> different Buildroot configurations anyway. So you're also going to have two
> different dtbs. Which one of those you're going to use for U-Boot, or maybe you
> use the dts that comes with U-Boot.
>
>
> > It's always best to decouple these.
>
>   They are decoupled by default. Normally you'd generate a U-Boot binary that
> has the dtb (as specified in the U-Boot config) linked in. I'm not sure why for
> imx8mmevk it's done differently.
>
>
> > The other thing I'm
> > noticing is that these scripts assume one dtb per image which is
> > limiting.
>
>   I think you're not entirely up to speed with what the configs/ and board/
> directories are meant to be. They are just minimal example configurations to get
> a minimal working system on a specific board. The idea is that you start from
> such a config, boot it on the board to be sure you have a working baseline, and
> then start customising. In particular, it is not the intention to use the
> scripts in board/ as-is. You'd make a copy and adapt them to your specific needs.
>
>
> > It looks like imx8mm-venice is the only U-Boot board that
> > supports multiple dtbs for imx8mm but for imx6 there are many.
> >
> > So I think we need a way to make linux.mk copy desired kernel dtbs to
> > BINARIES_DIR separate from desired u-boot dtbs.
>
>   This is already the case - cfr. BR2_TARGET_UBOOT_CUSTOM_DTS_PATH.
>
>   What is maybe missing is to copy the U-Boot dtbs to BINARIES_DIR. Currently,
> it's assumed to be linked in with the U-Boot binary and not copied explicitly.
>
>
> > This means we probably
> > need different DTB defines for each.
> >
> > I also don't see any bootscript creation facility in buildroot which
> > seems to be something that may be desirable as well.
>
>   Do you mean calling mkimage on a U-Boot script? That is done in e.g.
> board/boundarydevices/common/post-build.sh
>
>   We don't have support in the Buildroot config for it, because there's just too
> many different ways that you want to generate boot scripts. It's much more
> flexible to do in a post-image script.
>

Different 'ways' or simply different scripts? It is true that mkimage
needs a SoC specific loadaddr and arch both of which are typically
found in imx related post scripts. However it does appear very few
boards use a bootscript so I can see the argument for leaving this
board specific.

>
> > For example the
> > freescale_imx8mmevk_defconfig only boots because it's U-Boot default
> > environment tries distro-config first which requires a bootscript then
> > falls back to a hard-coded loading of the kernel/fdt from the
> > filesystem thus no bootscript is needed. I'm not sure how many boards
> > in U-Boot have a hard coded fallback like that?
>
>   For most new boards we prefer to use the extlinux.conf approach. But in the
> end, it's mostly up to the person contributing the defconfig to use what they
> prefer.

Can you explain what you mean by extlinux.conf approach?

Best Regards,

Tim
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] buildroot config for installing kernel and dtbs to rootfs?
  2021-10-07 20:13         ` Tim Harvey
@ 2021-10-09 14:17           ` Fabio Estevam
  0 siblings, 0 replies; 7+ messages in thread
From: Fabio Estevam @ 2021-10-09 14:17 UTC (permalink / raw)
  To: Tim Harvey; +Cc: buildroot

Hi Tim,

On Thu, Oct 7, 2021 at 5:13 PM Tim Harvey <tharvey@gateworks.com> wrote:

> Can you explain what you mean by extlinux.conf approach?

For boards using distro config in U-Boot, it is common practice to use
an extlinux.conf file that describes
the location of zImage/dtbs and the kernel command line.

For example:
https://git.busybox.net/buildroot/tree/board/wandboard/rootfs_overlay/boot/extlinux/extlinux.conf
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2021-10-09 14:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-30  1:51 [Buildroot] buildroot config for installing kernel and dtbs to rootfs? Tim Harvey
2021-09-30  2:13 ` Fabio Estevam
2021-09-30 15:21   ` Tim Harvey
2021-10-01 14:38     ` Tim Harvey
2021-10-03 10:52       ` Arnout Vandecappelle
2021-10-07 20:13         ` Tim Harvey
2021-10-09 14:17           ` Fabio Estevam

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.