1+ name : IRIS Injection
2+ description : Inject IRIS app and video content tarball into rootfs image
3+
4+ inputs :
5+ machine :
6+ description : Target machine name
7+ required : true
8+ docker_image :
9+ description : Docker image name
10+ required : true
11+
12+ runs :
13+ using : " composite"
14+ steps :
15+ - name : Create top-level images directory
16+ shell : bash
17+ run : |
18+ set -euo pipefail
19+ mkdir -p "${{ github.workspace }}/images"
20+
21+ - name : Run IRIS injection in Docker
22+ shell : bash
23+ run : |
24+ set -euo pipefail
25+
26+ MACHINE="${{ inputs.machine }}"
27+ WORKSPACE_ROOT="$(dirname "${PWD}")"
28+ REPO_NAME="$(basename "${PWD}")"
29+
30+ echo "PWD: ${PWD}"
31+ echo "WORKSPACE_ROOT: ${WORKSPACE_ROOT}"
32+ echo "REPO_NAME: ${REPO_NAME}"
33+ echo "MACHINE: ${MACHINE}"
34+
35+ docker run --rm \
36+ -v "${WORKSPACE_ROOT}:/workspace" \
37+ -w "/workspace/${REPO_NAME}" \
38+ -e "MACHINE=${MACHINE}" \
39+ -e "WORKSPACE=/workspace/${REPO_NAME}" \
40+ --privileged \
41+ "${{ inputs.docker_image }}" \
42+ bash -lc '
43+ set -euxo pipefail
44+
45+ IMAGE_BASE_DIR="build/tmp/deploy/images/${MACHINE}"
46+
47+ echo "=== Looking for build output under: ${IMAGE_BASE_DIR} ==="
48+ if [ ! -d "${IMAGE_BASE_DIR}" ]; then
49+ echo "❌ Machine output directory not found: ${IMAGE_BASE_DIR}"
50+ echo "=== build/tmp/deploy/images tree ==="
51+ find build/tmp/deploy/images -maxdepth 3 -mindepth 1 -print | sort || true
52+ exit 1
53+ fi
54+
55+ echo "=== Contents of machine directory ==="
56+ ls -la "${IMAGE_BASE_DIR}" || true
57+
58+ IMAGE_DIR="$(find "${IMAGE_BASE_DIR}" -maxdepth 1 -type d -name "*.qcomflash" | sort | head -n 1 || true)"
59+
60+ if [ -z "${IMAGE_DIR}" ]; then
61+ echo "❌ No .qcomflash directory found under ${IMAGE_BASE_DIR}"
62+ echo "=== Full contents under machine directory ==="
63+ find "${IMAGE_BASE_DIR}" -maxdepth 2 -print | sort || true
64+ exit 1
65+ fi
66+
67+ echo "✅ Using image directory: ${IMAGE_DIR}"
68+ cd "${IMAGE_DIR}"
69+ ls -larth
70+
71+ ROOTFS_IMG="$(realpath rootfs.img)"
72+ echo "ROOTFS_IMG=${ROOTFS_IMG}"
73+ test -f "${ROOTFS_IMG}"
74+
75+ echo "📦 Checking IRIS app payload..."
76+ test -d "${WORKSPACE}/v4l-video-test-app/build"
77+ ls -la "${WORKSPACE}/v4l-video-test-app/build"
78+
79+ echo "🔎 Loop devices before:"
80+ ls -l /dev/loop* || true
81+ losetup -a || true
82+
83+ modprobe loop max_loop=64 || true
84+ for i in $(seq 0 63); do
85+ [ -b /dev/loop$i ] || mknod -m 660 /dev/loop$i b 7 "$i" || true
86+ done
87+
88+ echo "🔎 Loop devices after:"
89+ ls -l /dev/loop* || true
90+
91+ mkdir -p /tmp/rootfs
92+ LOOPDEV=""
93+
94+ cleanup() {
95+ set +e
96+ sync || true
97+ mountpoint -q /tmp/rootfs && umount /tmp/rootfs || true
98+ [ -n "${LOOPDEV}" ] && losetup -d "${LOOPDEV}" || true
99+ }
100+ trap cleanup EXIT
101+
102+ echo "🔗 Attaching loop device..."
103+ for attempt in 1 2 3; do
104+ LOOPDEV="$(losetup --find --show "${ROOTFS_IMG}" 2>/dev/null || true)"
105+ if [ -n "${LOOPDEV}" ]; then
106+ break
107+ fi
108+ echo "Attempt ${attempt} failed to allocate loop device, retrying..."
109+ sleep 2
110+ done
111+
112+ if [ -z "${LOOPDEV}" ]; then
113+ echo "❌ Failed to allocate loop device for ${ROOTFS_IMG}"
114+ exit 1
115+ fi
116+
117+ echo "Using loop device: ${LOOPDEV}"
118+
119+ echo "🔗 Mounting rootfs..."
120+ mount "${LOOPDEV}" /tmp/rootfs
121+
122+ echo "📁 Creating IRIS app directories..."
123+ mkdir -p /tmp/rootfs/data/vendor/iris_test_app/input
124+ mkdir -p /tmp/rootfs/data/vendor/iris_test_app/output
125+
126+ echo "📥 Copying IRIS app payload from workspace..."
127+ cp -a "${WORKSPACE}/v4l-video-test-app/build/." /tmp/rootfs/data/vendor/iris_test_app/
128+
129+ echo "📥 Copying video tarball into rootfs (no extraction)..."
130+ cp -a "${WORKSPACE}/downloads/video_clips_iris.tar.gz" /tmp/rootfs/data/vendor/iris_test_app/
131+
132+ echo "🔍 Verifying injected files..."
133+ ls -larth /tmp/rootfs/data/vendor/iris_test_app
134+ ls -larth /tmp/rootfs/data/vendor/iris_test_app/input
135+
136+ echo "📤 Syncing changes..."
137+ sync
138+
139+ echo "📤 Unmounting rootfs..."
140+ umount /tmp/rootfs
141+ trap - EXIT
142+
143+ echo "✅ IRIS injection completed for ${MACHINE}."
144+ '
0 commit comments