-
Notifications
You must be signed in to change notification settings - Fork 1
162 lines (148 loc) · 6.41 KB
/
Copy pathbuild-hubv3-image.yml
File metadata and controls
162 lines (148 loc) · 6.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
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: Start udev (create loop partition nodes in container)
run: |
# Armbian builds the image with `losetup` + `partprobe` (no -P). In a
# container the /dev/loopXpY partition nodes are not auto-created, so
# image assembly dies with "check_loop_device: /dev/loop0p2 does not
# exist". Running udevd makes those nodes appear after partprobe.
# NOTE: we deliberately do NOT install the systemd package: if
# systemd-detect-virt existed, the framework would auto-enable
# NO_APT_CACHER and disable our working apt-cacher-ng proxy.
/lib/systemd/systemd-udevd --daemon 2>/dev/null \
|| /usr/lib/systemd/systemd-udevd --daemon 2>/dev/null \
|| (command -v udevd >/dev/null && udevd --daemon) 2>/dev/null \
|| true
udevadm trigger 2>/dev/null || true
udevadm settle 2>/dev/null || true
echo "udev started (best-effort); loop nodes will be created on partprobe"
- 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'