← All posts

Integrating Ambiorix (AMX) into Yocto: From Layer to Running

Grow through practice

No need to finish reading — test now

Conclusion first: There is an official meta-amx (honister only); for newer Yocto releases you build your own layer — but you do not start from scratch: follow its dependency chain and recipe structure and port it.

1. A quick look at the official layer

Repository:

git clone -b honister https://gitlab.com/prpl-foundation/yocto/metalayers/meta-amx.git
bitbake-layers add-layer meta-amx
bitbake amxrt
  • It is PRPL Foundation's official Ambiorix Yocto metadata (PRPL's own sdk-builder uses it);
  • The honister branch is still maintained (tags up to honister_v15.17.1);
  • main contains only a README and is a placeholder;
  • LAYERSERIES_COMPAT only lists honister.

So: use it directly on honister; build or port your own layer for kirkstone/scarthgap.

2. Dependency chain (the order to write recipes)

libamxc
├── libamxj        (yajl)
├── libamxp        (libcap-ng, bison-native, flex-native)
├── libamxd        (libamxc, libamxp)
├── libamxb        (libamxc, libamxp, libamxd, uriparser)
├── libamxs        (libamxc, libamxp, libamxb, libamxd)
├── libamxo        (libamxc, libamxp, libamxd, libamxs, bison/flex)
├── libamxrt       (libamxc, libamxj, libamxp, libamxd, libamxo, libamxb, libevent, libcap-ng)
├── amxrt          (libamxrt + all of the above)
└── mod-amxb-ubus  (libamxc, libamxb, libamxd, ubus)

yajl, uriparser, libcap-ng and libevent live in meta-oe, so the layer must depend on meta-oe.

3. Minimal layer structure

meta-ambiorix/
├── conf/layer.conf
├── classes/config-amx.bbclass
├── recipes-ambiorix/
│   ├── libamxc/libamxc_git.bb
│   ├── libamxj/libamxj_git.bb
│   ├── libamxp/libamxp_git.bb
│   ├── libamxd/libamxd_git.bb
│   ├── libamxb/libamxb_git.bb
│   ├── libamxs/libamxs_git.bb
│   ├── libamxo/libamxo_git.bb
│   ├── libamxrt/libamxrt_git.bb
│   ├── amxrt/amxrt_git.bb
│   └── mod-amxb-ubus/mod-amxb-ubus_git.bb
└── recipes-core/packagegroups/packagegroup-ambiorix.bb

conf/layer.conf:

BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "ambiorix"
BBFILE_PATTERN_ambiorix = "^${LAYERDIR}/"
BBFILE_PRIORITY_ambiorix = "10"

LICENSE_PATH += "${LAYERDIR}/licenses"

LAYERDEPENDS_ambiorix = "core meta-oe"
LAYERSERIES_COMPAT_ambiorix = "scarthgap styhead walnascar"

SAH is not a common SPDX license: copy the upstream licenses/SAH into your layer, otherwise BitBake reports license SAH not found. Also, SAH is SoftAtHome's own terms — confirm licensing before shipping a product (the LICENSE file in each repository is authoritative).

4. Recipe template (libamxc as an example)

SUMMARY = "Ambiorix generic containers"
LICENSE = "SAH & BSD-2-Clause-Patent"
LIC_FILES_CHKSUM = "file://LICENSE;md5=f8eaa5ae328592b1346db42ce2936d90"

SRC_URI = "git://gitlab.com/prpl-foundation/components/ambiorix/libraries/libamxc.git;protocol=https;nobranch=1"
SRCREV = "1623d9fc299c03c9d47adb95a884a0309cabf4eb"
S = "${WORKDIR}/git"

inherit pkgconfig

EXTRA_OEMAKE = " \
    DEST=${D} \
    PREFIX=${prefix} \
    LIBDIR=${libdir} \
    BINDIR=${bindir} \
    INCLUDEDIR=${includedir} \
"

do_compile() {
    oe_runmake
}

do_install() {
    oe_runmake install
}

FILES:${PN} += "${libdir}/libamxc.so.*"
FILES:${PN}-dev += "${libdir}/libamxc.so ${includedir}/amxc/*.h"
FILES:${PN}-staticdev += "${libdir}/libamxc.a"

Key points:

  • DEST=${D}: BAF's makefile uses DEST as DESTDIR;
  • LIBDIR=${libdir}: otherwise the makefile generates /usr/lib/aarch64-... from $(CC) -dumpmachine, and packaging will not match;
  • PREFIX/BINDIR/INCLUDEDIR likewise, normalized to Yocto's standard paths;
  • Cross-compilation relies on BitBake exporting CC/CFLAGS/LDFLAGS; the makefile uses +=, so they are not overridden.

