Build HubV3 Image #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build HubV3 Image | |
| # Manually build a ThirdReality HubV3 / LinuxBox image (5.10.x, hubv3 branch) | |
| # inside a Debian bookworm container. Running in bookworm matches the known | |
| # working local build environment (same qemu-user-static, same toolchain), | |
| # which avoids the qemu-version issues seen on the ubuntu-latest host. | |
| # | |
| # Trigger: Actions tab -> "Build HubV3 Image" -> Run workflow. | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| board: | |
| type: choice | |
| description: "Target board" | |
| options: | |
| - trhubv3 | |
| - trhubv3b | |
| - linuxbox | |
| default: trhubv3 | |
| dist: | |
| type: choice | |
| description: "Distribution locale" | |
| options: | |
| - us | |
| - cn | |
| - kr | |
| default: us | |
| revision: | |
| description: "Revision override (optional, e.g. v1.14.01.40). Leave empty to use the script default." | |
| required: false | |
| default: '' | |
| jobs: | |
| build: | |
| name: Build ${{ github.event.inputs.board }} image | |
| runs-on: ubuntu-latest | |
| container: | |
| image: debian:bookworm | |
| # privileged is required for chroot/mount/loop used by Armbian | |
| # debootstrap-ng and image assembly. | |
| options: --privileged | |
| steps: | |
| - name: Install build prerequisites | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| run: | | |
| apt-get update | |
| apt-get install -y --no-install-recommends \ | |
| ca-certificates git sudo bash coreutils findutils \ | |
| uuid-runtime acl dialog psmisc uuid curl gawk wget gnupg lsb-release \ | |
| gcc build-essential python3 python3-dev python3-venv python3-pip pv xz-utils patchutils zstd \ | |
| binfmt-support qemu-user-static \ | |
| bc bison flex libssl-dev libncurses-dev \ | |
| device-tree-compiler u-boot-tools swig libpython3-dev \ | |
| gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu \ | |
| ccache imagemagick pixz file rsync kmod \ | |
| fdisk parted dosfstools e2fsprogs kpartx udev \ | |
| apt-cacher-ng iproute2 | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: hubv3 | |
| - name: Register qemu-aarch64 binfmt | |
| run: | | |
| # binfmt_misc is a kernel-global fs; in a privileged container we can | |
| # (re)mount it and enable the aarch64 handler so chroot postinst | |
| # scripts execute under qemu-aarch64-static. | |
| mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc 2>/dev/null || true | |
| update-binfmts --enable qemu-aarch64 2>/dev/null || true | |
| if [ -e /proc/sys/fs/binfmt_misc/qemu-aarch64 ]; then | |
| echo "qemu-aarch64 binfmt registered:" | |
| cat /proc/sys/fs/binfmt_misc/qemu-aarch64 || true | |
| else | |
| echo "WARNING: qemu-aarch64 binfmt not registered; chroot exec may fail" | |
| fi | |
| - name: Start apt-cacher-ng (package proxy for chroot apt) | |
| run: | | |
| # No systemd in the container: start via the sysv init script, then | |
| # fall back to launching the daemon directly. | |
| service apt-cacher-ng start 2>/dev/null || \ | |
| /usr/sbin/apt-cacher-ng -c /etc/apt-cacher-ng ForeGround=0 || true | |
| sleep 3 | |
| if ss -ltn 2>/dev/null | grep -q ':3142' || curl -fsS http://localhost:3142/acng-report.html >/dev/null 2>&1; then | |
| echo "apt-cacher-ng is up on 3142" | |
| else | |
| echo "ERROR: apt-cacher-ng not reachable on 3142" | |
| cat /var/log/apt-cacher-ng/*.log 2>/dev/null || true | |
| exit 1 | |
| fi | |
| - name: Show environment | |
| run: | | |
| echo "== os =="; head -2 /etc/os-release | |
| echo "== qemu =="; qemu-aarch64-static --version | head -1 || true | |
| echo "== disk =="; df -h / | |
| echo "== workspace =="; pwd; ls -la | |
| - name: Build firmware | |
| run: | | |
| chmod +x make_armbian_for_hubv3.sh | |
| if [ -n "${{ github.event.inputs.revision }}" ]; then | |
| ./make_armbian_for_hubv3.sh -b ${{ github.event.inputs.board }} -d ${{ github.event.inputs.dist }} -r ${{ github.event.inputs.revision }} | |
| else | |
| ./make_armbian_for_hubv3.sh -b ${{ github.event.inputs.board }} -d ${{ github.event.inputs.dist }} | |
| fi | |
| - name: List output files | |
| if: always() | |
| run: | | |
| ls -lah output/ || echo "output/ not found" | |
| ls -lah output/images/ || echo "output/images/ not found" | |
| find output -name "*.img" -type f 2>/dev/null || echo "No .img files found in output/" | |
| df -h / | |
| - name: Upload image as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: hubv3-${{ github.event.inputs.board }}-image${{ github.event.inputs.revision && format('-{0}', github.event.inputs.revision) || '' }} | |
| path: | | |
| output/images/*.img | |
| output/images/*.xz | |
| if-no-files-found: warn | |
| - name: Upload build logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: hubv3-build-logs | |
| path: | | |
| output/debug/** | |
| if-no-files-found: warn | |
| - name: Verify image was produced | |
| run: | | |
| if ! find output/images -maxdepth 1 -type f -name '*.img' | grep -q .; then | |
| echo "ERROR: build finished but no .img was produced (see hubv3-build-logs artifact)." | |
| exit 1 | |
| fi | |
| echo "Image(s) produced:" | |
| find output/images -maxdepth 1 -type f -name '*.img' |