The SDK patch series does not reproduce the SDK CI builds with #4

Closed
opened 2026-09-28 10:56:48 -06:00 by noah · 1 comment
Owner

luckfox-sdk-patches/ is meant to be the complete record of our delta to the vendor SDK (vendor base 824b817f8). It is not: a clean vendor checkout cannot build WardenOS firmware.

Found rebuilding the CI base image's SDK from a clean clone for blueflare/flare-edge#66. On the clean tree, flare-edge's build-firmware.sh applies all 28 patches, verify-sdk-patches.sh passes, and the build then stops:

build-identity: selected Buildroot tree is missing: buildroot-2025.02.8

verify-sdk-patches.sh passes because it only compares files a patch touches. Diffing the live SDK (the one CI builds with) against the vendor base finds tracked changes that no patch and no build script produces:

Path Change
sysdrv/Makefile BUILDROOT_VER ?= buildroot-2025.02.8, relaxed cp lines
sysdrv/source/buildroot/buildroot-2025.02.8/ the whole tree; build/fetch-buildroot-tarball.sh can fetch it but is not wired in
project/cfg/BoardConfig_IPC/luckfox-buildroot-oem-pre.sh flare_minimize step (strips camera/ISP files from /oem)
.../overlay-luckfox-buildroot-init/etc/init.d/S50sshd deleted
sysdrv/tools/board/e2fsprogs/Makefile BUILD_CFLAGS for modern gcc
sysdrv/tools/board/buildroot/{busybox,hcitool}_patch/* five vendor patches removed (buildroot 2025 incompatibles)
sysdrv/source/kernel/net/wireless/core.c debug printk and null-wiphy skip in the vendor 5.10 tree (probably dead: we ship 6.18)
project/app/wifi_app/... hostapd, hostapd_cli, librkwifibt.so modified binaries, possibly build outputs

So the CI SDK depends on hand state that exists only in copies of one tree. A rebuilt runner, or anyone following the README, gets a different or failing build.

Fix

  • Wire the pinned Buildroot 2025.02.8 fetch and unpack into the build.
  • Capture every remaining delta as a patch in the right group, or drop it after confirming it has no effect on the image.
  • Make verify-sdk-patches.sh also fail on tracked changes outside the series, so this cannot recur silently.
  • Prove it: a clean clone plus the series builds the firmware, in a fresh VM.
`luckfox-sdk-patches/` is meant to be the complete record of our delta to the vendor SDK (vendor base `824b817f8`). It is not: a clean vendor checkout cannot build WardenOS firmware. Found rebuilding the CI base image's SDK from a clean clone for blueflare/flare-edge#66. On the clean tree, flare-edge's `build-firmware.sh` applies all 28 patches, `verify-sdk-patches.sh` passes, and the build then stops: ``` build-identity: selected Buildroot tree is missing: buildroot-2025.02.8 ``` `verify-sdk-patches.sh` passes because it only compares files a patch touches. Diffing the live SDK (the one CI builds with) against the vendor base finds tracked changes that no patch and no build script produces: | Path | Change | |---|---| | `sysdrv/Makefile` | `BUILDROOT_VER ?= buildroot-2025.02.8`, relaxed `cp` lines | | `sysdrv/source/buildroot/buildroot-2025.02.8/` | the whole tree; `build/fetch-buildroot-tarball.sh` can fetch it but is not wired in | | `project/cfg/BoardConfig_IPC/luckfox-buildroot-oem-pre.sh` | `flare_minimize` step (strips camera/ISP files from /oem) | | `.../overlay-luckfox-buildroot-init/etc/init.d/S50sshd` | deleted | | `sysdrv/tools/board/e2fsprogs/Makefile` | `BUILD_CFLAGS` for modern gcc | | `sysdrv/tools/board/buildroot/{busybox,hcitool}_patch/*` | five vendor patches removed (buildroot 2025 incompatibles) | | `sysdrv/source/kernel/net/wireless/core.c` | debug printk and null-wiphy skip in the vendor 5.10 tree (probably dead: we ship 6.18) | | `project/app/wifi_app/...` hostapd, hostapd_cli, librkwifibt.so | modified binaries, possibly build outputs | So the CI SDK depends on hand state that exists only in copies of one tree. A rebuilt runner, or anyone following the README, gets a different or failing build. ## Fix - Wire the pinned Buildroot 2025.02.8 fetch and unpack into the build. - Capture every remaining delta as a patch in the right group, or drop it after confirming it has no effect on the image. - Make `verify-sdk-patches.sh` also fail on tracked changes outside the series, so this cannot recur silently. - Prove it: a clean clone plus the series builds the firmware, in a fresh VM.
Author
Owner

Fix on branches sdk4-reproducible (this repo, 67da114) and flare-edge fix/sdk4-reproducible (14e2413, pins vendor/warden-sdk to 67da114). Nothing merged.

Captured

Patch or file Carries
board/patches/0009-sysdrv-buildroot-2025.patch sysdrv/Makefile: BUILDROOT_VER ?= buildroot-2025.02.8, relaxed cp lines in the unpack fallback
board/patches/0010-drop-2023-buildroot-package-patches.patch deletes the 2 busybox and 3 hcitool 2023-era patches (hcitool 0001/0002 do not apply to bluez 5.79)
board/patches/0011-oem-flare-minimize.patch luckfox-buildroot-oem-pre.sh: flare_minimize
board/patches/0012-drop-s50sshd.patch deletes overlay-luckfox-buildroot-init/etc/init.d/S50sshd
board/patches/0013-e2fsprogs-build-cflags.patch e2fsprogs/Makefile BUILD_CFLAGS (needed with gcc 14; the CI image has gcc 13.3)
kernel/configs/flare-wireguard.config, kernel/configs/rv1106-usb-host-ethernet.config named by the 86Panel board .mk for the vendor 5.10 kernel (recovery image); existed only as untracked files

All hunks are git diff 824b817f8 output from the workstation SDK, byte for byte.

Buildroot wiring

build/unpack-buildroot.sh fetches the tarball through fetch-buildroot-tarball.sh (sha256 pin) and unpacks it to sysdrv/source/buildroot/buildroot-2025.02.8. It leaves an existing tree alone, refuses an SDK whose build.sh/Makefile do not select 2025.02.8, and never leaves a partial tree. flare-edge's build-firmware.sh calls it right after applying the series. That is the place because build-firmware.sh is what turns a vendor checkout into the tree we build (the SDK repo has no apply step), and the unpack must follow the board patches that select 2025.02.8. The workstation SDK leaves its existing tree untouched ("tree already present").

The live Buildroot tree equals pristine buildroot-2025.02.8.tar.xz plus luckfox-sdk-patches/buildroot/ plus flare_warden_defconfig. The only extra file is ..config.tmp, a build leftover. The hand-placed tools/board/buildroot/buildroot-2025.02.8.tar.gz has the same content as the pinned xz.

Dropped, with evidence

  • sysdrv/source/kernel/net/wireless/core.c (cfg80211 debug printk, vendor 5.10). CONFIG_CFG80211=m in both objs_kernel and objs_kernel_recovery, and the recovery build has no net/wireless/core.o. The hunk reaches only the 5.10 cfg80211.ko in the OEM staging tree (strings shows flare-cfg80211 there). tools/mk-oemimg.sh drops every staged .ko. The shipped oem.img, boot.img, rootfs.img, recovery.img and update.img contain 0 flare-cfg80211 strings and oem.img has 0 vermagic=5.10. It is tolerated only as a dead-live-only entry in flare-edge tools/sdk-delta-allowlist.txt; remove the entry once the edit is reverted on the workstation SDK.
  • hostapd, hostapd_cli, librkwifibt.so are build outputs. project/app/wifi_app/Makefile builds hostapd in place and wifi/Makefile links librkwifibt.so in place. The clean VM proved it: pristine tree plus build leaves exactly these three modified. They are sdk-build-output allowlist entries.
  • logo.bmp, logo_kernel.bmp are written by build-firmware.sh (firmware-script entries).
  • Untracked leftovers are not used by the build: *.orig, *.flare-orig, *.preotg, *.prewg, tools/board/buildroot/flare_warden_defconfig (stale; the build stages flare-edge's copy), disabled-for-lts/, the .tar.gz, and the sdk -> ../sdk symlink.

verify-sdk-patches.sh

Two new checks. It now fails on any tracked change against the vendor base (edit or deletion) that no patch, fragment or allowlist entry accounts for (UNCAPTURED). It also fails on a kernel or U-Boot fragment the board .mk names that neither the vendor base nor the series provides (MISSING). Fragment copies are compared byte for byte, and allowlist entries need a kind and a reason. Run against the workstation SDK with the old series it reports the 9 uncaptured paths of this issue plus 4 MISSING lines for the two kernel fragments. With the new series it passes.

Found on the way (flare-edge)

  • flare-edge#203: sync/verify could not replay a patch that deletes a file.
  • flare-edge#204: the hunk-count guard rejected a valid deletion of a format-patch file.
  • flare-edge#206: build-firmware.sh never ran ./build.sh media or ./build.sh app, and it cross-built warden-ui before the vendor rootfs existed. The persistent SDK had carried media_out and app_out since a one-time full ./build.sh on 2026-08-03.
  • flare-edge#208: the SDK board (.BoardConfig.mk) was selected by hand; on a clean SDK the build stopped at the interactive lunch menu.

Clean build (0056, VM ci-sdk-clean)

Pristine clone at 824b817f8 (reset --hard plus clean -fdx, 0 status entries), flare-edge and SDK from git bundles, CI firmware job steps in blueflare/flare-edge-ci:2026-09-13b with WARDEN_COMPLETE_FIRMWARE=1 and no caches. Result: build-firmware.sh exited 0, wall 2488 s.

14e73b12c425edc88ed15a48884bc7bdd0a0b84e9896ca5b2f9814ee91809f59  boot.img
1a4091c559963954fe3b52bdb0580db45e1d22b5a6a982ef7cfe7d7c01bd9043  oem.img
2adcc75b1eec3f5c07e23babffe7dc1e1c4e5d42c6b390b7d06b7e97116d046e  rootfs.img
2b69a9a59b74edb1f3f1073fadeb2f1221e1f759085b229aed75c9515ac9f8d5  warden-build.env
7a8a7bf2b51b3d94446bcc3357788c6a1b6b7ab49a997698867faf46e2c741b9  recovery.img
fa6d3a5cdbb3ca3045fca87b2fc3cfc09f9519fc649b339323a84bee9ca1b6bf  update.img

warden-build.env: kernel 6.18.46, Buildroot 2025.02.8. Post-build verify-sdk-patches.sh inside the VM: all groups OK, OK tracked, OK fragments, exit 0.

Compared file lists with the workstation SDK's last image (flare-edge 01a4b90, 2026-09-23):

  • oem.img: same 87 names.
  • rootfs.img: 1592 vs 1591 names. The differences are two new flare-edge overlay files, plus three files only in the workstation image: 50-timesyncd.conf and two readline *.so.8.2.old, stale incremental Buildroot output.
  • Size differences are limited to flare-edge's own binaries, overlay files, and 6.18 modules.

The built SDK stays in place in ci-sdk-clean.

Fix on branches `sdk4-reproducible` (this repo, `67da114`) and flare-edge `fix/sdk4-reproducible` (`14e2413`, pins `vendor/warden-sdk` to `67da114`). Nothing merged. ## Captured | Patch or file | Carries | |---|---| | `board/patches/0009-sysdrv-buildroot-2025.patch` | `sysdrv/Makefile`: `BUILDROOT_VER ?= buildroot-2025.02.8`, relaxed `cp` lines in the unpack fallback | | `board/patches/0010-drop-2023-buildroot-package-patches.patch` | deletes the 2 busybox and 3 hcitool 2023-era patches (hcitool 0001/0002 do not apply to bluez 5.79) | | `board/patches/0011-oem-flare-minimize.patch` | `luckfox-buildroot-oem-pre.sh`: `flare_minimize` | | `board/patches/0012-drop-s50sshd.patch` | deletes `overlay-luckfox-buildroot-init/etc/init.d/S50sshd` | | `board/patches/0013-e2fsprogs-build-cflags.patch` | `e2fsprogs/Makefile` `BUILD_CFLAGS` (needed with gcc 14; the CI image has gcc 13.3) | | `kernel/configs/flare-wireguard.config`, `kernel/configs/rv1106-usb-host-ethernet.config` | named by the 86Panel board `.mk` for the vendor 5.10 kernel (recovery image); existed only as untracked files | All hunks are `git diff 824b817f8` output from the workstation SDK, byte for byte. ## Buildroot wiring `build/unpack-buildroot.sh` fetches the tarball through `fetch-buildroot-tarball.sh` (sha256 pin) and unpacks it to `sysdrv/source/buildroot/buildroot-2025.02.8`. It leaves an existing tree alone, refuses an SDK whose `build.sh`/`Makefile` do not select 2025.02.8, and never leaves a partial tree. flare-edge's `build-firmware.sh` calls it right after applying the series. That is the place because `build-firmware.sh` is what turns a vendor checkout into the tree we build (the SDK repo has no apply step), and the unpack must follow the board patches that select 2025.02.8. The workstation SDK leaves its existing tree untouched ("tree already present"). The live Buildroot tree equals pristine `buildroot-2025.02.8.tar.xz` plus `luckfox-sdk-patches/buildroot/` plus `flare_warden_defconfig`. The only extra file is `..config.tmp`, a build leftover. The hand-placed `tools/board/buildroot/buildroot-2025.02.8.tar.gz` has the same content as the pinned xz. ## Dropped, with evidence - `sysdrv/source/kernel/net/wireless/core.c` (cfg80211 debug printk, vendor 5.10). `CONFIG_CFG80211=m` in both `objs_kernel` and `objs_kernel_recovery`, and the recovery build has no `net/wireless/core.o`. The hunk reaches only the 5.10 `cfg80211.ko` in the OEM staging tree (`strings` shows `flare-cfg80211` there). `tools/mk-oemimg.sh` drops every staged `.ko`. The shipped `oem.img`, `boot.img`, `rootfs.img`, `recovery.img` and `update.img` contain 0 `flare-cfg80211` strings and `oem.img` has 0 `vermagic=5.10`. It is tolerated only as a `dead-live-only` entry in flare-edge `tools/sdk-delta-allowlist.txt`; remove the entry once the edit is reverted on the workstation SDK. - `hostapd`, `hostapd_cli`, `librkwifibt.so` are build outputs. `project/app/wifi_app/Makefile` builds hostapd in place and `wifi/Makefile` links `librkwifibt.so` in place. The clean VM proved it: pristine tree plus build leaves exactly these three modified. They are `sdk-build-output` allowlist entries. - `logo.bmp`, `logo_kernel.bmp` are written by `build-firmware.sh` (`firmware-script` entries). - Untracked leftovers are not used by the build: `*.orig`, `*.flare-orig`, `*.preotg`, `*.prewg`, `tools/board/buildroot/flare_warden_defconfig` (stale; the build stages flare-edge's copy), `disabled-for-lts/`, the `.tar.gz`, and the `sdk -> ../sdk` symlink. ## verify-sdk-patches.sh Two new checks. It now fails on any tracked change against the vendor base (edit or deletion) that no patch, fragment or allowlist entry accounts for (`UNCAPTURED`). It also fails on a kernel or U-Boot fragment the board `.mk` names that neither the vendor base nor the series provides (`MISSING`). Fragment copies are compared byte for byte, and allowlist entries need a kind and a reason. Run against the workstation SDK with the old series it reports the 9 uncaptured paths of this issue plus 4 `MISSING` lines for the two kernel fragments. With the new series it passes. ## Found on the way (flare-edge) - flare-edge#203: sync/verify could not replay a patch that deletes a file. - flare-edge#204: the hunk-count guard rejected a valid deletion of a format-patch file. - flare-edge#206: `build-firmware.sh` never ran `./build.sh media` or `./build.sh app`, and it cross-built warden-ui before the vendor rootfs existed. The persistent SDK had carried `media_out` and `app_out` since a one-time full `./build.sh` on 2026-08-03. - flare-edge#208: the SDK board (`.BoardConfig.mk`) was selected by hand; on a clean SDK the build stopped at the interactive `lunch` menu. ## Clean build (0056, VM `ci-sdk-clean`) Pristine clone at `824b817f8` (`reset --hard` plus `clean -fdx`, 0 status entries), flare-edge and SDK from git bundles, CI firmware job steps in `blueflare/flare-edge-ci:2026-09-13b` with `WARDEN_COMPLETE_FIRMWARE=1` and no caches. Result: `build-firmware.sh` exited 0, wall 2488 s. ``` 14e73b12c425edc88ed15a48884bc7bdd0a0b84e9896ca5b2f9814ee91809f59 boot.img 1a4091c559963954fe3b52bdb0580db45e1d22b5a6a982ef7cfe7d7c01bd9043 oem.img 2adcc75b1eec3f5c07e23babffe7dc1e1c4e5d42c6b390b7d06b7e97116d046e rootfs.img 2b69a9a59b74edb1f3f1073fadeb2f1221e1f759085b229aed75c9515ac9f8d5 warden-build.env 7a8a7bf2b51b3d94446bcc3357788c6a1b6b7ab49a997698867faf46e2c741b9 recovery.img fa6d3a5cdbb3ca3045fca87b2fc3cfc09f9519fc649b339323a84bee9ca1b6bf update.img ``` `warden-build.env`: kernel 6.18.46, Buildroot 2025.02.8. Post-build `verify-sdk-patches.sh` inside the VM: all groups OK, `OK tracked`, `OK fragments`, exit 0. Compared file lists with the workstation SDK's last image (flare-edge `01a4b90`, 2026-09-23): - `oem.img`: same 87 names. - `rootfs.img`: 1592 vs 1591 names. The differences are two new flare-edge overlay files, plus three files only in the workstation image: `50-timesyncd.conf` and two readline `*.so.8.2.old`, stale incremental Buildroot output. - Size differences are limited to flare-edge's own binaries, overlay files, and 6.18 modules. The built SDK stays in place in `ci-sdk-clean`.
noah closed this issue 2026-09-28 14:04:32 -06:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blueflare/bfe-core1106-sdk#4