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

Mike Looijmans mike.looijmans at topic.nl
Thu May 8 10:46:35 CEST 2025


On 07-05-2025 18:30, u-boot at cairnwater.com wrote:
> 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?
>
> We'd like to add Kieran's DTOs
>
> https://git.uk.ideasonboard.com/camera/dt-overlays/src/branch/main/arch/arm64/boot/dts/freescale 
>
>
> to the buildroot default configuration for Debix Model A SBC
>
> https://github.com/buildroot/buildroot/blob/master/configs/polyhex_debix_model_a_defconfig 
>
>
> 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:
>
> https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm/boot/dts/overlays/imx708-overlay.dts 
>
> https://github.com/raspberrypi/linux/blob/rpi-6.12.y/arch/arm/boot/dts/overlays/imx708.dtsi 
>
>
> We're planning to use the Debix Model A SBC or Debix SoM A with SoM A 
> I/O board to prototype a new open source wildlife camera for our work 
> in conservation of tree dwelling endangered dormice
>
> https://new-homes-for-old-friends.cairnwater.com/
>
> then after field studies with the prototype design a custom board for 
> an NXP i.MX 8M Plus SoM.
>
> The analysis for the new open source wildlife camera is here:
>
> https://github.com/William-Robert-Robertson/WildCamera
>
> Will


You can enable device-tree overlay loading in the kernel and do it all 
there.

U-boot can also do it for you, example bootscript that detects the panel 
to use and then loads the appropriate overlay (this runs on a RPi4 board):


fdt addr ${fdt_addr}
setenv panel fancy-display-panel

[Magic I2C stuff to detect hardware and set "panel"]

fdt resize 8192
fatload mmc 0:1 ${kernel_addr_r} /overlays/${panel}.dtbo
fdt apply ${kernel_addr_r}

[load and boot your kernel]


Example recipe to create the overlay, e.g. "device-tree-fancy.bb":


SUMMARY = "Devicetree overlay for FANCY board"

SRC_URI = "\
     file://fancy-display-panel.dts \
     file://fancier-display-panel.dts \
     "

inherit devicetree

# Override to NOT have a devicetree subdir
FILES:${PN} = "/boot/overlays"

devicetree_do_install() {
     for DTB_FILE in `ls *.dtb *.dtbo`; do
         install -Dm 0644 ${B}/${DTB_FILE} ${D}/boot/overlays/${DTB_FILE}
     done
}

do_deploy() {
     for DTB_FILE in `ls *.dtb *.dtbo`; do
         install -Dm 0644 ${B}/${DTB_FILE} ${DEPLOYDIR}/${DTB_FILE}
     done
}



-- 
Mike Looijmans
System Expert

TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: mike.looijmans at topic.nl
W: www.topic.nl





More information about the U-Boot mailing list