feat(agent): package stable Go runtime for OpenWrt

This commit is contained in:
benya
2026-07-21 00:20:48 +03:00
parent e6236f505c
commit 01e0350cde
18 changed files with 461 additions and 38 deletions
+37 -5
View File
@@ -1,8 +1,40 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for the OpenWrt RMM agent
LUCI_DEPENDS:=+luci-base
LUCI_PKGARCH:=all
PKG_MAINTAINER:=RMM OpenWrt
PKG_NAME:=luci-app-rmm-agent
PKG_VERSION:=0.1.0
PKG_RELEASE:=1
include $(TOPDIR)/feeds/luci/luci.mk
PKG_MAINTAINER:=RMM OpenWrt
PKG_LICENSE:=MIT
include $(INCLUDE_DIR)/package.mk
define Package/luci-app-rmm-agent
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=3. Applications
TITLE:=LuCI support for the OpenWrt RMM agent
DEPENDS:=+luci-base
PKGARCH:=all
endef
define Package/luci-app-rmm-agent/description
LuCI application for configuring and controlling the OpenWrt RMM agent.
endef
define Build/Compile
endef
define Package/luci-app-rmm-agent/install
$(INSTALL_DIR) $(1)/www/luci-static/resources/view/services
$(INSTALL_DATA) ./htdocs/luci-static/resources/view/services/rmm-agent.js \
$(1)/www/luci-static/resources/view/services/rmm-agent.js
$(INSTALL_DIR) $(1)/usr/share/luci/menu.d
$(INSTALL_DATA) ./root/usr/share/luci/menu.d/luci-app-rmm-agent.json \
$(1)/usr/share/luci/menu.d/luci-app-rmm-agent.json
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
$(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/luci-app-rmm-agent.json \
$(1)/usr/share/rpcd/acl.d/luci-app-rmm-agent.json
endef
$(eval $(call BuildPackage,luci-app-rmm-agent))
@@ -26,3 +26,67 @@ opkg install rmm-agent_*.ipk luci-app-rmm-agent_*.ipk
```
On apk-based OpenWrt releases, install the generated `.apk` packages instead.
## Reproducible Docker build
The repository includes a containerized OpenWrt SDK build. By default it uses the
official OpenWrt 25.12.4 `ramips/mt7621` SDK for ASUS RT-AX53U and compiles the Go
agent as little-endian MIPS with software floating point. It builds the LuCI
application, the shell agent and the production Go agent together:
```sh
docker build \
--file deploy/luci-builder/Dockerfile \
--target artifacts \
--output type=local,dest=dist/rmm-openwrt-25.12.4-ramips-mt7621 \
.
```
The output directory contains the installable packages and `SHA256SUMS`.
`luci-app-rmm-agent` and the shell `rmm-agent` are architecture-independent. The Go
runtime is architecture-specific and is built as `linux/mipsle` with
`GOMIPS=softfloat` by default. Use an SDK from the same OpenWrt release and target as
the router, and set the matching Go architecture when targeting another device. For
example, an x86_64 router needs this additional build argument:
```sh
--build-arg RMM_GOARCH=amd64 --build-arg RMM_GOAMD64=v1
```
Override `OPENWRT_SDK_URL` and `OPENWRT_SDK_SHA256` with `--build-arg` when building for
another release or target. Install exactly one runtime package: `rmm-agent` or
`rmm-agent-go-production`. They intentionally conflict because both own the same service
and executable paths.
## Install on OpenWrt 25.12.4
For the ASUS RT-AX53U (`ramips/mt7621`), copy the production Go runtime and the LuCI
application to the router. Do not copy or install the shell runtime at the same time:
```sh
cd dist/rmm-openwrt-25.12.4-ramips-mt7621
sha256sum -c SHA256SUMS
scp \
rmm-agent-go-production-0.5.0-r2.apk \
luci-app-rmm-agent-0.1.0-r1.apk \
root@ROUTER_IP:/tmp/
```
Then install the locally built, unsigned packages over SSH:
```sh
apk add --allow-untrusted \
/tmp/rmm-agent-go-production-0.5.0-r2.apk \
/tmp/luci-app-rmm-agent-0.1.0-r1.apk
/etc/init.d/rpcd restart
/etc/init.d/uhttpd restart
```
Open LuCI, go to **Services → RMM agent**, enter the HTTPS server URL and a fresh
one-time enrollment grant, enable the agent, save the settings, and start or restart the
service. Verify it from SSH with:
```sh
/etc/init.d/rmm-agent status
logread -e rmm-agent
```