Out-of-Tree Hardware Support on Raspberry Pi CM4 and BalenaOS Upgrades

Hi,

I’m new to the platform and have a few questions regarding out-of-tree hardware support and future upgrades.

I’m working with a device based on the Raspberry Pi Compute Module 4. I need to add some overlay files and a kernel module, and I want to ensure I’m following the best practices with a sound upgrade strategy.

Here’s what I’ve gathered so far:

  1. Overlay Files: These need to be added to the image before the first boot, specifically copied into resin-boot/overlays. As far as I understand, it’s not possible to add files to this location from within a container, as blind mounting isn’t allowed.

  2. Config.txt Modifications: This file should be edited before the first boot, or you can add the dtoverlay configuration via the dashboard.

  3. Kernel Modules: Kernel modules can be loaded from within a container, which allows for updates across kernel versions.

Is this correct, or is there something I have missed? What is best practice for supporting out-of-tree peripherals across future versions of BalenaOS?

My concern is that any future upgrade of BalenaOS could remove my overlay files. I tested flashing my device with BalenaOS 5.4.0, including some overlays, and then upgraded to 6.0.7. I noticed that all my overlays and configurations were retained. Can I safely assume this will be the case going forward?

I have yet to test loading kernel modules, but I found the blog post with an example.

Thanks for your help!