Thread (7 messages) flat view 7 messages, 3 authors, 2021-10-09

Re: [Buildroot] buildroot config for installing kernel and dtbs to rootfs?

From: Arnout Vandecappelle <hidden>
Date: 2021-10-03 10:52:54


On 01/10/2021 16:38, Tim Harvey wrote:
On Thu, Sep 30, 2021 at 8:21 AM Tim Harvey [off-list ref] wrote:
quoted
On Wed, Sep 29, 2021 at 7:13 PM Fabio Estevam [off-list ref] wrote:
quoted
Hi Tim,

On Wed, Sep 29, 2021 at 10:52 PM Tim Harvey [off-list ref] wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help