Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Harness OS: Orange Pi 4 Pro image on Debian 12

bubu-dudub15f720e5b2b
diff --git a/os/platforms/orangepi-4pro/README.md b/os/platforms/orangepi-4pro/README.md
new file mode 100644
index 000000000..c0108dd36
--- /dev/null
+++ b/os/platforms/orangepi-4pro/README.md
@@ -0,0 +1,59 @@
+# Orange Pi 4 Pro (Debian 12) image work
+
+A Harness SD image for the Orange Pi 4 Pro (Allwinner A733, aarch64), built on Orange Pi's
+official **Debian 12 server** image. It boots straight into the same session as the PC image:
+autologin on tty1, labwc, `hn` full screen in foot, Chromium on Super+b, the agent runtime as
+a lingering user service. The board can also be used over SSH alone.
+
+This is private platform work, **not a public Harness release**. No installer metadata or
+update feed is generated, and the board keeps Debian's own system updates.
+
+## What differs from the PC image
+
+| | PC image | Orange Pi 4 Pro |
+|---|---|---|
+| Base | Arch Linux, LTS kernel | Orange Pi Debian 12, vendor kernel 5.15 |
+| Compositor | labwc 0.20.2 on Arch's wlroots 0.20 | the same labwc source and patch, built with wlroots 0.20.2 and newer Wayland libraries into `/opt/harness-wl` |
+| Rendering | GPU | CPU (`WLR_RENDERER=pixman`): the PowerVR GPU has no open driver |
+| OpenCode | Arch's 2.x | the official 1.x ARM release pinned in `os/packaging/fedora/opencode.lock.json`; the skel config is restated in OpenCode 1's `permission` form |
+| System profile | `arch` | `debian`: `hn-os` and `harness install/upgrade/rollback` refuse PC system operations, as on Fedora |
+| Screen lock | gtklock | not available on Debian 12 (Super+l and the idle lock do nothing yet) |
+
+The session files come from `os/tools/build-package.py`'s `stage()`, so the board runs the PC
+package's tree. `install-session.sh` removes only the Arch-specific parts: pacman hooks, the
+installer, system updates, PC drivers and boot splash.
+
+## Build
+
+On the board, running Orange Pi's Debian 12 server image, with a clean checkout:
+
+```sh
+sudo apt install build-essential musl-tools cmake ninja-build pkg-config python3-venv parted \
+ libffi-dev libexpat1-dev libxml2-dev libudev-dev libmtdev-dev libevdev-dev libseat-dev \
+ libegl-dev libgles-dev libgbm-dev hwdata libglib2.0-dev libcairo2-dev libpango1.0-dev \
+ libpng-dev librsvg2-dev libpciaccess-dev
+# Node 22 (NodeSource) and Rust with the aarch64-unknown-linux-musl target, then:
+HARNESS_OS_RUNTIME_DIR=os/work/runtime-arm bash os/tools/build-runtime.sh
+sudo install -d -o "$USER" /opt/harness-wl
+bash os/platforms/orangepi-4pro/build-compositor.sh
+sudo bash os/platforms/orangepi-4pro/build-image.sh \
+ Orangepi4pro_1.0.6_debian_bookworm_server_linux5.15.147.img os/work/runtime-arm \
+ harness-orangepi4pro.img
+```
+
+The base image is Orange Pi's download (Orange Pi 4 Pro → Official Images → Debian); check it
+against its `.sha` file first. Orange Pi's own Debian 12 boots on the 4 GB and 6 GB boards;
+the community Armbian image did not boot a 6 GB board.
+
+## First boot
+
+Write the image with balenaEtcher. The account is Orange Pi's default `orangepi` with password
+`orangepi`; change it with `passwd`. Wi-Fi: Super+w, or `sudo nmcli --ask device wifi connect
+NAME`. Sign in with `harness login --qr` and scan from Harness on a phone.
+
+## Checked on hardware
+
+Orange Pi 4 Pro over HDMI (1920×1080): autologin into labwc and `hn`, the daemon after a
+reboot, `hn-browser` opening Chromium maximized, OpenCode answering on Muse Spark 1.3 Free,
+`harness login --qr` rendering on the console. Keyboard shortcuts, audio, suspend and the
+screen lock remain unverified.
diff --git a/os/platforms/orangepi-4pro/build-compositor.sh b/os/platforms/orangepi-4pro/build-compositor.sh
new file mode 100755
index 000000000..924f3df74
--- /dev/null
+++ b/os/platforms/orangepi-4pro/build-compositor.sh
@@ -0,0 +1,79 @@
+#!/usr/bin/env bash
+# Build the Harness OS compositor (os/packaging/labwc) for Debian 12 on aarch64.
+# Debian 12 ships wlroots 0.15 and no labwc, so wlroots 0.20 and the newer libraries it needs
+# are built into a private prefix. Debian's own libraries are left untouched.
+# Run natively on the board as an ordinary user; PREFIX must already be writable:
+# sudo install -d -o "$USER" /opt/harness-wl
+set -euo pipefail
+SOURCE=$(cd -- "$(dirname -- "$0")/../../.." && pwd)
+PREFIX=${HARNESS_WL_PREFIX:-/opt/harness-wl}
+WORK=${HARNESS_WL_WORK:-$HOME/.cache/harness-wl}
+[[ $(uname -m) == aarch64 ]] || { echo 'Build natively on aarch64.' >&2; exit 1; }
+[[ -w $PREFIX ]] || { echo "Make $PREFIX writable first: sudo install -d -o \"\$USER\" $PREFIX" >&2; exit 1; }
+mkdir -p "$WORK"
+cd "$WORK"
+# Debian 12's meson is older than wlroots requires.
+[[ -x venv/bin/meson ]] || { python3 -m venv venv && venv/bin/pip -q install 'meson>=1.3'; }
+LIBDIR=$PREFIX/lib/aarch64-linux-gnu
+export PKG_CONFIG_PATH=$LIBDIR/pkgconfig:$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig
+export PATH=$PREFIX/bin:$WORK/venv/bin:$PATH
+export LDFLAGS="-Wl,-rpath,$LIBDIR"
+
+fetch() { # directory url
+ [[ -n $(ls -A "$1" 2>/dev/null) ]] && return
+ mkdir -p "$1"
+ curl -fsSL --retry 3 --retry-all-errors -o "$1.tar" "$2"
+ tar xf "$1.tar" --strip-components=1 -C "$1"
+ rm "$1.tar"
+}
+build() { # directory meson-options...
+ local name=$1; shift
+ [[ -f .done-$name ]] && return
+ echo "== $name"
+ rm -rf "$name/build"
+ { meson setup "$name/build" "$name" --prefix="$PREFIX" --buildtype=release -Dwerror=false "$@" &&
+ ninja -C "$name/build" && ninja -C "$name/build" install; } >"$name.log" 2>&1 || { tail -30 "$name.log"; exit 1; }
+ touch ".done-$name"
+}
+
+FD=https://gitlab.freedesktop.org
+fetch wayland $FD/wayland/wayland/-/archive/1.24.0/wayland-1.24.0.tar.gz
+fetch wayland-protocols $FD/wayland/wayland-protocols/-/archive/1.47/wayland-protocols-1.47.tar.gz
+fetch libdrm $FD/mesa/libdrm/-/archive/libdrm-2.4.131/libdrm-libdrm-2.4.131.tar.gz
+fetch pixman $FD/pixman/pixman/-/archive/pixman-0.46.4/pixman-pixman-0.46.4.tar.gz
+fetch libxkbcommon https://github.com/xkbcommon/libxkbcommon/archive/refs/tags/xkbcommon-1.11.0.tar.gz
+fetch libdisplay-info $FD/emersion/libdisplay-info/-/releases/0.3.0/downloads/libdisplay-info-0.3.0.tar.xz
+fetch libsfdo $FD/vyivel/libsfdo/-/archive/v0.1.4/libsfdo-v0.1.4.tar.gz
+fetch libinput $FD/libinput/libinput/-/archive/1.29.1/libinput-1.29.1.tar.gz
+fetch wlroots $FD/wlroots/wlroots/-/archive/0.20.2/wlroots-0.20.2.tar.gz
+# labwc itself: the exact source and patch the PC compositor uses.
+fetch labwc "$(python3 -c "import json,sys;print(json.load(open(sys.argv[1]))['url'])" "$SOURCE/os/packaging/labwc/source.json")"
+if [[ ! -f .patched-labwc ]]; then
+ patch -d labwc -p1 < "$SOURCE/os/packaging/labwc/session-lock-presentation.patch"
+ touch .patched-labwc
+fi
+
+build wayland -Ddocumentation=false -Dtests=false -Ddtd_validation=false
+build wayland-protocols -Dtests=false
+build libdrm -Dtests=false -Dman-pages=disabled -Dvalgrind=disabled -Dcairo-tests=disabled \
+ -Dintel=disabled -Dradeon=disabled -Damdgpu=disabled -Dnouveau=disabled -Dvmwgfx=disabled
+build pixman -Dtests=disabled -Ddemos=disabled -Dgtk=disabled -Dlibpng=disabled
+build libxkbcommon -Denable-docs=false -Denable-x11=false -Denable-tools=false -Denable-wayland=false \
+ -Dxkb-config-root=/usr/share/X11/xkb -Dx-locale-root=/usr/share/X11/locale
+build libdisplay-info
+build libsfdo -Dexamples=false -Dtests=false
+build libinput -Dlibwacom=false -Ddebug-gui=false -Dtests=false -Ddocumentation=false
+build wlroots -Dxwayland=disabled -Dexamples=false -Drenderers=gles2 -Dbackends=drm,libinput \
+ -Dallocators=gbm -Dcolor-management=disabled -Dlibliftoff=disabled
+# labwc's install also writes a systemd target outside the prefix; the session does not use it.
+if [[ ! -f .done-labwc ]]; then
+ echo "== labwc"
+ rm -rf labwc/build
+ { meson setup labwc/build labwc --prefix="$PREFIX" --buildtype=release --wrap-mode=nofallback -Dwerror=false \
+ -Dxwayland=disabled -Dman-pages=disabled -Dsvg=enabled -Dnls=disabled &&
+ ninja -C labwc/build; } >labwc.log 2>&1 || { tail -30 labwc.log; exit 1; }
+ install -Dm755 labwc/build/labwc "$PREFIX/bin/labwc"
+ touch .done-labwc
+fi
+"$PREFIX/bin/labwc" --version
+! ldd "$PREFIX/bin/labwc" | grep 'not found'
diff --git a/os/platforms/orangepi-4pro/build-image.sh b/os/platforms/orangepi-4pro/build-image.sh
new file mode 100755
index 000000000..943c28ffe
--- /dev/null
+++ b/os/platforms/orangepi-4pro/build-image.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+# Build a Harness SD image for Orange Pi 4 Pro from Orange Pi's official Debian 12 server image.
+# Run as root on an aarch64 Debian 12 host (the board itself), after build-runtime.sh and
+# build-compositor.sh, so the chroot runs natively and links against the same libraries.
+# Usage: build-image.sh BASE.img RUNTIME_DIR OUTPUT.img
+# Nothing from the build host's accounts (sign-ins, SSH keys, sources) enters the image.
+set -euo pipefail
+BASE=${1:?official Orangepi4pro_*_debian_bookworm_server_*.img}
+RUNTIME=${2:?runtime directory from os/tools/build-runtime.sh}
+OUT=${3:?output image}
+SOURCE=$(cd -- "$(dirname -- "$0")/../../.." && pwd)
+HERE=$SOURCE/os/platforms/orangepi-4pro
+PREFIX=${HARNESS_WL_PREFIX:-/opt/harness-wl}
+ACCOUNT=orangepi
+[[ $EUID == 0 && $(uname -m) == aarch64 ]] || { echo 'Run as root on aarch64.' >&2; exit 1; }
+[[ -x $PREFIX/bin/labwc ]] || { echo "Build the compositor first: $HERE/build-compositor.sh" >&2; exit 1; }
+OPENCODE=$(python3 -c "import json,sys;print(json.load(open(sys.argv[1]))['version'])" "$SOURCE/os/packaging/fedora/opencode.lock.json")
+MNT=$(mktemp -d)
+LOOP=
+
+cleanup() {
+ set +e
+ for m in dev/pts dev proc sys; do mountpoint -q "$MNT/$m" && umount "$MNT/$m"; done
+ mountpoint -q "$MNT" && umount "$MNT"
+ [[ -n $LOOP ]] && losetup -d "$LOOP"
+ rmdir "$MNT"
+}
+trap cleanup EXIT
+
+cp --sparse=always "$BASE" "$OUT"
+truncate -s +3G "$OUT"
+LOOP=$(losetup -fP --show "$OUT")
+parted -s "$LOOP" resizepart 1 100%
+partprobe "$LOOP"
+e2fsck -fy "${LOOP}p1" >/dev/null || true
+resize2fs "${LOOP}p1" >/dev/null
+mount "${LOOP}p1" "$MNT"
+for m in dev dev/pts proc sys; do mount --bind "/$m" "$MNT/$m"; done
+# Network for the chroot; the image's own resolv.conf is restored afterwards.
+mv "$MNT/etc/resolv.conf" "$MNT/etc/resolv.conf.harness" 2>/dev/null || true
+cp -L /etc/resolv.conf "$MNT/etc/resolv.conf"
+printf '#!/bin/sh\nexit 101\n' > "$MNT/usr/sbin/policy-rc.d"
+chmod 755 "$MNT/usr/sbin/policy-rc.d"
+curl -fsSL https://deb.nodesource.com/setup_22.x -o "$MNT/tmp/nodesource.sh"
+
+chroot "$MNT" /bin/bash -euo pipefail <<'EOF'
+export DEBIAN_FRONTEND=noninteractive LC_ALL=C
+bash /tmp/nodesource.sh >/dev/null 2>&1
+# Session tools from Debian 12, plus the runtime libraries of the private compositor build.
+apt-get install -y -qq nodejs jq curl tmux python3 foot chromium dbus-user-session swayidle grim slurp \
+ wl-clipboard xdg-desktop-portal-wlr xdg-utils fonts-dejavu fonts-noto-color-emoji fonts-noto-cjk \
+ libcairo2 libpango-1.0-0 libpangocairo-1.0-0 librsvg2-2 libxml2 libglib2.0-0 libpng16-16 \
+ libmtdev1 libevdev2 libudev1 libseat1 libgbm1 libegl1 libgles2 hwdata >/dev/null
+apt-get clean
+EOF
+mkdir -p "$MNT$PREFIX"
+cp -a "$PREFIX/." "$MNT$PREFIX/"
+rm -rf "$MNT$PREFIX/include" "$MNT$PREFIX/share/doc"
+if chroot "$MNT" ldd "$PREFIX/bin/labwc" | grep 'not found'; then
+ echo 'The compositor is missing a library in the image.' >&2
+ exit 1
+fi
+
+HARNESS_WL_PREFIX=$PREFIX "$HERE/install-session.sh" "$MNT" "$RUNTIME" "$ACCOUNT"
+# OpenCode, the version the ARM package pins; other agents install from hn when chosen.
+chroot "$MNT" su - "$ACCOUNT" -c "npm_config_prefix=\$HOME/.local npm install -g --no-audit --no-fund opencode-ai@$OPENCODE >/dev/null 2>&1"
+python3 - "$MNT/etc/harness-image.json" "$BASE" "$SOURCE" "$OPENCODE" <<'PY'
+import json, subprocess, sys
+from pathlib import Path
+path, base, source, opencode = sys.argv[1:]
+commit = subprocess.check_output(['git', '-c', f'safe.directory={source}', '-C', source, 'rev-parse', 'HEAD'], text=True).strip()
+Path(path).write_text(json.dumps({'board': 'orangepi4pro', 'base': Path(base).name,
+ 'source_commit': commit, 'opencode': opencode}, indent=2) + '\n')
+PY
+
+# Leave no build-host state behind.
+rm -f "$MNT/usr/sbin/policy-rc.d" "$MNT/etc/resolv.conf" "$MNT/tmp/nodesource.sh"
+mv "$MNT/etc/resolv.conf.harness" "$MNT/etc/resolv.conf" 2>/dev/null || true
+rm -rf "$MNT/root/.npm" "$MNT/home/$ACCOUNT/.npm"
+for leftover in "home/$ACCOUNT/.ssh/authorized_keys" "home/$ACCOUNT/.harness" "root/.ssh/authorized_keys"; do
+ [[ ! -e $MNT/$leftover ]] || { echo "Unexpected build-host state: $leftover" >&2; exit 1; }
+done
+chroot "$MNT" /usr/lib/harness/hn --version
+chroot "$MNT" su - "$ACCOUNT" -c '$HOME/.local/bin/opencode --version'
+chroot "$MNT" "$PREFIX/bin/labwc" --version
+df -h "$MNT" | tail -1
diff --git a/os/platforms/orangepi-4pro/install-session.sh b/os/platforms/orangepi-4pro/install-session.sh
new file mode 100755
index 000000000..6e494ebef
--- /dev/null
+++ b/os/platforms/orangepi-4pro/install-session.sh
@@ -0,0 +1,92 @@
+#!/usr/bin/env bash
+# Install the Harness OS session (labwc, foot, hn, Chromium) into a Debian 12 root for
+# Orange Pi 4 Pro. The files come from os/tools/build-package.py's stage(): the same tree the
+# PC package ships. Arch-only parts (pacman, installer, system updates, PC drivers) are left out.
+# Usage (as root): install-session.sh ROOT RUNTIME_DIR [USER]
+# ROOT / for the running board, or a mounted image
+# RUNTIME_DIR output of os/tools/build-runtime.sh on aarch64
+set -euo pipefail
+ROOT=${1:?root directory}
+RUNTIME=${2:?runtime directory}
+ACCOUNT=${3:-orangepi}
+SOURCE=$(cd -- "$(dirname -- "$0")/../../.." && pwd)
+PREFIX=${HARNESS_WL_PREFIX:-/opt/harness-wl}
+[[ $EUID == 0 ]] || { echo 'Run as root.' >&2; exit 1; }
+STAGE=$(mktemp -d)
+trap 'rm -rf "$STAGE"' EXIT
+
+# 1. Stage the PC package tree from this source, accepting the aarch64 runtime.
+python3 - "$SOURCE" "$RUNTIME" "$STAGE/tree" <<'PY'
+import importlib.util, json, subprocess, sys
+from pathlib import Path
+source, runtime, destination = map(Path, sys.argv[1:])
+spec = importlib.util.spec_from_file_location('build_package', source / 'os/tools/build-package.py')
+module = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(module)
+info = json.loads((runtime / 'source.json').read_text())
+if info.get('architecture') != 'aarch64' or info.get('dirty') is not False:
+ raise SystemExit('Use a clean aarch64 runtime from os/tools/build-runtime.sh.')
+module.validate_runtime = lambda runtime, commit: info
+commit = subprocess.check_output(['git', '-c', f'safe.directory={source}', '-C', str(source), 'rev-parse', 'HEAD'], text=True).strip()
+module.stage(source, runtime, destination, commit)
+# A non-arch profile makes hn-os and `harness install|upgrade|rollback` refuse the PC system
+# operations, as the Fedora package does. Debian keeps its own system updates.
+path = destination / 'usr/share/harness-os/runtime.json'
+runtime_info = json.loads(path.read_text())
+runtime_info['system_profile'] = 'debian'
+path.write_text(json.dumps(runtime_info, indent=2) + '\n')
+PY
+T=$STAGE/tree
+
+# 2. Leave out what belongs to the Arch PC image.
+rm -rf "$T/etc/pacman.d" "$T/etc/mkinitcpio.conf.d" "$T/etc/modprobe.d" "$T/usr/lib/modprobe.d" \
+ "$T/etc/systemd/zram-generator.conf" "$T/etc/tmux.conf" "$T/etc/NetworkManager" \
+ "$T/usr/lib/NetworkManager" "$T/usr/lib/udev/rules.d/81-harness-broadcom.rules" \
+ "$T/usr/lib/systemd/system" "$T/usr/share/plymouth" \
+ "$T/etc/sudoers.d/30-harness-updates" "$T/usr/lib/harness-os/init-keyring"
+for unit in harness-update.service harness-update.timer harness-gpu-check.service \
+ harness-gpu-check.timer harness-install.service; do
+ rm -f "$T/usr/lib/systemd/user/$unit"
+done
+# The PC skel targets Arch's OpenCode 2 ("permissions" list). ARM has only the official 1.x
+# release (as the Fedora package), so state the same rules in OpenCode 1's "permission" form.
+cat > "$T/etc/skel/.config/opencode/opencode.json" <<'EOF'
+{
+ "$schema": "https://opencode.ai/config.json",
+ "autoupdate": false,
+ "model": "opencode/muse-spark-1.3-contributor-free",
+ "permission": {
+ "external_directory": { "/usr/share/harness-os/*": "allow" },
+ "read": { "/usr/share/harness-os/*": "allow" },
+ "edit": { "/usr/share/harness-os/*": "deny" }
+ }
+}
+EOF
+# Debian's administrators are the sudo group, not wheel.
+sed -i 's/^%wheel/%sudo/' "$T/etc/sudoers.d/20-harness-network"
+
+# 3. Install the tree. Replace rather than overwrite files a running session may hold open.
+cp -a --remove-destination "$T/." "$ROOT/"
+chmod 440 "$ROOT/etc/sudoers.d/20-harness-network"
+# The compositor from build-compositor.sh, at the path the session starts.
+ln -sfn "$PREFIX/bin/labwc" "$ROOT/usr/lib/harness-os/labwc"
+# This board has a display controller and no GPU driver: render on the CPU.
+printf 'export WLR_RENDERER=pixman\n' > "$ROOT/etc/profile.d/harness-os-board.sh"
+# Block glyphs on the HDMI console, so a sign-in QR drawn there scans.
+sed -i 's/^CODESET=.*/CODESET="Uni2"/; s/^FONTFACE=.*/FONTFACE="Terminus"/; s/^FONTSIZE=.*/FONTSIZE="8x16"/' \
+ "$ROOT/etc/default/console-setup"
+
+# 4. The account: skel files, the daemon enabled and lingering, autologin on tty1.
+H=$ROOT/home/$ACCOUNT
+cp -an "$T/etc/skel/." "$H/"
+cp -a "$T/etc/skel/.config/opencode/opencode.json" "$H/.config/opencode/opencode.json"
+mkdir -p "$H/.local/bin" "$H/.local/state/harness-os" "$H/projects" \
+ "$H/.config/systemd/user/default.target.wants"
+ln -sfn /usr/lib/systemd/user/harness-daemon.service \
+ "$H/.config/systemd/user/default.target.wants/harness-daemon.service"
+chroot "$ROOT" chown -R "$ACCOUNT:$ACCOUNT" "/home/$ACCOUNT"
+mkdir -p "$ROOT/var/lib/systemd/linger"
+touch "$ROOT/var/lib/systemd/linger/$ACCOUNT"
+mkdir -p "$ROOT/etc/systemd/system/[email protected]"
+printf '[Service]\nExecStart=\nExecStart=-/sbin/agetty --autologin %s --noclear %%I $TERM\n' "$ACCOUNT" \
+ > "$ROOT/etc/systemd/system/[email protected]/autologin.conf"