Search code examples
linuxraspberry-piyoctodevice-tree

Configure Yocto image on CM4 to work with Official Raspberry Pi Display


I've got a Raspberry Pi CM4 (with eMMC) running an image built using Yocto. The CM4 is running on the official CMIO board. I want to use the official Raspberry Pi 7" Display on this, using the DSI interface, but I have trouble getting it working. The display does not turn on at all. I need help configuring my image, or my yocto build correctly to allow me to use this display.

What worked:

  1. It works as expected on a Raspberry Pi 4 Mode B. I can flash my Yocto-based image to an SD card and the device boots as expected with the display working

  2. It works on the CM4 using the official Raspberry Pi OS image, but only after I do one of the following:

    a. Add the dt-blob.bin file as described in the Compute Model Documentation

    b. I add the following line to the config.txt file in the boot folder: dtoverlay=vc4-fkms-v3d

Issue:

When I flash my Yocto-based image to the Raspberry Pi, the screen does not work. The device boots up, and I can get an output through HDMI, but not through the DSI interface.

What I have tried

  1. I've downloaded the dt-blob.bin file to both the /uboot/ and /boot/ folders on my device and rebooted, but it had no effect
  2. I added the vc4-kms-dsi-7inch dtbo to the /uboot/overlays folder and added dtoverlay=vc4-fkms-v3dto config.txt in /uboot/ and it still didn't have any effect.

It feels like this is a device-tree related issue. And I imagine there is some difference in pin usage between the Raspberry Pi 4B and the CM4, which makes my image not work on the CM4.

One thing I did note, the image I'm using has dtoverlay=vc4-fkms-v3d in config.txt while the official image has dtoverlay=vc4-kms-v3d. I don't know if that makes a difference, but changing it on my image to fkms and rebooting didn't have any effect.

This is an extract from the local.conf file for my yocto build:

MACHINE ?= "raspberrypi4"

ENABLE_DWC2_HOST = "1"
RPI_USE_U_BOOT = "1"
MENDER_BOOT_PART_SIZE_MB = "40"
IMAGE_INSTALL_append = " kernel-image kernel-devicetree"
IMAGE_FSTYPES_remove += " rpi-sdimg"

MENDER_FEATURES_ENABLE_append = " mender-uboot mender-image-sd"
MENDER_FEATURES_DISABLE_append = " mender-grub mender-image-uefi"
MENDER_SERVER_URL = "https://hosted.mender.io"
MENDER_TENANT_TOKEN = [censored]

This build uses the meta-raspberrypi and meta-rpi64 layers.

Any help to understand the problem and get this display working would be appreciated.

Thanks!


Solution

  • I managed to solve this issue in the end. The local.conf file had another conflicting MACHINE ?= "raspberrypi3-cm" command. I removed this and created the image again. Then, while still connected to the PC as a storage device, I added the dt-blob.bin file to the /boot/ drive.

    I then booted up the CM4, and the display worked.

    Next step would be to figure out how to implement that device tree overlay into the yocto build, but that's out of the scope of this question.