← All posts

OpenWrt + Yocto: When a Hybrid Build Makes Sense (and Where It Bites)

Grow through practice

No need to finish reading — test now

One line: OpenWrt is a distribution; Yocto is a build framework. A hybrid is not the goal; the sensible goal is: let Yocto own BSP/compliance, and let ubus/UCI own the management contract.

When a hybrid is worth it

  • The hardware BSP is Yocto-first (NXP LSDK, Qualcomm QSDK's Yocto variant, TI SDK…);
  • You need license manifests / SBOM / an SDK, or systemd, containers, a complex user space;
  • You only need OpenWrt's ubus + uci as the management plane, not the whole OpenWrt distro;
  • You want your own GUI and do not want to be tied to the luci-app-* ecosystem.

Conversely, if the goal is "a flashable router, fast", do not hybridize — use OpenWrt (or prplOS) directly.

Three routes

RouteBaseProsCost
A. OpenWrt / prplOSOpenWrt buildrootfull ecosystem, fast iteration, ubus/UCI/LuCI readyBSP/compliance/SDK constrained by OpenWrt
B. Yocto + OpenWrt user spaceYoctogood BSP/compliance/SDK, keeps the ubus/UCI contractyou maintain the porting layer (libc/init/netifd)
C. Pure YoctoYoctocleanest, native systemdloses the OpenWrt ecosystem/tools

B is the meta-openwrt path: the community layer (kraj) packages ubus/uci/procd/netifd/libubox/rpcd etc. as OE recipes. It is not an official product layer; its newest release branch is kirkstone, so scarthgap needs forward-porting, and vendors usually fork and maintain their own copy.

This is not exotic: Qualcomm's QSDK has both OpenWrt-based and Yocto-based variants depending on the platform; the Yocto variant brings OpenWrt user space in. Same idea.

Six traps

1. libc: musl vs glibc

OpenWrt defaults to musl; NXP/Qualcomm BSPs often assume glibc. Do not mix prebuilt OpenWrt binaries — rebuild ubus/uci/ubox from source in Yocto.

2. procd vs systemd

ubus and uci are fairly standalone; procd is a service manager and assumes OpenWrt's /etc/init.d and hotplug model.

  • Going Yocto: prefer systemd + ubus/uci with small glue;
  • Keeping procd: do not also run systemd;
  • Want both: confine procd to OpenWrt components; do not let it be PID 1.

3. netifd is harder than ubus/uci

netifd is deeply tied to UCI/ubus/hotplug. If you do not need OpenWrt's network stack, use systemd-networkd/NetworkManager and expose your own ubus objects.

4. Kernel and offload

DPAA/CAAM/SEC offload lives in the NXP BSP kernel + user space (restool/dpaa), not in OpenWrt's buildroot. Pick one kernel (usually the BSP kernel) and port the OpenWrt user space onto it, not the other way around.

5. LuCI

Dropping LuCI is fine, but you lose luci-app-*. Keep ubus/UCI as the backend contract and write your own frontend; the community can still script your device.

6. Upgrades and package management

  • Upgrades: OpenWrt sysupgrade/overlayfs vs Yocto A/B + RAUC/OSTree;
  • Packages: opkg vs ipk/rpm/deb.

Do not mix two sets. Decide partitioning and bootloader early; changing later hurts.

Minimal validation path

Do not move everything at once. Validate in this order:

  1. Build libubox + ubus + uci in Yocto, run ubusd and uci show;
  1. Write a minimal ubus service + a UCI config file, verify read/write;
  1. Then decide whether you need procd (or a systemd unit);
  1. Only then touch netifd / offload / GUI.

This sequence tells you in days whether the hybrid is worth it, instead of discovering init/libc conflicts weeks later.

One sentence

The value of a hybrid is division of labor: Yocto owns BSP/compliance/SDK; ubus/UCI own the management contract. Once you start mixing two inits, two package managers, and two libcs, it becomes a maintenance nightmare.


Related: Integrating Ambiorix into Yocto · Runnable demo Related: prplOS vs OpenWrt Community layer: kraj/meta-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.