← All posts

amxrt CLI options explained (with examples)

Grow through practice

No need to finish reading — test now

amxrt provides 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>
OptionWhat it does
-B, --backend <so>Load a bus backend (repeatable)
-u, --uri <uri>Add a bus URI (repeatable)
-A, --no-auto-detectDo not auto-detect sockets or backends
-C, --no-connectDo 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=valueSet a config option (ODL may override)
-F, --forced-option name=valueForce a config option (ODL cannot override)
-O, --ODL <string>Inline ODL string (only one)
-D, --daemonDaemonize
-p, --priority <nice>Set the nice level
-N, --no-pid-fileDo not write a pid file under /var/run
-E, --eventingEmit events while loading ODL
`-d, --dump [caps\config]`Dump capabilities/config at startup
-l, --logLog to syslog instead of stdout/stderr
-R, --requires <root>Wait until a data-model object exists
-h/-HHelp (-H is extended help)
-V, --versionVersion

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: load mod-amxb-ubus.so as 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 -C alone is not enough: you still need at least one backend via -B, otherwise you get No backends specified (measured).

Auto-detect (the default)

Without -B/-u, amxrt:

  • loads backends from /usr/bin/mods/amxb (default backend-dir);
  • probes /var/run/ubus.sock or /var/run/ubus/ubus.sock and 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 down name, 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 -O is 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 for include;
  • -L: directories for import (.so plugins);
  • 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

OptionUse it forNote
-Dtraditional init scriptsdo not use under systemd; run in the foreground
-Ncontainers / non-rootno /var/run/*.pid
-p 10lower priorityhigher nice = lower priority; negative values usually need root
-ltraditional syslogavoid in containers; keep stdout/stderr

-D timing: 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

Practice

Found this useful?

I write about AI agents × embedded / edge AI. Subscribe, or email me a concrete problem.

Guestbook →Subscribe (RSS)Support

Comments 0

No comments yet — be the first!

No login required; name is optional.