mix openwrt_one.upload (nerves_system_openwrt_one v0.5.2)

Copy Markdown View Source

Ship the freshly-built firmware to a running OpenWRT One Nerves device via the system's scripts/upload-ota.sh (volume-level A/B-slot UBI OTA: writes the inactive fit_* UBI volume via ubiupdatevol, flips nerves_fw_active via fw_setenv, reboots).

Designed to be chained after firmware via a mix alias:

defp aliases do
  [
    firmware: ["firmware", "openwrt_one.firmware_post"],
    upload:   ["firmware", "openwrt_one.upload"]
  ]
end

Why this is needed: stock mix upload (Nerves bootstrap's task) assumes a block-device firmware layout and writes the .fw with a remote fwup invocation. The OpenWRT One stores its rootfs in UBI volumes on SPI NAND, and writing to /dev/ubi* needs the UBI_IOCVOLUP ioctl that fwup doesn't speak (raw_write / path_write / pipe_write all return EPERM). upload-ota.sh uses ubiupdatevol + fw_setenv over SSH instead.

Target host

Resolved from, in order:

  • the first CLI arg, if any
  • the MIX_TARGET_HOST env var
  • the literal nerves.local

The task prefixes root@ automatically.

Examples

MIX_TARGET=openwrt_one mix upload
MIX_TARGET=openwrt_one mix upload 192.168.1.100
MIX_TARGET_HOST=myrouter.lan MIX_TARGET=openwrt_one mix upload