ci: self-provision python + cross toolchain in kernel-build job

Make the self-hosted kernel-build runnable with zero manual toolchain/python setup
on the runner host (docs/ci-cd.md steps 3-4 move into the workflow):

- build/build-kernel.sh: honor a caller-provided CROSS_COMPILE (default stays the
  Luckfox uclibc prefix). The kernel is freestanding, so a generic arm cross
  compiler links it.
- kernel-build job: set CROSS_COMPILE=arm-linux-gnueabihf- (Debian
  gcc-arm-linux-gnueabihf, already on 0640) instead of depending on the ephemeral
  SDK checkout path; symlink python->python3 into $RUNNER_TEMP/bin on $GITHUB_PATH
  for the bare-`python` SDK quirk.
- docs/ci-cd.md: only steps 1-2 (systemd service + cgroup cap) still need 0640 sudo.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wB8KB3MMQztRDXCMCkPrf
This commit is contained in:
BFE Engineering
2026-08-25 16:27:21 -06:00
co-authored by Claude Opus 4.8
parent 4f060db1b1
commit 5a9432b8bc
3 changed files with 30 additions and 13 deletions
+11 -1
View File
@@ -112,15 +112,25 @@ jobs:
kernel-build:
# Full hermetic build on the warden-sdk self-hosted runner (bfe-mpc-0640,
# ADR-0004). Gated on manual dispatch until that runner is registered.
# ADR-0004). Manual-dispatch by design — a full kernel build is too heavy to run
# on every push; trigger it via `gh workflow run ci.yml` / the Actions UI.
if: github.event_name == 'workflow_dispatch'
runs-on: [self-hosted, warden-sdk]
steps:
- uses: actions/checkout@v4
- name: provision `python` (SDK quirk — build calls bare python)
run: |
mkdir -p "$RUNNER_TEMP/bin"
ln -sf "$(command -v python3)" "$RUNNER_TEMP/bin/python"
echo "$RUNNER_TEMP/bin" >> "$GITHUB_PATH"
- name: build zImage + rv1106-warden.dtb
env:
WORK: ${{ github.workspace }}/kbuild-out
JOBS: 4 # belt-and-braces bound in addition to the runner's cgroup cap
# The kernel is freestanding; use the stable generic arm cross toolchain
# (Debian gcc-arm-linux-gnueabihf on the runner) rather than depending on
# the ephemeral Luckfox SDK checkout path.
CROSS_COMPILE: arm-linux-gnueabihf-
run: bash build/build-kernel.sh
- uses: actions/upload-artifact@v4
with:
+7 -2
View File
@@ -77,10 +77,15 @@ done
# 4. configure
log "configuring (warden_defconfig)"
cp "$HERE/warden_defconfig" "$SRC/.config"
export ARCH=arm CROSS_COMPILE=arm-rockchip830-linux-uclibcgnueabihf-
# CROSS_COMPILE defaults to the Luckfox SDK uclibc prefix (set SDK_TC to its bin/),
# but the kernel is freestanding, so a caller may override with a generic arm cross
# toolchain instead — e.g. CROSS_COMPILE=arm-linux-gnueabihf- (in Debian's
# gcc-arm-linux-gnueabihf), which the CI runner already has on PATH.
export ARCH=arm
export CROSS_COMPILE="${CROSS_COMPILE:-arm-rockchip830-linux-uclibcgnueabihf-}"
if [ -n "${SDK_TC:-}" ]; then export PATH="$SDK_TC:$PATH"; fi
command -v "${CROSS_COMPILE}gcc" >/dev/null \
|| { echo "cross toolchain ${CROSS_COMPILE}gcc not on PATH (set SDK_TC)" >&2; exit 1; }
|| { echo "cross toolchain ${CROSS_COMPILE}gcc not on PATH (set SDK_TC, or CROSS_COMPILE to one that is)" >&2; exit 1; }
make -C "$SRC" ARCH=arm CROSS_COMPILE="$CROSS_COMPILE" olddefconfig >/dev/null
# 5. build zImage + the board dtb
+12 -10
View File
@@ -19,8 +19,9 @@
A **third** repo-scoped runner instance on `bfe-mpc-0640` (alongside `flare` and
`flare-edge`), registered with the label **`warden-sdk`** as
`bfe-mpc-0640-warden-sdk`, in `~/actions-runner-warden-sdk`. The registration is
done; the following steps need **`user`'s sudo on 0640** and are not automatable
from the dev box:
done. **Steps 12 below need `user`'s sudo on 0640** (systemd service + cgroup —
not automatable from the dev box); **steps 34 are handled inside the workflow**, so
the runner host needs no manual toolchain/python setup.
1. **Install as a service** (persistence): `cd ~/actions-runner-warden-sdk &&
sudo ./svc.sh install user && sudo ./svc.sh start`. Until then the runner is
@@ -29,15 +30,16 @@ from the dev box:
`/etc/systemd/system/actions.runner.bfe-noah-warden-sdk.*.service.d/*.conf` with
`CPUQuota=400%` + `MemoryMax=6G`, then `sudo systemctl daemon-reload`. The build
inherits that cgroup. (The workflow also passes `JOBS=4` as a belt-and-braces bound.)
3. **Kernel cross toolchain**: `build-kernel.sh` needs the arm cross compiler on
PATH — set `SDK_TC` to the dir holding `arm-rockchip830-linux-uclibcgnueabihf-*`
(the Luckfox SDK toolchain, as flare-edge's runner has), or install
`gcc-arm-linux-gnueabihf` and pass `CROSS_COMPILE=arm-linux-gnueabihf-` (the
kernel is freestanding, so a generic arm cross compiler links it).
4. **`python`** (not python3): the kernel build calls bare `python`; provide a
project-local venv or a `python`→`python3` shim on the runner's PATH.
3. **Kernel cross toolchain** — done in the workflow: the `kernel-build` job sets
`CROSS_COMPILE=arm-linux-gnueabihf-` (Debian `gcc-arm-linux-gnueabihf`, already on
the runner) and `build-kernel.sh` honors it. The kernel is freestanding, so the
generic arm cross compiler links it — no Luckfox SDK toolchain path needed. (To use
the SDK uclibc toolchain instead, set `SDK_TC` to its `bin/` and drop the override.)
4. **`python`** (not python3) — done in the workflow: the `kernel-build` job symlinks
`python`→`python3` into `$RUNNER_TEMP/bin` and prepends it to `$GITHUB_PATH`. No
host-side venv/shim needed.
Host build deps (sudo): `dtc bc flex bison libssl-dev` (already present on 0640).
Host build deps: `dtc bc flex bison libssl-dev` already present on 0640.
## Badges