Skip to contentSkip to conversation

error while adding device tree overlay for UART to the image #bitbake #linux

DISCUSSION Crane 2 participants 4 messages Oct 23, 2024 – Mar 31

lore
Share & tools
lore

Crane

author
#0 lore raw

Hello,

This question comes from building Raspberry Pi 5 image in Yocto.

I am trying to add uart device tree overlays to the image. What's done is to add the overlays in the machine configuration:

Quoted 9 lines

RPI_KERNEL_DEVICETREE_OVERLAYS += " \
overlays/uart0-pi5.dtbo \
overlays/uart1-pi5.dtbo \
overlays/uart2-pi5.dtbo \
overlays/uart3-pi5.dtbo \
overlays/uart4-pi5.dtbo \
"

They are also automatically added to KERNEL_DEVICETREE and it works fine to generate the dt overlay binary in building a Linux kernel.

Then when building the image, there is an error as below:

Quoted 10 lines
| DEBUG: Executing shell function do_image_wic
| INFO: Creating image(s)...
|
| WARNING: bootloader config not specified, using defaults
|
| ERROR: Malformed boot file entry: uart0-pi5.dtbo;
|
| WARNING: exit code 1 from a shell command.

I am using a custom layer based on Poky scarthgap and meta-raspberrypi scarthgap.
What might be missed in the recipes? It looks like there is some check when packing the wic image. Any inputs will be appreciated.

Thanks!
Crane

author
#2 lore raw

Just follow the solution in the link, change two tabs to 8 spaces in front of "overlays/uart?-pi5.dtbo", then it works fine now.

#3 lore raw
In reply to Crane

Hello Crane,

I faced a similar issue when working with UART overlays on Raspberry Pi 5 using Yocto (scarthgap + meta-raspberrypi).

In my case, the problem was not the kernel build itself, but how the overlays were handled during image generation (wic stage).

What worked for me was:

1. Instead of relying only on RPI_KERNEL_DEVICETREE_OVERLAYS, I explicitly appended the overlay in my configuration:

RPI_KERNEL_DEVICETREE_OVERLAYS:append = " \
overlays/uart0-pi5.dtbo \
"

2. Additionally, I created a bbappend in my custom layer to ensure the overlay is properly referenced in config.txt:

recipes-bsp/bootfiles/rpi-config_git.bbappend

with the following content:

do_deploy:append() {
echo "dtoverlay=uart0-pi5" >> $CONFIG
}

This ensures that:
- the dtbo is deployed correctly
- and also picked up by the boot configuration

It seems that the WIC error ("Malformed boot file entry") can happen if the overlay is present in KERNEL_DEVICETREE but not properly handled or referenced during boot file generation.

After this change, the image was generated without errors and the UART overlay was applied correctly at boot.

Hope this helps.

Best regards,
Danyal