Device Tree Overlay Support for iMX8MM - Adding pps-gpio at Runtime

Device Tree Overlay Support for iMX8MM - Adding pps-gpio at Runtime

Category: Devices / General


Summary

I’m trying to add a pps-gpio device to my Variscite DART-MX8M-MINI (iMX8MM) fleet running BalenaOS 6.6.11. I need /dev/pps1 for GPS-disciplined PTP (Precision Time Protocol) timing. The kernel has CONFIG_PPS_CLIENT_GPIO=m but I can’t find a way to load the driver without modifying the device tree.

What I’m Trying to Accomplish

Our platform has an MCU that outputs a 1PPS (pulse per second) signal from a GPS receiver to the iMX8’s GPIO5_IO24 pin. I need the Linux kernel to expose this as /dev/pps1 so chrony can use it as a high-precision PPS refclock for sub-microsecond time synchronization.

The pps-gpio kernel module is available but requires device tree configuration to bind to a specific GPIO pin - it has no module parameters for runtime configuration.

Device Tree Node Needed

pps {
    compatible = "pps-gpio";
    gpios = <&gpio5 24 0>;  /* GPIO5_IO24, active high */
    status = "okay";
};

What I’ve Tried

  1. ConfigFS device tree overlays - Not available:

    # ls /sys/kernel/config/device-tree/overlays/
    ls: cannot access '/sys/kernel/config/device-tree/overlays/': No such file or directory
    

    Kernel has CONFIG_OF_OVERLAY=y but the configfs interface isn’t exposed.

  2. Boot-time overlays - No overlay directory in /mnt/boot/overlays/

  3. Manual DTB modification - Works but not scalable:

    • Decompile DTB with dtc
    • Add pps node
    • Recompile and replace /mnt/boot/imx8mm-var-dart-dt8mcustomboard.dtb
    • Reboot

    This works on a single device but isn’t a viable production deployment strategy for a fleet.

Questions

  1. Does BalenaOS 6.x for iMX8MM support device tree overlays at boot time? If so, how do I add a custom overlay to my deployment?

  2. Is there a BALENA_HOST_CONFIG_* variable or fleet configuration option to specify custom DTB overlays, similar to Raspberry Pi’s dtoverlay= in config.txt?

    Important: We really need a service/fleet variable approach. Modifying config.txt manually requires remotely accessing every individual customer device in the fleet, which means coordinating with customers - not viable at scale. Is there a way for a service container to create/modify config.txt (or equivalent) in a way that persists after reboot?

  3. Is there a recommended approach for deploying custom device tree modifications across a fleet without building a custom BalenaOS image?

  4. If a custom BalenaOS build is required:

    • Is there documentation for adding device tree overlays to the meta-balena layer for iMX8MM?
    • What is the process for getting that custom build integrated into the Balena dashboard so it can be pushed to the fleet via standard OTA updates?

Environment

  • Device: Variscite DART-MX8M-MINI (DT8MCustomBoard)
  • BalenaOS: 6.6.11
  • Kernel: 5.15.60-imx8mm-imx8mm
  • Kernel configs:
    • CONFIG_PPS=y
    • CONFIG_PPS_CLIENT_GPIO=m
    • CONFIG_OF_OVERLAY=y

Use Case

This is for a PTP grandmaster implementation where we need GPS-disciplined timing with chrony’s PPS refclock. The pps-gpio driver would give us kernel-level timestamping of the 1PPS edges with microsecond or better precision.

Any guidance on the recommended approach for fleet-wide device tree customization would be greatly appreciated.