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:
co-authored by
Claude Opus 4.8
parent
4f060db1b1
commit
5a9432b8bc
@@ -112,15 +112,25 @@ jobs:
|
|||||||
|
|
||||||
kernel-build:
|
kernel-build:
|
||||||
# Full hermetic build on the warden-sdk self-hosted runner (bfe-mpc-0640,
|
# 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'
|
if: github.event_name == 'workflow_dispatch'
|
||||||
runs-on: [self-hosted, warden-sdk]
|
runs-on: [self-hosted, warden-sdk]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- 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
|
- name: build zImage + rv1106-warden.dtb
|
||||||
env:
|
env:
|
||||||
WORK: ${{ github.workspace }}/kbuild-out
|
WORK: ${{ github.workspace }}/kbuild-out
|
||||||
JOBS: 4 # belt-and-braces bound in addition to the runner's cgroup cap
|
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
|
run: bash build/build-kernel.sh
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -77,10 +77,15 @@ done
|
|||||||
# 4. configure
|
# 4. configure
|
||||||
log "configuring (warden_defconfig)"
|
log "configuring (warden_defconfig)"
|
||||||
cp "$HERE/warden_defconfig" "$SRC/.config"
|
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
|
if [ -n "${SDK_TC:-}" ]; then export PATH="$SDK_TC:$PATH"; fi
|
||||||
command -v "${CROSS_COMPILE}gcc" >/dev/null \
|
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
|
make -C "$SRC" ARCH=arm CROSS_COMPILE="$CROSS_COMPILE" olddefconfig >/dev/null
|
||||||
|
|
||||||
# 5. build zImage + the board dtb
|
# 5. build zImage + the board dtb
|
||||||
|
|||||||
+12
-10
@@ -19,8 +19,9 @@
|
|||||||
A **third** repo-scoped runner instance on `bfe-mpc-0640` (alongside `flare` and
|
A **third** repo-scoped runner instance on `bfe-mpc-0640` (alongside `flare` and
|
||||||
`flare-edge`), registered with the label **`warden-sdk`** as
|
`flare-edge`), registered with the label **`warden-sdk`** as
|
||||||
`bfe-mpc-0640-warden-sdk`, in `~/actions-runner-warden-sdk`. The registration is
|
`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
|
done. **Steps 1–2 below need `user`'s sudo on 0640** (systemd service + cgroup —
|
||||||
from the dev box:
|
not automatable from the dev box); **steps 3–4 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 &&
|
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
|
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
|
`/etc/systemd/system/actions.runner.bfe-noah-warden-sdk.*.service.d/*.conf` with
|
||||||
`CPUQuota=400%` + `MemoryMax=6G`, then `sudo systemctl daemon-reload`. The build
|
`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.)
|
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
|
3. **Kernel cross toolchain** — done in the workflow: the `kernel-build` job sets
|
||||||
PATH — set `SDK_TC` to the dir holding `arm-rockchip830-linux-uclibcgnueabihf-*`
|
`CROSS_COMPILE=arm-linux-gnueabihf-` (Debian `gcc-arm-linux-gnueabihf`, already on
|
||||||
(the Luckfox SDK toolchain, as flare-edge's runner has), or install
|
the runner) and `build-kernel.sh` honors it. The kernel is freestanding, so the
|
||||||
`gcc-arm-linux-gnueabihf` and pass `CROSS_COMPILE=arm-linux-gnueabihf-` (the
|
generic arm cross compiler links it — no Luckfox SDK toolchain path needed. (To use
|
||||||
kernel is freestanding, so a generic arm cross compiler links it).
|
the SDK uclibc toolchain instead, set `SDK_TC` to its `bin/` and drop the override.)
|
||||||
4. **`python`** (not python3): the kernel build calls bare `python`; provide a
|
4. **`python`** (not python3) — done in the workflow: the `kernel-build` job symlinks
|
||||||
project-local venv or a `python`→`python3` shim on the runner's PATH.
|
`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
|
## Badges
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user