Preload Device Tree Overlays?

This platform is incredible. I love the ability to preload and I’ve successfully leveraged a wifi container (with wifi connect) to bring devices online.

That said, is there any way to preload device tree overlays in the cloud, or in our repos?

This functionality is desperately needed for the hyperpixel.

Thanks!

Drew

Hi @drewcovi,

We’re glad to hear how you feel about Balena platform.

The balena preload command works preloading an application into the image.

There is a possibility to add a device tree overlay in your image using some commands that you can script in Linux.

Let me know what device type you are using and I’ll let you know how to do it.

Regards!

hi @spanceac we’re looking to load up a hyperpixel4.dtbo and some corresponding config.txt.

It would be great if we could preload that custom config.txt rather than waiting for an initial cloud update.

Any advice would be a massive help!

Hi @drewcovi,

I was curious about the device type you use(RPi, Beaglebone etc.).

Assuming you are using a RPi the steps to include the dtbo in your image would be the following:

  1. Download an RPi image from the dashboard

  2. Extract the image archive

  3. Create a loop device from your image
    sudo losetup -fP balena-name-image.img

  4. Mount the boot partition of your image
    mkdir tmp-mount
    sudo mount /dev/loop0p1 tmp-mount

  5. Copy the dtbo in the boot partition
    cp hyperpixel4.dtbo tmp-mount/overlays

  6. Edit the config.txt file from the tmp-mount/ folder as you wish

  7. Unmount the boot partition
    sudo umount tmp-mount

  8. Remove the loop device partitions
    sudo losetup -D

Now the extracted image contains your modifications on the boot partition. You can flash it.

2 Likes

@spanceac

Is there some way of locking config.txt so that it isn’t modified by some Balena agent later on?

I haven’t spent time creating a reproducible test case yet, but I think I have experienced it getting overwritten without doing any action in the balenaCloud admin console that involved changing those (exact) parameters in the Device Configuration section.

Edit: Just found this, which seems to indicate that the correct behavior is for it to be overwritten:

@jschon I don’t think there is a way to lock the config.txt file. It can be updated when you set or update RESIN_HOST_CONFIG_ prefixed configuration variables via the API. See https://www.balena.io/docs/reference/OS/advanced/#config-txt .

Hey @jschon

The information you found is correct, as a note: balena agents can inspect but can NOT modify any fleet or device variable from the dashboard of a shared device (this holds for config, environment and service variables).