Skip to main content
meta-nerveshub is a Yocto layer with one recipe, nerves-hub-link-agent. It builds the Linux agent and installs it with a systemd unit, a service user and a starter config file. The layer does not build bundles or configure slots. That is the job of meta-rauc, or of your fwup configuration.

Requirements

The recipe uses meta-rust-bin’s cargo_bin class, not poky’s cargo, because the Rust that scarthgap and walnascar ship is older than the agent needs. meta-rust-bin packages prebuilt upstream toolchains, not ones your build compiled, which matters if you have reproducibility or audit requirements.

Add the layer

1

Add the layers

For a RAUC image:
meta-nerveshub declares a dependency on core only. A missing update tool layer is reported when the recipe is parsed, with a message naming the layer to add.
2

Configure the distro and image

rauc in DISTRO_FEATURES is meta-rauc’s requirement. Leave it out for an fwup image.
3

Replace the starter config

The recipe installs /etc/nerves-hub-link-agent.toml with placeholder credentials. Override it from your own layer. See Configure the agent.
Without systemd in DISTRO_FEATURES, the recipe skips installing the unit. The package still builds and installs the binary, but nothing starts it.

Choose the update tool

The recipe maps PACKAGECONFIG to the agent’s cargo features. The default is rauc. To build for fwup, set this in your configuration or a .bbappend:
Extensions are not build options. They are turned on in the agent’s config file.

What the recipe installs

The unit also gives the service the systemd-journal group, which the logging extension needs to read the journal.

Configure the agent

The starter config connects to devices.nervescloud.com with the RAUC update tool. It contains placeholders that you must replace:
It also sets the IPC socket to /run/nerves-hub-link-agent/agent.sock and the reboot command to reboot. Ship your own file from your product’s layer, so that the config is versioned with the image. See Linux agent for every section. The agent’s docs/deploying.md covers the device identifier, file permissions for the service user, and the sudoers rule for an unprivileged reboot. For a RAUC image, the device also needs the RAUC service running and a system.conf with its slots and keyring. See the agent’s docs/rauc.md, and RAUC bundles for what NervesHub needs in the bundle manifest.

Update the crate list

Yocto fetches sources before it builds, so the recipe lists every crate the agent depends on. After the agent’s Cargo.lock changes, regenerate the list:
This rewrites nerves-hub-link-agent-crates.inc. The recipe pins the agent to a git revision. A new agent version is a new recipe file.