Production-ready OpenWrt build for NapiLab Napi industrial IoT SBC and SOM based on Rockchip RK3308 SoC.
This repository contains all customizations needed to turn a vanilla OpenWrt snapshot into a fully functional industrial Modbus TCP gateway with a polished web interface.
| Board | Storage | Docs |
|---|---|---|
| NapiLab Napi-C | 4GB NAND — 32GB eMMC | Industrial SBC |
| NapiLab Napi-P | 4GB NAND — 32GB eMMC | Industrial SBC |
| NapiLab Napi-Slot | 4GB NAND — 32GB eMMC | SOM |
| Radxa ROCK Pi S | — | Community board, same RK3308 SoC |
All boards share the same Rockchip RK3308 SoC — one firmware to rule them all.
This build is not limited to NapiLab Napi boards. Any board based on Rockchip RK3308 can use the same customizations — just change the target profile in .config.
To build for a different board, replace the target device:
# List available RK3308 boards
grep "CONFIG_TARGET_rockchip_armv8_DEVICE" .config
# Example: build for Radxa ROCK Pi S
sed -i 's/CONFIG_TARGET_PROFILE="DEVICE_napilab_napic"/CONFIG_TARGET_PROFILE="DEVICE_radxa_rock-pi-s"/' .configTo switch to a different board, edit .config directly — never use make menuconfig as it will overwrite your configuration:
# Switch target profile to Radxa ROCK Pi S
sed -i 's/DEVICE_napilab_napic/DEVICE_radxa_rock-pi-s/g' .configAll uci-defaults scripts, packages and customizations will work on any RK3308 board. The only board-specific parts are:
- Device Tree (
rk3308-napi-c.dts) — may need adjustment for different pin mux - U-Boot defconfig (
napic-rk3308) — based on ROCK Pi S, works on similar hardware - MAC generation from OTP — works on all RK3308 boards
The same approach works for any OpenWrt-supported Rockchip board (RK3328, RK3566, RK3568, RK3588) — just select the appropriate target profile and adapt the DTS if needed.
| Component | Details |
|---|---|
| SoC | Rockchip RK3308 (quad-core ARM Cortex-A35, 1.3GHz) |
| RAM | 256MB / 512MB DDR3 |
| Storage | 4GB NAND up to 32GB eMMC |
| Ethernet | 100Mbps (GMAC + RTL8201F PHY) |
| USB | 2x USB 2.0 Host |
| UART | 3x UART (ttyS0 console, ttyS1, ttyS2) |
| Wi-Fi | RTL8723DS (802.11b/g/n) |
- Added
napic-rk3308U-Boot variant based on Radxa ROCK Pi S (same RK3308 hardware) - Custom
napic-rk3308_defconfigpatch
- Custom DTS
rk3308-napi-c.dtsbased on ROCK Pi S - UART1 →
/dev/ttyS1 - UART2 →
/dev/ttyS2
Generated deterministically from RK3308 OTP data — same MAC across reboots on every board:
MAC=$(cat /sys/bus/nvmem/devices/rockchip-otp0/nvmem | md5sum | \
sed 's/\(..\)\(..\)\(..\)\(..\)\(..\)\(..\).*/02:\1:\2:\3:\4:\5/')| Script | Purpose |
|---|---|
70-rootpt-resize |
Resize root partition to fill storage (reboot) |
80-rootfs-resize |
Expand filesystem after partition resize (reboot) |
91-bash |
Set bash as default shell for root |
92-timezone |
Set timezone to MSK-3 |
93-console-password |
Enable password prompt on serial console |
94-macaddr |
Generate stable MAC from OTP |
95-network |
Configure eth0 without bridge |
96-hostname |
Set hostname to napiwrt |
97-luci-theme |
Set LuCI theme to openwrt-2020 |
99-dhcp |
DHCP configuration |
Industrial stack
mosquitto+mosquitto-client— MQTT brokermbusd+luci-app-mbusd— Modbus TCP gateway with web UImbpoll— Modbus CLI tool
1-Wire / DS18B20
owfs,owserver,owfs-client— 1-Wire bus support and device access
I2C / GPIO
i2c-tools,libi2c— I2C bus diagnosticsgpiod-tools,libgpiod— GPIO control via libgpiod
Metrics collection
collectd+ modulesmqtt,exec,network,rrdtool,modbus— metrics collection and export
USB-Serial adapters
kmod-usb-serial-ch341,cp210x,ftdi,pl2303
LTE modem
kmod-usb-net-qmi-wwan+uqmi— Quectel EP06 support
Disk management and partition resize
parted,fdisk,cfdisk,losetup,resize2fs
Networking and admin
openssh-sftp-server— SFTP accessluci-ssl-wolfssl— HTTPS for LuCItcpdump,ethtool— network diagnosticsbash,htop,nano,screen,tree— admin tools
C++ runtime
libstdcpp— required for native Node.js modules (Zigbee2MQTT)
Web interface for mbusd Modbus gateway — the crown jewel of this build.
- Start / Stop / Restart service
- Enable / Disable autostart
- Live process status with actual running parameters
- Listening IP:port display
- Full serial port and Modbus configuration
→ See luci-app-mbusd repository
sudo apt install build-essential clang flex bison g++ gawk gcc-multilib \
gettext git libncurses-dev libssl-dev python3-distutils rsync unzip zlib1g-devgit clone https://github.com/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -atar xzf napic-openwrt-YYYYMMDD-HHMM-v1.0.tar.gz -C /path/to/openwrt/make package/boot/uboot-rockchip/compile VARIANT=napic-rk3308 -j$(nproc)make -j$(nproc)Output: bin/targets/rockchip/armv8/openwrt-rockchip-armv8-napilab_napic-ext4-sysupgrade.img.gz
gunzip openwrt-rockchip-armv8-napilab_napic-ext4-sysupgrade.img.gz
dd if=openwrt-rockchip-armv8-napilab_napic-ext4-sysupgrade.img of=/dev/sdX bs=4M status=progress| Parameter | Value |
|---|---|
| IP | DHCP (stable MAC ensures consistent lease) |
| Web UI | http://<IP>/ → LuCI |
| SSH | root@<IP> |
| Console | ttyS0, 1500000 baud |
This build supports running Zigbee2MQTT on OpenWrt. Since OpenWrt uses musl libc, the standard Node.js binaries won't work — a special musl/aarch64 build is required.
A pre-built archive is available in Releases:
zigbee2mqtt-2.9.1-openwrt-aarch64-musl.tar.gz
# Install Node.js (musl/arm64)
wget https://unofficial-builds.nodejs.org/download/release/v22.22.0/node-v22.22.0-linux-arm64-musl.tar.gz
mkdir -p /opt/node
tar xzf node-v22.22.0-linux-arm64-musl.tar.gz -C /opt/node --strip-components=1
# Install Zigbee2MQTT
mkdir /opt/zigbee2mqtt
tar xzf zigbee2mqtt-2.9.1-openwrt-aarch64-musl.tar.gz -C /opt/zigbee2mqtt/
# Install runtime dependency
apk add libstdcpp6
# Run
export PATH=/opt/node/bin:$PATH
cd /opt/zigbee2mqtt && npm startWeb UI available at http://<IP>:8080/
Requires 512 MB RAM and ~500 MB free disk space. Mosquitto is already pre-installed in this build.
- Zigbee2MQTT 2.9.1 pre-built archive for musl/aarch64 available in Releases
- Automatic root partition and filesystem resize on first boot (scripts 70/80-rootpt-resize, double reboot)
- Disk management:
parted,fdisk,cfdisk,losetup,resize2fs - 1-Wire / DS18B20:
owfs,owserver,owfs-client— 1-Wire device support via OWFS - I2C:
i2c-tools,libi2c— I2C bus diagnostics and device access - GPIO:
gpiod-tools,libgpiod— GPIO control via libgpiod - Collectd:
collectd+ modulesmqtt,exec,network,rrdtool,modbus— metrics collection and export - C++ runtime:
libstdcpp— required for native Node.js modules (Zigbee2MQTT) - Utilities:
tree,fuse-utils
- Automatic root partition resize on first boot (double reboot)
- Added packages: parted, fdisk, cfdisk, resize2fs, losetup
- Initial release
- Custom U-Boot, DTS, uci-defaults
- mbusd + luci-app-mbusd
- Stable MAC from OTP
GPL-2.0 (following OpenWrt)
