amxrt CLI options explained (with examples)
Grow through practice
No need to finish reading — test now
amxrtprovides no business logic. It does three things: load ODL, load bus backends, run the event loop. Every option is just startup wiring for those three things.
Overview
amxrt [OPTIONS] <odl files>
| Option | What it does | |
|---|---|---|
-B, --backend <so> | Load a bus backend (repeatable) | |
-u, --uri <uri> | Add a bus URI (repeatable) | |
-A, --no-auto-detect | Do not auto-detect sockets or backends | |
-C, --no-connect | Do not auto-connect to provided/detected URIs | |
-I, --include-dir <dir> | ODL include search dir (repeatable) | |
-L, --import-dir <dir> | ODL import search dir (repeatable) | |
-o, --option name=value | Set a config option (ODL may override) | |
-F, --forced-option name=value | Force a config option (ODL cannot override) | |
-O, --ODL <string> | Inline ODL string (only one) | |
-D, --daemon | Daemonize | |
-p, --priority <nice> | Set the nice level | |
-N, --no-pid-file | Do not write a pid file under /var/run | |
-E, --eventing | Emit events while loading ODL | |
| `-d, --dump [caps\ | config]` | Dump capabilities/config at startup |
-l, --log | Log to syslog instead of stdout/stderr | |
-R, --requires <root> | Wait until a data-model object exists | |
-h/-H | Help (-H is extended help) | |
-V, --version | Version |
Most common: backend + URI
amxrt -N \
-u ubus:/var/run/ubus/ubus.sock \
-B /usr/bin/mods/amxb/mod-amxb-ubus.so \
/etc/amx/hello/hello.odl
-B: loadmod-amxb-ubus.soas a backend;-u: connect to that ubus socket;-N: no pid file (common in containers / non-root);- the last argument is the ODL file.
-A -Calone is not enough: you still need at least one backend via-B, otherwise you getNo backends specified(measured).
Auto-detect (the default)
Without -B/-u, amxrt:
- loads backends from
/usr/bin/mods/amxb(defaultbackend-dir); - probes
/var/run/ubus.sockor/var/run/ubus/ubus.sockand auto-connects; - if the pcb backend is loaded, also probes
/var/run/pcb_sys.
-A disables auto-detect; -C disables auto-connect. Fully manual:
amxrt -A -C -B <backend.so> -u <uri> <file.odl>
-o vs -F: who overrides whom
# the ODL name overrides -o
amxrt -N -dconfig -o name=from-o -O '%config { name = "from-odl"; }'
# result: name = "from-odl"
# -F cannot be overridden by the ODL
amxrt -N -dconfig -F name=from-F -O '%config { name = "from-odl"; }'
# result: name = "from-F"
-o: a default; ODL may change it;-F: a forced value; ODL cannot change it (good for locking downname, paths, switches at deploy time).
Inline ODL: -O
amxrt -N -A -C -B /usr/bin/mods/amxb/mod-amxb-ubus.so \
-O '%config { name = "hello"; } %define { object Hello { string Greeting = "hi"; } }'
- only one
-Ois allowed; - useful for tests and quick checks, not for long-term deployment.
Search paths: -I / -L
ODL include/import look in the current/config dir by default; otherwise:
amxrt -I /etc/amx -I /etc/amx/common \
-L /usr/lib/amx \
/etc/amx/hello/hello.odl
-I: directories forinclude;-L: directories forimport(.soplugins);- both can be repeated.
Startup ordering: -R
When process A depends on objects from process B, -R waits:
amxrt -R Device.WiFi. /etc/amx/hello/hello.odl
- object exists: continue;
- not yet: wait/retry (avoids "started too fast, object not found");
- useful when systemd has no explicit dependency but the data model does.
Process options: -D / -N / -p / -l
| Option | Use it for | Note |
|---|---|---|
-D | traditional init scripts | do not use under systemd; run in the foreground |
-N | containers / non-root | no /var/run/*.pid |
-p 10 | lower priority | higher nice = lower priority; negative values usually need root |
-l | traditional syslog | avoid in containers; keep stdout/stderr |
-Dtiming: after entry points are called, before the data model is registered on the bus. Do not assume registration is complete inside an entry point.
Debug: -d / -V / -E
amxrt -V
amxrt -N -dconfig -O '%config { name = "hello"; }'
amxrt -N -dcaps
-dconfig: print the effective config (including defaults), then keep running;-dcaps: print capabilities;- if you only want the dump, wrap it:
timeout 3 amxrt -N -dconfig -O '%config { name = "hello"; }'
-E: emit events while loading ODL; useful for event-chain debugging, but can trigger side effects early.
Defaults (measured with -dconfig)
backend-dir = /usr/bin/mods/amxb
cfg-dir = /etc/amx
auto-detect = true
auto-connect = true
connect-retry-timeout-min = 5000
connect-retry-timeout-max = 10000
connect-retry-max-count = 10
The same config, in ODL
Every CLI option can go into the main ODL's %config:
%config {
uris = "ubus:/var/run/ubus/ubus.sock";
backends = "/usr/bin/mods/amxb/mod-amxb-ubus.so";
auto-detect = false;
auto-connect = true;
include-dirs = "/etc/amx";
import-dirs = "/usr/lib/amx";
daemon = false;
priority = 0;
}
For deployment this is usually better: the config travels with the ODL, and systemd only needs ExecStart=/usr/bin/amxrt /etc/amx/hello/hello.odl.
One sentence
amxrt options are the startup wiring diagram: backends, bus, search paths, config precedence, process behavior. Get the wiring right, and the ODL and data model make sense.
Series: Inside prplOS: AMX Runtime (Guide). Related: Integrating Ambiorix into Yocto · Runnable demo
Comments 0
No comments yet — be the first!