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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Harness OS: Orange Pi image grows its partition in Docker, compresses on the host
bubu-dududca8313a14a5
diff --git a/os/platforms/orangepi-4pro/build-docker.sh b/os/platforms/orangepi-4pro/build-docker.shindex 2cab8d0e4..921c91fd8 100755--- a/os/platforms/orangepi-4pro/build-docker.sh+++ b/os/platforms/orangepi-4pro/build-docker.sh@@ -104,7 +104,12 @@ ln -s /cache/tui-target tui/targetHARNESS_OS_RUNTIME_DIR=/build/os/work/runtime-arm bash os/tools/build-runtime.shIMG=/build/harness-orangepi4pro-debian12-$COMMIT.imgbash $HERE/build-image.sh "$HARNESS_BASE" /build/os/work/runtime-arm "$IMG"-xz -T0 -6 -c "$IMG" > "/out/${IMG##*/}.xz"-cd /out && sha256sum "${IMG##*/}.xz" > "${IMG##*/}.xz.sha256"-ls -la /out+cp "$IMG" /out/'+[[ $PHASES != base ]] || exit 0++# Compress on the host: xz under arm64 emulation takes far longer.+IMAGE=$(ls -t "$OUT"/harness-orangepi4pro-debian12-*.img | head -1)+xz -T0 -6 -f "$IMAGE"+(cd -- "$OUT" && shasum -a 256 "$(basename -- "$IMAGE").xz" > "$(basename -- "$IMAGE").xz.sha256")+ls -la "$IMAGE.xz" "$IMAGE.xz.sha256"diff --git a/os/platforms/orangepi-4pro/image-lib.sh b/os/platforms/orangepi-4pro/image-lib.shindex 49288ca96..1dfb279c1 100644--- a/os/platforms/orangepi-4pro/image-lib.sh+++ b/os/platforms/orangepi-4pro/image-lib.sh@@ -3,7 +3,6 @@MNT=$(mktemp -d)LOOP=-MADE_NODE=release_image() {set +e@@ -19,35 +18,33 @@ release_image() {for m in dev/pts dev proc sys; do mountpoint -q "$MNT/$m" && umount "$MNT/$m"; donemountpoint -q "$MNT" && umount "$MNT"[[ -n $LOOP ]] && losetup -d "$LOOP"- [[ -n $MADE_NODE ]] && rm -f "$MADE_NODE"rmdir "$MNT" 2>/dev/nullLOOP=- MADE_NODE=RESOLV=}RESOLV=trap release_image EXIT# attach_image IMAGE [GROW]: GROW (e.g. +3G) enlarges the file and its root filesystem first.+# The partition table is edited in the file and partition 1 attached by its offset, so neither+# step needs the kernel to rescan a loop device: a container (build-docker.sh) cannot.attach_image() {- local image=$1 grow=${2:-} part- [[ -z $grow ]] || truncate -s "$grow" "$image"- LOOP=$(losetup -fP --show "$image")- [[ -z $grow ]] || parted -s "$LOOP" resizepart 1 100%- partprobe "$LOOP" || true- part=${LOOP}p1- if [[ ! -b $part ]]; then- # A container (build-docker.sh) has no udev to create partition nodes.- local major minor- IFS=: read -r major minor < "/sys/class/block/${LOOP#/dev/}p1/dev"- mknod "$part" b "$major" "$minor"- MADE_NODE=$part+ local image=$1 grow=${2:-} start size+ if [[ -n $grow ]]; then+ truncate -s "$grow" "$image"+ parted -s "$image" resizepart 1 100%fi+ read -r start size < <(sfdisk -J "$image" | python3 -c '+import json, sys+table = json.load(sys.stdin)["partitiontable"]+part = table["partitions"][0]+print(part["start"] * table.get("sectorsize", 512), part["size"] * table.get("sectorsize", 512))')+ LOOP=$(losetup -f --show --offset "$start" --sizelimit "$size" "$image")if [[ -n $grow ]]; then- e2fsck -fy "$part" >/dev/null || true- resize2fs "$part" >/dev/null+ e2fsck -fy "$LOOP" >/dev/null || true+ resize2fs "$LOOP" >/dev/nullfi- mount "$part" "$MNT"+ mount "$LOOP" "$MNT"for m in dev dev/pts proc sys; do mount --bind "/$m" "$MNT/$m"; done# Network for the chroot, and no service starts from package scripts; both undone on release.if [[ -e $MNT/etc/resolv.conf || -L $MNT/etc/resolv.conf ]]; then