Skip to content

Provision and build declared device-tree overlays#183

Draft
jetm wants to merge 2 commits into
mainfrom
eng-2134-device-tree-overlays
Draft

Provision and build declared device-tree overlays#183
jetm wants to merge 2 commits into
mainfrom
eng-2134-device-tree-overlays

Conversation

@jetm

@jetm jetm commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Problem

The CLI had no support for the device-tree-overlay feature: it neither provisioned the SDK overlay tooling nor compiled and delivered overlays during a runtime build.

Solution

When an extension declares device_tree_overlays, provision the SDK wrapper and per-BSP delivery hook during sdk install, then compile and deliver each declared overlay during avocado build.

Key changes

  • sdk/install: provision device-tree-overlay tooling (nativesdk-avocado-dtc-overlay plus the delivery-hook package) from extension declarations
  • runtime/build: compile and deliver declared device-tree overlays into the OS bundle

Reviewer notes

Top of the device-tree-overlay stack (ENG-2134). Depends on the meta-avocado PR, which provides the nativesdk-avocado-dtc-overlay and delivery-hook packages, and transitively on the stone PR. Merge last. Validated on raspberrypi5.

jetm added 2 commits July 20, 2026 09:39
Shipping a custom device-tree overlay previously meant forking the BSP:
the CLI had no notion of one, so a .dtbo could not be compiled from the
project or routed onto the boot medium. Add a declarative path. An
extension declares its overlays under `device_tree_overlays`, and the
runtime build compiles each one, stages it, hands off to the board's
delivery hook, and fails the build if anything went undelivered.

Placement is at the extension level, alongside the sibling `overlay`
key, because a runtime's `packages` list is frequently a bare list of
names with nowhere to hang per-overlay objects. The name is a validated
basename because it is reused verbatim as the .dtbo filename and the
boot-loader argument.

Compilation is generated into the in-container build script rather than
run in Rust: the dtc/cpp toolchain, the kernel dt-bindings, and the
delivery hook all live in the SDK container. The script calls the
nativesdk-avocado-dtc-overlay wrapper per overlay, writes an
overlays.manifest.json, runs the single fixed-path per-BSP hook
($OECORE_TARGET_SYSROOT/usr/libexec/avocado/device-tree-overlay-deliver),
and passes the hook-emitted stone fragment through `stone bundle
--overlay`. Two failure modes are hard errors, not silent successes:
overlays declared with no hook installed, and overlays staged but left
unclaimed by the hook.

Fold the declarations and each .dtso's content hash into the
runtime-build input hash. Overlays are compiled at runtime-build time,
so without this an added or edited overlay would leave the stamp valid
and ship the previous bundle unchanged.

Signed-off-by: Javier Tia <javier@peridio.com>
When an extension declared device_tree_overlays, the CLI compiled and
delivered the overlays at runtime-build time but never installed the tools
that step needs: the nativesdk-avocado-dtc-overlay SDK wrapper and the
per-BSP avocado-dtc-overlay-deliver hook had to be staged into the SDK by
hand, so a clean install could not build a declared overlay. The
target-sysroot install that would carry the hook was also gated on an
active compile section, which a no-#include overlay does not require, so a
pure path/phandle overlay got no target-sysroot at all.

Scan the active extension set (not a single runtime's enabled list, since
the SDK install spans every runtime) for device_tree_overlays and, when any
declares them, add nativesdk-avocado-dtc-overlay to the SDK packages and
avocado-dtc-overlay-deliver to the target-sysroot, widening the
target-sysroot trigger to fire on a declaration as well as a compile
section. nativesdk-dtc is pulled by the wrapper's RDEPENDS and stone is a
baseline SDK package, so neither is listed. A BSP that ships no hook
package now fails at install time rather than at the build-time backstop.

Signed-off-by: Javier Tia <javier@peridio.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant