Adding Device Tree Overlays for MIPI-CSI2 Camera and libcamera to u-boot in a buildroot or Yocto Build

Quentin Schulz quentin.schulz at cherry.de
Thu May 8 10:04:37 CEST 2025


Hi Will,

On 5/7/25 6:30 PM, u-boot at cairnwater.com wrote:
> [You don't often get email from u-boot at cairnwater.com. Learn why this is 
> important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> Hi,
> 
> Does anyone have any advice on how to add DTOs needed by libcamera to a
> u-boot in a buildroot or Yocto build or on whether it's more appropriate
> to add them as part of u-boot or as another part of the build?
> 

If we're talking solely about cameras, I'm not sure it's important to 
have the overlay applied for use within U-Boot so I would suggest to 
focus on generating a FIT image for the kernel which has the base device 
tree and one or more device tree overlays that will automatically be 
applied by U-Boot based on the fdt property in a configuration node.

This however means that the DTB used in U-Boot will be different from 
the one by the kernel. There's some effort for some 
architectures/vendors to pass the DTB along stages (multiple U-Boot 
stages, TF-A, OP-TEE, followed by the kernel) instead of loading 
different ones. I believe this would be bloblist or the upcoming (?) 
passage standard. I have no experience with those as all my boards use a 
different DTB in U-Boot stages and kernel.

> We'd like to add Kieran's DTOs
> 
> https://eur02.safelinks.protection.outlook.com/? 
> url=https%3A%2F%2Fgit.uk.ideasonboard.com%2Fcamera%2Fdt- 
> overlays%2Fsrc%2Fbranch%2Fmain%2Farch%2Farm64%2Fboot%2Fdts%2Ffreescale&data=05%7C02%7Cquentin.schulz%40cherry.de%7Ca8e0b5c29f524a517d7f08dd8d8d899e%7C5e0e1b5221b54e7b83bb514ec460677e%7C0%7C0%7C638822361226841805%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=8OQ%2BjZjI9Fi1qd9qTwDRiD1wvX6llMGZINDL%2BiPm%2B6o%3D&reserved=0
> 
> to the buildroot default configuration for Debix Model A SBC
> 

The easiest is to upstream those to the Linux kernel or have a forked 
kernel with those in-tree and then use 
BR2_LINUX_KERNEL_INTREE_DTSO_NAMES to specify which device tree overlays 
to build and add.

Buildroot also seems to have support for out-of-tree DTSO but those 
likely need to be within the Buildroot main tree to be discoverable?

I have no clue how to generate a FIT image for the kernel with Buildroot 
though.

Don't forget to select BR2_LINUX_KERNEL_INTREE_DTSO_NAMES otherwise you 
won't be able to apply the overlay on top of the base dtb as symbols 
would be missing.

> https://eur02.safelinks.protection.outlook.com/? 
> url=https%3A%2F%2Fgithub.com%2Fbuildroot%2Fbuildroot%2Fblob%2Fmaster%2Fconfigs%2Fpolyhex_debix_model_a_defconfig&data=05%7C02%7Cquentin.schulz%40cherry.de%7Ca8e0b5c29f524a517d7f08dd8d8d899e%7C5e0e1b5221b54e7b83bb514ec460677e%7C0%7C0%7C638822361226862151%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=UTJeVWJcHnslwSkLjGFVyXIwGnGJuf%2FinrOD%2F%2F1RV5s%3D&reserved=0
> 
> Ideally we'd also like to add the overlays for the Sony IMX 708 Image
> Sensor used in the RPi V3 camera but these aren't mainline:
> 

Then upstream them or use a forked kernel.

[...]

For Yocto, I believe you could have a recipe only for the overlays for 
the debix model a hosted on Kieran's gitea which would inherit the 
kernel-devicetree.bbclass (or is it devicetree.bbclass?)? How to make 
those out-of-tree device tree overlays part of the kernel FIT image, no 
clue. Probably kernel-fitimage.bbclass inherit in a recipe and some 
custom callbacks? I seem to recall Yocto isn't fully ready for overlays 
right now so there may be additional work required.

Another option could be to use extlinux.conf with FDTOVERLAYS. This is 
available in uboot-extlinux-config.bbclass, but only since Walnascar 
(5.2) released 3 hours ago. I tested it myself back when I contributed 
it, so it should reasonably work :) Don't forget to compile your in-tree 
kernel base dtb with -@ (for symbols).

I'm not sure the u-boot mailing list is the appropriate place to discuss 
those though as there doesn't seem to be much required in U-Boot aside 
from the usual (FIT and/or extlinux.conf support), Buildroot and Yocto 
mailing lists could probably be better places.

Cheers,
Quentin


More information about the U-Boot mailing list