For the other libraries, change only SUMMARY, SRC_URI, SRCREV, the DEPENDS/RDEPENDS and FILES. Copy dependencies from the table in section 2.

5. Do we need config-amx.bbclass?

The official class really does only two things:

EXTRA_OEMAKE += "DEST=${D} D=${D}${base_prefix} PREFIX=${prefix} LIBDIR=${libdir} BINDIR=${bindir} INCLUDEDIR=${includedir}"
do_install() { oe_runmake install; }

One easy trap: SAH_CONFIG / CONFIG_SAH_* in the recipes are BAF-era options; when building with make, these variables are not referenced by the libamxc/libamxo/libamxrt makefiles. Copying them is harmless, but do not assume they do anything.

When building your own layer, put this block directly in the recipes (or copy a trimmed-down class).

6. Add it to the image

packagegroup-ambiorix.bb:

inherit packagegroup

RDEPENDS:${PN} = " \
    amxrt \
    libamxd \
    libamxo \
    mod-amxb-ubus \
"

local.conf / image recipe:

IMAGE_INSTALL:append = " packagegroup-ambiorix"

Build:

bitbake libamxc libamxp libamxd libamxb libamxo libamxrt amxrt
bitbake core-image-minimal

7. Run it: ODL + bus + systemd

A pure data-model hello.odl:

%config {
    name = "hello";
}

%define {
    object Hello {
        string Greeting = "Hello, AMX";
        uint32 Count = 0;
    }
}

Start it (ubus backend):

amxrt -u ubus:/var/run/ubus/ubus.sock \
      -B /usr/bin/mods/amxb/mod-amxb-ubus.so \
      /etc/amx/hello/hello.odl

-A -C only disables auto-detect and connect; you still need -B to load a backend (such as ubus), otherwise amxrt fails with No backends specified. To be reachable from ubus/amx-cli, you need ubusd + the backend.

systemd unit:

[Unit]
Description=AMX hello data model
After=network.target
# How ubusd starts depends on your image: ubusd.service on systemd, or an init script on SysV

[Service]
ExecStart=/usr/bin/amxrt /etc/amx/hello/hello.odl
Restart=always
RestartSec=2

[Install]
WantedBy=multi-user.target

In the recipe:

inherit systemd
SYSTEMD_SERVICE:${PN} = "hello.service"
SYSTEMD_AUTO_ENABLE:${PN} = "enable"

SRC_URI += "file://hello.odl file://hello.service"

do_install:append() {
    install -d ${D}${sysconfdir}/amx/hello
    install -m 0644 ${WORKDIR}/hello.odl ${D}${sysconfdir}/amx/hello/
    install -d ${D}${systemd_system_unitdir}
    install -m 0644 ${WORKDIR}/hello.service ${D}${systemd_system_unitdir}/
}

FILES:${PN} += "${sysconfdir}/amx/hello/hello.odl"

Verify:

ubus list | grep Hello
ubus call Hello _get
# or (amx-cli needs the extra libamxt/libamxm/amx-cli recipes)
amx-cli -u ubus:/var/run/ubus/ubus.sock

8. What to change from honister to scarthgap

  1. Change LAYERSERIES_COMPAT to the target release;
  1. Old FILES_${PN} → FILES:${PN} (upstream's newer recipes already use the colon form);
  1. LICENSE += → set LICENSE = "..." first, so the variable is initialized;
  1. Do not forget bison-native / flex-native (libamxp, libamxo);
  1. Replace SysV's inherit update-rc.d with systemd if the image uses systemd;
  1. Newer components may have extra dependencies (such as libocispec, libevent); trust each repository's baf.yml rather than copying an old recipe's DEPENDS.

9. Common errors

SymptomCause
cap-ng.h: No such filemissing libcap-ng (meta-oe)
yajl/yajl_parse.h not foundmissing yajl
uriparser/Uri.h not foundmissing uriparser
cannot find -lamxcmissing DEPENDS, or not installed into the sysroot
libamxc.so.2: cannot openmissing RDEPENDS / package not in the image
amxrt runs but ubus list shows no objectbackend not loaded / ubusd not running / wrong URI
Installed into /usr/lib/aarch64-...LIBDIR=${libdir} was not passed
do_install cannot find DESTthe makefile uses DEST, not DESTDIR

One sentence

The hard part of integrating AMX into Yocto is not recipe syntax; it is the dependency chain and the bus backend. Get libamxc → libamxp → libamxd → libamxb → libamxo → libamxrt and DEST/LIBDIR right, and the rest is packaging and services.


Concepts: What AMXD Means · libamxd in practice Official layer: prpl-foundation/yocto/metalayers/meta-amx Runnable demo: meta-ambiorix-demo (scarthgap + QEMU + ubus + ODL + systemd) Related: prplOS vs OpenWrt

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.