Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67da1141a0 | ||
|
|
5f36beb44a | ||
|
|
eb0691d84f |
@@ -111,7 +111,8 @@ jobs:
|
||||
shellcheck -x qemu/*.sh qemu/tests/*.sh build/*.sh \
|
||||
qemu/rootfs/etc/warden-lib.sh qemu/rootfs/etc/rc \
|
||||
qemu/rootfs/sbin/init qemu/rootfs/init tests/mk-bootimg/*.sh \
|
||||
tests/fetch-vendor/*.sh tests/fetch-buildroot-tarball/*.sh
|
||||
tests/fetch-vendor/*.sh tests/fetch-buildroot-tarball/*.sh \
|
||||
tests/unpack-buildroot/*.sh
|
||||
- name: cache apt archives (python3-pil)
|
||||
# Same cost class as the busybox binary cached below: a system package
|
||||
# plus its libjpeg/libpng transitive deps, downloaded fresh on every
|
||||
@@ -166,6 +167,11 @@ jobs:
|
||||
# Retry-on-mismatch, cleanup, and the already-verified
|
||||
# short-circuit, against a fake curl on PATH: no network.
|
||||
run: bash tests/fetch-buildroot-tarball/run-fetch-buildroot-tarball-tests.sh
|
||||
- name: unpack-buildroot regression tests
|
||||
# Fresh unpack, leave-existing-tree-alone, and every refusal path
|
||||
# (unpatched selectors, bad tarball, half-present tree, failed
|
||||
# fetch), against a stub fetch script: no network (issue #4).
|
||||
run: bash tests/unpack-buildroot/run-unpack-buildroot-tests.sh
|
||||
- name: mk-bootimg boot.img validation regression tests
|
||||
# Guards issue #22 (a missing/erroring fdtget silently skipping the
|
||||
# data-position check) plus the FIT metadata and per-image
|
||||
|
||||
@@ -12,13 +12,9 @@
|
||||
# Same shape as fetch-kernel-tarball.sh, deliberately: a version bump edits this
|
||||
# file and the pin beside it, nothing else. FAILS CLOSED on a missing pin.
|
||||
#
|
||||
# Not wired into build-firmware.sh or CI yet -- tools/build-firmware.sh stages
|
||||
# sdk-patches/buildroot/ onto whatever buildroot tree the vendor SDK already
|
||||
# has, it does not yet extract this pinned tarball over it. Exercised today by
|
||||
# tests/fetch-buildroot-tarball/run-fetch-buildroot-tarball-tests.sh and by
|
||||
# running the script by hand; wiring it into the real build path is a separate
|
||||
# change (it has to reconcile the pristine tree with the existing SDK buildroot
|
||||
# checkout first).
|
||||
# Called by build/unpack-buildroot.sh, which flare-edge's
|
||||
# tools/build-firmware.sh runs after applying luckfox-sdk-patches/ (issue #4).
|
||||
# Tested by tests/fetch-buildroot-tarball/run-fetch-buildroot-tarball-tests.sh.
|
||||
#
|
||||
# Usage: fetch-buildroot-tarball.sh <destination-path>
|
||||
set -euo pipefail
|
||||
|
||||
Executable
+81
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
# Unpack the pinned Buildroot tree where the vendor SDK builds it.
|
||||
#
|
||||
# The vendor SDK ships buildroot-2023.02.6. WardenOS builds against
|
||||
# buildroot-2025.02.8, which is not in the vendor checkout, so a clean checkout
|
||||
# plus luckfox-sdk-patches/ had nothing to build (blueflare/bfe-core1106-sdk#4).
|
||||
# This script closes that gap: it fetches the tarball with
|
||||
# fetch-buildroot-tarball.sh (sha256-pinned, fails closed) and unpacks it to
|
||||
# sysdrv/source/buildroot/buildroot-<ver>, the path the patched project/build.sh
|
||||
# and sysdrv/Makefile select.
|
||||
#
|
||||
# Idempotent. An SDK that already has the tree is left alone, so the
|
||||
# persistent CI SDK and the workstation SDK are untouched. A partial unpack
|
||||
# never lands at the final path: the tarball is unpacked into a scratch
|
||||
# directory beside it and moved into place only when complete.
|
||||
#
|
||||
# Our own Buildroot delta (defconfigs, package patches, the busybox applet
|
||||
# patch) is NOT applied here. flare-edge's tools/build-firmware.sh stages it
|
||||
# after this script runs, the same way it applies the rest of the series.
|
||||
#
|
||||
# Usage: unpack-buildroot.sh <vendor-sdk-dir>
|
||||
#
|
||||
# The tarball is cached at sysdrv/source/buildroot/buildroot-<ver>.tar.xz
|
||||
# (inside a directory the vendor .gitignore already ignores); set
|
||||
# WARDEN_BUILDROOT_TARBALL to use another path.
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # build/
|
||||
FETCH="$HERE/fetch-buildroot-tarball.sh"
|
||||
SDK="${1:?usage: unpack-buildroot.sh <vendor-sdk-dir>}"
|
||||
|
||||
die() { echo "unpack-buildroot: FATAL: $*" >&2; exit 1; }
|
||||
|
||||
[ -f "$FETCH" ] || die "missing $FETCH"
|
||||
BRVER="$(sed -n 's/^BRVER=//p' "$FETCH" | head -1)"
|
||||
case "$BRVER" in
|
||||
''|*[!0-9.]*) die "cannot read BRVER from $FETCH" ;;
|
||||
esac
|
||||
|
||||
# The SDK must already select this version. Both selectors come from
|
||||
# luckfox-sdk-patches/board/ (0006 for project/build.sh, 0009 for
|
||||
# sysdrv/Makefile); if either still names another tree the series has not
|
||||
# been applied, and unpacking would only hide that.
|
||||
BUILD_SH="$SDK/project/build.sh"
|
||||
MAKEFILE="$SDK/sysdrv/Makefile"
|
||||
[ -f "$BUILD_SH" ] || die "no vendor SDK at $SDK (missing project/build.sh)"
|
||||
[ -f "$MAKEFILE" ] || die "no vendor SDK at $SDK (missing sysdrv/Makefile)"
|
||||
# shellcheck disable=SC2016 # the literal ${SDK_SYSDRV_DIR} text in build.sh
|
||||
sel_build="$(sed -n 's|^BUILDROOT_PATH=${SDK_SYSDRV_DIR}/source/buildroot/||p' "$BUILD_SH" | head -1)"
|
||||
sel_make="$(sed -n 's/^BUILDROOT_VER[[:space:]]*?=[[:space:]]*//p' "$MAKEFILE" | head -1)"
|
||||
[ "$sel_build" = "buildroot-$BRVER" ] ||
|
||||
die "project/build.sh selects '${sel_build:-nothing}', not buildroot-$BRVER (apply luckfox-sdk-patches/board first)"
|
||||
[ "$sel_make" = "buildroot-$BRVER" ] ||
|
||||
die "sysdrv/Makefile selects '${sel_make:-nothing}', not buildroot-$BRVER (apply luckfox-sdk-patches/board first)"
|
||||
|
||||
PARENT="$SDK/sysdrv/source/buildroot"
|
||||
TREE="$PARENT/buildroot-$BRVER"
|
||||
TB="${WARDEN_BUILDROOT_TARBALL:-$PARENT/buildroot-$BRVER.tar.xz}"
|
||||
|
||||
if [ -f "$TREE/Makefile" ] && [ -d "$TREE/configs" ] && [ -d "$TREE/package" ]; then
|
||||
echo "buildroot-$BRVER: tree already present at ${TREE#"$SDK"/}"
|
||||
exit 0
|
||||
fi
|
||||
# Something is at the path but it is not a Buildroot tree. Deleting it here
|
||||
# could destroy build output in a shared SDK, so say so and stop.
|
||||
[ ! -e "$TREE" ] || die "$TREE exists but is not a complete Buildroot tree; remove it and rerun"
|
||||
|
||||
mkdir -p "$PARENT"
|
||||
bash "$FETCH" "$TB"
|
||||
|
||||
SCRATCH="$(mktemp -d "$PARENT/.unpack-buildroot.XXXXXX")"
|
||||
[ -d "$SCRATCH" ] || die "mktemp failed under $PARENT"
|
||||
cleanup() { rm -rf "$SCRATCH"; }
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "== unpacking buildroot-$BRVER into ${TREE#"$SDK"/}"
|
||||
tar -xJf "$TB" -C "$SCRATCH"
|
||||
[ -f "$SCRATCH/buildroot-$BRVER/Makefile" ] ||
|
||||
die "tarball did not contain buildroot-$BRVER/Makefile"
|
||||
mv "$SCRATCH/buildroot-$BRVER" "$TREE"
|
||||
echo "buildroot-$BRVER: unpacked"
|
||||
@@ -17,7 +17,8 @@
|
||||
# release tarball has no commit to name:
|
||||
#
|
||||
# linux-6.18.46 build/fetch-kernel-tarball.sh
|
||||
# buildroot-2025.02.8 build/fetch-buildroot-tarball.sh
|
||||
# buildroot-2025.02.8 build/fetch-buildroot-tarball.sh (unpacked into the
|
||||
# vendor SDK by build/unpack-buildroot.sh)
|
||||
#
|
||||
# The buildroot one matters more than it looks. The firmware builds against
|
||||
# sysdrv/source/buildroot/buildroot-2025.02.8 inside the vendor SDK, and the
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ execute code on private infrastructure (ADR-0007).
|
||||
| `mcdc` | ubuntu-latest | 100% MC/DC enforced on every `drivers/*/test` (gcc-14 `-fcondition-coverage`). |
|
||||
| `bench` | ubuntu-latest | Smoke-runs the sim + rs485-bridge micro-benchmarks; emits ns/op trend JSON. |
|
||||
| `patches-apply` | ubuntu-latest | Fetches pristine linux-6.18.46 (cached, sha256-verified) and applies `patches/*` in order. |
|
||||
| `qemu-tools` | ubuntu-latest | shellcheck on `qemu/**.sh`, `tests/mk-bootimg/*.sh`, `tests/fetch-vendor/*.sh`, `tests/fetch-buildroot-tarball/*.sh`; runs the offline regression tests for the mk-bootimg probe, boot.img validation, run.sh argv ordering, mkimage's SEED_DIR hook, staged rootfs permissions, fetch-vendor, fetch-buildroot-tarball, and its own CI wiring; builds the initramfs (pinned busybox) and the A/B disk image. |
|
||||
| `qemu-tools` | ubuntu-latest | shellcheck on `qemu/**.sh`, `tests/mk-bootimg/*.sh`, `tests/fetch-vendor/*.sh`, `tests/fetch-buildroot-tarball/*.sh`, `tests/unpack-buildroot/*.sh`; runs the offline regression tests for the mk-bootimg probe, boot.img validation, run.sh argv ordering, mkimage's SEED_DIR hook, staged rootfs permissions, fetch-vendor, fetch-buildroot-tarball, unpack-buildroot, and its own CI wiring; builds the initramfs (pinned busybox) and the A/B disk image. |
|
||||
| `quality` | ubuntu-latest | Codacy-style grade computed in-pipeline: clippy, cppcheck, shellcheck, ruff, lizard, jscpd, cargo-audit feed `tools/quality/score.py` (SQALE debt ratio + a separate worst-of security axis; SonarQube's published thresholds). Uploads `quality.json`; fails if the security grade is worse than C. |
|
||||
| `kernel-build` | ubuntu-latest, **dispatch-only** | apt-installs the cross toolchain + qemu, `build/build-kernel.sh` -> `zImage` + `rv1106-warden.dtb`, QEMU `-M virt` boot smoke (fail-closed), artifact upload (best-effort). Trigger: `gh workflow run ci.yml`. |
|
||||
| `prune-artifacts` | ubuntu-latest, dispatch-only | Deletes `kernel-rv1106` artifacts beyond the newest 3. |
|
||||
|
||||
@@ -57,7 +57,9 @@ luckfox-sdk-patches/uboot/include/ new source files
|
||||
luckfox-sdk-patches/kernel/patches/ diffs against sysdrv/source/kernel/
|
||||
luckfox-sdk-patches/kernel/configs/ new kernel config fragments
|
||||
luckfox-sdk-patches/wifi/patches/ diffs against sysdrv/drv_ko/wifi/ (out-of-tree modules)
|
||||
luckfox-sdk-patches/board/patches/ diffs against project/ (board .mk + the build driver)
|
||||
luckfox-sdk-patches/board/patches/ diffs against project/ and sysdrv/ build files (board .mk,
|
||||
build drivers, Makefiles, init overlays); may delete files
|
||||
luckfox-sdk-patches/buildroot/ our delta on the Buildroot tree (see "Buildroot" below)
|
||||
```
|
||||
|
||||
Paths inside each patch are relative to the vendor SDK root, so apply with
|
||||
@@ -87,6 +89,29 @@ skipped; else if `git apply --check` succeeds it is applied; else it is a hand-
|
||||
patched SDK carrying an equivalent (or a genuine conflict) and the script warns
|
||||
and continues rather than aborting the build.
|
||||
|
||||
## Buildroot
|
||||
|
||||
The vendor checkout ships buildroot-2023.02.6; WardenOS builds against
|
||||
buildroot-2025.02.8, which is not in the vendor checkout.
|
||||
`board/patches/0006-buildroot-2025.patch` (project/build.sh) and
|
||||
`board/patches/0009-sysdrv-buildroot-2025.patch` (sysdrv/Makefile) select it,
|
||||
and `../build/unpack-buildroot.sh` puts the pristine tree at
|
||||
`sysdrv/source/buildroot/buildroot-2025.02.8`: it fetches the tarball with
|
||||
`../build/fetch-buildroot-tarball.sh` (sha256-pinned) and leaves an existing
|
||||
tree alone. flare-edge's `tools/build-firmware.sh` runs it right after
|
||||
applying the patches, then stages `buildroot/files/` and applies
|
||||
`buildroot/patches/` onto the tree (issue #4).
|
||||
|
||||
## Completeness check
|
||||
|
||||
flare-edge's `tools/verify-sdk-patches.sh` replays this series onto the vendor
|
||||
base and compares the result with an SDK checkout. It also fails when the SDK
|
||||
has a tracked change (edit or deletion) that no patch, no fragment and no
|
||||
entry in flare-edge's `tools/sdk-delta-allowlist.txt` accounts for, and when
|
||||
the 86Panel board config names a kernel or U-Boot config fragment that
|
||||
neither the vendor base nor this directory provides. Before that check, five
|
||||
real deltas lived only in copies of one SDK tree (issue #4).
|
||||
|
||||
## What each patch does
|
||||
|
||||
### `uboot/patches/0001-display-and-boot-timing.patch`
|
||||
@@ -269,6 +294,19 @@ had masked it (the reproducibility gap `tools/build-firmware.sh` exists to close
|
||||
`sysdrv/source/uboot/u-boot/configs/` (it is a whole new file, not a diff);
|
||||
the board `.mk` patch is what references it by name.
|
||||
|
||||
### `board/patches/0009` to `0013` (issue #4)
|
||||
|
||||
Deltas that lived only in the workstation SDK until issue #4. Each patch
|
||||
header explains its change.
|
||||
|
||||
| patch | file | what it does |
|
||||
|---|---|---|
|
||||
| `0009-sysdrv-buildroot-2025.patch` | `sysdrv/Makefile` | `BUILDROOT_VER` to 2025.02.8 (the tree the `buildroot` target builds); relaxes the vendor unpack fallback's `cp` lines |
|
||||
| `0010-drop-2023-buildroot-package-patches.patch` | `sysdrv/tools/board/buildroot/{busybox,hcitool}_patch/` | deletes five 2023-era package patches the fallback would copy into Buildroot |
|
||||
| `0011-oem-flare-minimize.patch` | `project/cfg/BoardConfig_IPC/luckfox-buildroot-oem-pre.sh` | `flare_minimize`: strips camera/ISP files and modules from /oem |
|
||||
| `0012-drop-s50sshd.patch` | `overlay-luckfox-buildroot-init/etc/init.d/S50sshd` | deletes the generic sshd starter; dropbear provides SSH |
|
||||
| `0013-e2fsprogs-build-cflags.patch` | `sysdrv/tools/board/e2fsprogs/Makefile` | `BUILD_CFLAGS` so the host helpers build with gcc 14 |
|
||||
|
||||
## Config fragments
|
||||
|
||||
| fragment | why |
|
||||
@@ -278,6 +316,8 @@ had masked it (the reproducibility gap `tools/build-firmware.sh` exists to close
|
||||
| `uboot/flare-bootcount.config` | boot-failure fallback to `altbootcmd=download` -> MaskRom |
|
||||
| `uboot/flare-spl-brom.config` | builds `spl_bootrom.o`; does *not* set `SPL_ROCKCHIP_BACK_TO_BROM`, which would flip `SPL_MMC_SUPPORT` off |
|
||||
| `kernel/flare-backlight.config` | `CONFIG_BACKLIGHT_PWM=y`. As `=m` the backlight class device does not exist until userspace `insmod`s it at ~3.3-3.7 s, which is when the logo is being replaced anyway |
|
||||
| `kernel/flare-wireguard.config` | `CONFIG_WIREGUARD=y` for the vendor 5.10 kernel, which builds the recovery image. Named by the 86Panel board `.mk`; untracked in the workstation SDK until issue #4 |
|
||||
| `kernel/rv1106-usb-host-ethernet.config` | USB-Ethernet class drivers (with the `USB_NET_DRIVERS` menu gate) for the vendor 5.10 kernel. Same history as `flare-wireguard.config` |
|
||||
| `kernel/flare-fbcon.config` | `# CONFIG_LOGO is not set` (the SDK ships the LuckFox fox-head over our logo) plus `FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER=y` (fbcon seizing the fb destroyed the `drm_logo` image U-Boot handed over) |
|
||||
|
||||
## Measured boot timeline
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
Build buildroot-2025.02.8 from sysdrv/Makefile too.
|
||||
|
||||
0006-buildroot-2025.patch points project/build.sh at buildroot-2025.02.8, but
|
||||
sysdrv/Makefile has its own default, BUILDROOT_VER, and that is the one the
|
||||
`buildroot` target actually builds. Left at the vendor's 2023.02.6, a clean
|
||||
checkout configures and builds the old tree.
|
||||
|
||||
The same Makefile carries the vendor's fallback that unpacks
|
||||
tools/board/buildroot/$(BUILDROOT_VER).tar.gz when the tree is missing and
|
||||
copies the vendor defconfigs and package patches into it. Two relaxations
|
||||
keep that fallback usable with 2025.02.8:
|
||||
|
||||
- `*_defconfig` instead of only luckfox_pico_w_defconfig, so any defconfig
|
||||
staged beside the vendor ones is copied too.
|
||||
- `|| true` on the busybox and hcitool patch copies, because
|
||||
0010-drop-2023-buildroot-package-patches.patch empties those directories.
|
||||
|
||||
The WardenOS build does not use the fallback: flare-edge's
|
||||
tools/build-firmware.sh unpacks the pinned, sha256-verified tarball with
|
||||
build/unpack-buildroot.sh before the SDK build runs, so the Makefile's
|
||||
`test -d` finds the tree and skips its own unpack and copies.
|
||||
|
||||
diff --git a/sysdrv/Makefile b/sysdrv/Makefile
|
||||
index 5edb8f875..c173c219e 100644
|
||||
--- a/sysdrv/Makefile
|
||||
+++ b/sysdrv/Makefile
|
||||
@@ -281,7 +281,7 @@ BUSYBOX_DIR := $(SYSDRV_DIR)/source/busybox
|
||||
SYSDRV_BUSYBOX_OBJS_OUTPUT_DIR ?= $(BUSYBOX_DIR)/objs_$(BUSYBOX_CFG)
|
||||
|
||||
BUILDROOT_CFG ?= config_normal
|
||||
-BUILDROOT_VER ?= buildroot-2023.02.6
|
||||
+BUILDROOT_VER ?= buildroot-2025.02.8
|
||||
BUILDROOT_DIR := $(SYSDRV_DIR)/source/buildroot
|
||||
|
||||
CUSTOM_VER ?= custom
|
||||
@@ -599,11 +599,11 @@ buildroot_create:
|
||||
mkdir -p $(BUILDROOT_DIR)
|
||||
tar xzf $(SYSDRV_DIR)/tools/board/buildroot/$(BUILDROOT_VER).tar.gz -C $(BUILDROOT_DIR)
|
||||
cp $(SYSDRV_DIR)/tools/board/buildroot/luckfox_pico_defconfig $(BUILDROOT_DIR)/$(BUILDROOT_VER)/configs/
|
||||
- cp $(SYSDRV_DIR)/tools/board/buildroot/luckfox_pico_w_defconfig $(BUILDROOT_DIR)/$(BUILDROOT_VER)/configs/
|
||||
+ cp $(SYSDRV_DIR)/tools/board/buildroot/*_defconfig $(BUILDROOT_DIR)/$(BUILDROOT_VER)/configs/
|
||||
cp $(SYSDRV_DIR)/tools/board/buildroot/busybox.config $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/busybox/
|
||||
- cp ${HCITOOL_TOOL_PATH}/*.patch $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/bluez5_utils/
|
||||
+ cp ${HCITOOL_TOOL_PATH}/*.patch $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/bluez5_utils/ || true
|
||||
cp ${MPV_PATCH_PATH}/*.patch $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/mpv/
|
||||
- cp ${BUSYBOX_PATCH_PATH}/*.patch $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/busybox/
|
||||
+ cp ${BUSYBOX_PATCH_PATH}/*.patch $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/busybox/ || true
|
||||
|
||||
buildroot: prepare
|
||||
@echo -e "$(C_GREEN) ==sysdrv== build buildroot $(C_NORMAL)"
|
||||
@@ -611,11 +611,11 @@ buildroot: prepare
|
||||
mkdir -p $(BUILDROOT_DIR) ;\
|
||||
tar xzf $(SYSDRV_DIR)/tools/board/buildroot/$(BUILDROOT_VER).tar.gz -C $(BUILDROOT_DIR) ;\
|
||||
cp $(SYSDRV_DIR)/tools/board/buildroot/luckfox_pico_defconfig $(BUILDROOT_DIR)/$(BUILDROOT_VER)/configs/ ;\
|
||||
- cp $(SYSDRV_DIR)/tools/board/buildroot/luckfox_pico_w_defconfig $(BUILDROOT_DIR)/$(BUILDROOT_VER)/configs/ ;\
|
||||
+ cp $(SYSDRV_DIR)/tools/board/buildroot/*_defconfig $(BUILDROOT_DIR)/$(BUILDROOT_VER)/configs/ ;\
|
||||
cp $(SYSDRV_DIR)/tools/board/buildroot/busybox.config $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/busybox/ ;\
|
||||
- cp ${HCITOOL_TOOL_PATH}/*.patch $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/bluez5_utils/ ;\
|
||||
+ cp ${HCITOOL_TOOL_PATH}/*.patch $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/bluez5_utils/ || true ;\
|
||||
cp ${MPV_PATCH_PATH}/*.patch $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/mpv/ ;\
|
||||
- cp ${BUSYBOX_PATCH_PATH}/*.patch $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/busybox/ ;\
|
||||
+ cp ${BUSYBOX_PATCH_PATH}/*.patch $(BUILDROOT_DIR)/$(BUILDROOT_VER)/package/busybox/ || true ;\
|
||||
);
|
||||
|
||||
$(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) $(BUILDROOT_DEFCONFIG) -C $(BUILDROOT_DIR)/$(BUILDROOT_VER)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
Strip camera and ISP payload from /oem.
|
||||
|
||||
luckfox-buildroot-oem-pre.sh runs over the OEM staging tree before it is
|
||||
packed. flare_minimize() removes what WardenOS never uses because no image
|
||||
sensor is fitted: the ISP tuning files (about 32 MB), the rkaiq 3A library
|
||||
and servers, the camera capture kernel modules, and the camera and MPI
|
||||
sample binaries.
|
||||
|
||||
NPU, video codec, RGA and rockit are kept on purpose. WiFi/BT, touch and the
|
||||
insmod scripts are not touched.
|
||||
|
||||
diff --git a/project/cfg/BoardConfig_IPC/luckfox-buildroot-oem-pre.sh b/project/cfg/BoardConfig_IPC/luckfox-buildroot-oem-pre.sh
|
||||
index 4187457d4..de2bf74e6 100755
|
||||
--- a/project/cfg/BoardConfig_IPC/luckfox-buildroot-oem-pre.sh
|
||||
+++ b/project/cfg/BoardConfig_IPC/luckfox-buildroot-oem-pre.sh
|
||||
@@ -46,4 +46,37 @@ function remove_data()
|
||||
#=========================
|
||||
# run
|
||||
#=========================
|
||||
-remove_data
|
||||
\ No newline at end of file
|
||||
+remove_data
|
||||
+#=========================
|
||||
+# flare-edge: drop camera / ISP from /oem
|
||||
+#
|
||||
+# Camera is out of scope for the Warden gateway role (no sensor attached).
|
||||
+# NPU, video codec, RGA and rockit are KEPT deliberately - they are onboard
|
||||
+# hardware we chose to retain. WiFi/BT (aic8800*), touch (goodix) and the
|
||||
+# insmod scripts are never touched here.
|
||||
+#=========================
|
||||
+function flare_minimize()
|
||||
+{
|
||||
+ KO=$RK_PROJECT_PACKAGE_OEM_DIR/usr/ko
|
||||
+
|
||||
+ # ISP tuning data - by far the biggest item in /oem (~32MB)
|
||||
+ lf_rm $RK_PROJECT_PACKAGE_OEM_DIR/usr/share/iqfiles
|
||||
+
|
||||
+ # ISP 3A library and its servers
|
||||
+ lf_rm $RK_PROJECT_PACKAGE_OEM_DIR/usr/lib/librkaiq*
|
||||
+ lf_rm $RK_PROJECT_PACKAGE_OEM_DIR/usr/bin/rkaiq_3A_server
|
||||
+ lf_rm $RK_PROJECT_PACKAGE_OEM_DIR/usr/bin/rkaiq_tool_server
|
||||
+
|
||||
+ # camera capture path: ISP, CIF, MIPI CSI-2 D-PHY, and the sensor drivers
|
||||
+ lf_rm $KO/video_rkisp.ko $KO/video_rkcif.ko
|
||||
+ lf_rm $KO/phy-rockchip-csi2-dphy.ko $KO/phy-rockchip-csi2-dphy-hw.ko
|
||||
+ lf_rm $KO/sc3336.ko $KO/mis5001.ko $KO/gspca_main.ko
|
||||
+
|
||||
+ # camera/ISP demo + sample binaries (keep luckfox_*_test and modetest:
|
||||
+ # those are the GPIO/UART/I2C/SPI/PWM/display bring-up tools we want)
|
||||
+ lf_rm $RK_PROJECT_PACKAGE_OEM_DIR/usr/bin/sample_*
|
||||
+ lf_rm $RK_PROJECT_PACKAGE_OEM_DIR/usr/bin/rk_mpi_*
|
||||
+ lf_rm $RK_PROJECT_PACKAGE_OEM_DIR/usr/bin/simple_*
|
||||
+}
|
||||
+
|
||||
+flare_minimize
|
||||
@@ -0,0 +1,65 @@
|
||||
Remove the generic S50sshd init script.
|
||||
|
||||
overlay-luckfox-buildroot-init is in the 86Panel board's RK_POST_OVERLAY.
|
||||
Its S50sshd runs `ssh-keygen -A` inline. With no hardware RNG and no saved
|
||||
seed on a freshly written rootfs, getrandom() blocks, and rcS is sequential,
|
||||
so every init script sorting after it (S50usbdevice among them) never ran
|
||||
and the board came up with no reachable interface.
|
||||
|
||||
WardenOS gets its SSH server from Buildroot's dropbear package, selected by
|
||||
flare_warden_defconfig, which installs its own init script.
|
||||
|
||||
diff --git a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-buildroot-init/etc/init.d/S50sshd b/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-buildroot-init/etc/init.d/S50sshd
|
||||
deleted file mode 100755
|
||||
index e5b9c4451..000000000
|
||||
--- a/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-buildroot-init/etc/init.d/S50sshd
|
||||
+++ /dev/null
|
||||
@@ -1,48 +0,0 @@
|
||||
-#!/bin/sh
|
||||
-#
|
||||
-# sshd Starts sshd.
|
||||
-#
|
||||
-
|
||||
-# Make sure the ssh-keygen progam exists
|
||||
-[ -f /usr/bin/ssh-keygen ] || exit 0
|
||||
-
|
||||
-umask 077
|
||||
-
|
||||
-start() {
|
||||
- chown root:root /var/empty/
|
||||
- # Create any missing keys
|
||||
- /usr/bin/ssh-keygen -A
|
||||
-
|
||||
- printf "Starting sshd: "
|
||||
- /usr/sbin/sshd
|
||||
- touch /var/lock/sshd
|
||||
- echo "OK"
|
||||
-}
|
||||
-stop() {
|
||||
- printf "Stopping sshd: "
|
||||
- killall sshd
|
||||
- rm -f /var/lock/sshd
|
||||
- echo "OK"
|
||||
-}
|
||||
-restart() {
|
||||
- stop
|
||||
- start
|
||||
-}
|
||||
-
|
||||
-case "$1" in
|
||||
- start)
|
||||
- start
|
||||
- ;;
|
||||
- stop)
|
||||
- stop
|
||||
- ;;
|
||||
- restart|reload)
|
||||
- restart
|
||||
- ;;
|
||||
- *)
|
||||
- echo "Usage: $0 {start|stop|restart}"
|
||||
- exit 1
|
||||
-esac
|
||||
-
|
||||
-exit $?
|
||||
-
|
||||
@@ -0,0 +1,21 @@
|
||||
Build e2fsprogs host helpers with gcc 14.
|
||||
|
||||
The vendor's e2fsprogs 1.43.9 compiles a few helper programs for the build
|
||||
host (BUILD_CC) while cross-building the target tools. That source relies on
|
||||
implicit function declarations and implicit int, which gcc 14 turns into
|
||||
errors, so the host helper build fails. BUILD_CFLAGS demotes those two back
|
||||
to warnings for the host helpers only; the target CFLAGS are unchanged.
|
||||
|
||||
diff --git a/sysdrv/tools/board/e2fsprogs/Makefile b/sysdrv/tools/board/e2fsprogs/Makefile
|
||||
index 14ab9e503..baa541093 100644
|
||||
--- a/sysdrv/tools/board/e2fsprogs/Makefile
|
||||
+++ b/sysdrv/tools/board/e2fsprogs/Makefile
|
||||
@@ -20,7 +20,7 @@ all:
|
||||
mkdir -p $(CURRENT_DIR)/$(PKG_BIN)/usr/; \
|
||||
pushd $(CURRENT_DIR)/$(PKG_NAME)/; \
|
||||
./configure --host=$(SYSDRV_CROSS) --target=$(SYSDRV_CROSS) CFLAGS="$(SYSDRV_CROSS_CFLAGS)" \
|
||||
- LDFLAGS="$(SYSDRV_CROSS_CFLAGS)" --prefix=$(CURRENT_DIR)/$(PKG_BIN) \
|
||||
+ LDFLAGS="$(SYSDRV_CROSS_CFLAGS)" BUILD_CFLAGS="-Wno-implicit-function-declaration -Wno-implicit-int" --prefix=$(CURRENT_DIR)/$(PKG_BIN) \
|
||||
--disable-nls \
|
||||
--disable-debugfs --disable-imager --disable-defrag --enable-fsck --enable-resizer \
|
||||
--disable-testio-debug --disable-rpath --enable-symlink-install --disable-fuse2fs; \
|
||||
@@ -0,0 +1,10 @@
|
||||
# WireGuard, built in rather than as a module.
|
||||
#
|
||||
# =y not =m deliberately: modules live on the oem partition and must be
|
||||
# reflashed in lockstep with the kernel, and this one is ~40KB. Paying that in
|
||||
# boot.img is cheaper than another matched-pair failure mode.
|
||||
#
|
||||
# Everything WireGuard needs it "select"s for itself (NET_UDP_TUNNEL,
|
||||
# DST_CACHE, CRYPTO_LIB_CURVE25519, CRYPTO_LIB_CHACHA20POLY1305), so unlike the
|
||||
# USB-Ethernet fragment there is no menu gate to open first. Verify anyway.
|
||||
CONFIG_WIREGUARD=y
|
||||
@@ -0,0 +1,20 @@
|
||||
# USB host + USB-Ethernet class drivers (flare-edge).
|
||||
#
|
||||
# The first symbol is the MENU GATE. Every driver below lives inside the
|
||||
# USB_NET_DRIVERS menuconfig, so without it kconfig discards the lot in
|
||||
# silence -- no warning, and not even the usual "not in final .config" from
|
||||
# merge_config.sh.
|
||||
#
|
||||
# Do not begin a comment line here with a hash followed by CONFIG_. That is
|
||||
# exactly the "is not set" syntax, so merge_config.sh parses the prose as a
|
||||
# directive and reports it as a redefinition of the symbol it names.
|
||||
CONFIG_USB_NET_DRIVERS=y
|
||||
CONFIG_USB_USBNET=y
|
||||
CONFIG_USB_NET_CDCETHER=y
|
||||
CONFIG_USB_NET_CDC_NCM=y
|
||||
CONFIG_USB_NET_CDC_EEM=y
|
||||
CONFIG_USB_RTL8152=y
|
||||
CONFIG_USB_NET_AX8817X=y
|
||||
CONFIG_USB_NET_AX88179_178A=y
|
||||
CONFIG_USB_NET_SMSC95XX=y
|
||||
CONFIG_USB_NET_MCS7830=y
|
||||
@@ -37,6 +37,7 @@ scripts=(
|
||||
"qemu/tests/stage-rootfs-perms.sh"
|
||||
"tests/fetch-vendor/run-fetch-vendor-tests.sh"
|
||||
"tests/fetch-buildroot-tarball/run-fetch-buildroot-tarball-tests.sh"
|
||||
"tests/unpack-buildroot/run-unpack-buildroot-tests.sh"
|
||||
"tests/mk-bootimg/run-boot-img-validate-tests.sh"
|
||||
"tests/mk-bootimg/run-help-tests.sh"
|
||||
"tests/mk-bootimg/run-ci-wiring-tests.sh"
|
||||
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
#!/usr/bin/env bash
|
||||
# Regression tests for build/unpack-buildroot.sh (blueflare/bfe-core1106-sdk#4).
|
||||
#
|
||||
# A clean vendor checkout plus luckfox-sdk-patches/ could not build WardenOS
|
||||
# because nothing put buildroot-2025.02.8 where the SDK builds it. The unpack
|
||||
# script is now the thing that does, and the persistent CI SDK depends on it
|
||||
# leaving an existing tree alone. These cases pin both halves: a fresh SDK
|
||||
# gets a complete tree, an existing tree is never touched or re-fetched, and
|
||||
# every refusal (unpatched selectors, a bad tarball, a half-present tree, a
|
||||
# failed fetch) leaves no tree and no scratch directory behind.
|
||||
#
|
||||
# Runs the real script, copied beside a stub fetch-buildroot-tarball.sh that
|
||||
# copies a local fixture tarball instead of downloading. No network, no SDK.
|
||||
set -uo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
SCRIPT="$HERE/../../build/unpack-buildroot.sh"
|
||||
[ -f "$SCRIPT" ] || { echo "FAIL: script not found at $SCRIPT"; exit 1; }
|
||||
|
||||
FAIL=0
|
||||
ok() { printf '[PASS] %s\n' "$1"; }
|
||||
bad() { printf '[FAIL] %s\n' "$1"; FAIL=1; }
|
||||
|
||||
TMP="$(mktemp -d)" || { echo "FAIL: mktemp -d failed"; exit 1; }
|
||||
[ -d "$TMP" ] || { echo "FAIL: mktemp -d failed"; exit 1; }
|
||||
trap 'rm -rf "$TMP"' EXIT
|
||||
|
||||
VER=2025.02.8
|
||||
|
||||
# Fixture tarballs: a minimal Buildroot-shaped tree, and one without Makefile.
|
||||
mk_tarball() { # mk_tarball <out.tar.xz> <with-makefile:0|1>
|
||||
local out="$1" mf="$2" src
|
||||
src="$(mktemp -d "$TMP/src.XXXXXX")"
|
||||
mkdir -p "$src/buildroot-$VER/configs" "$src/buildroot-$VER/package/busybox"
|
||||
printf 'CONFIG\n' > "$src/buildroot-$VER/package/busybox/busybox.config"
|
||||
[ "$mf" = 1 ] && printf 'all:\n' > "$src/buildroot-$VER/Makefile"
|
||||
tar -cJf "$out" -C "$src" "buildroot-$VER"
|
||||
}
|
||||
mk_tarball "$TMP/good.tar.xz" 1
|
||||
mk_tarball "$TMP/nomakefile.tar.xz" 0
|
||||
|
||||
# setup <case> <tarball-or-FAIL> -> fixture dir holding build/ and sdk/
|
||||
setup() {
|
||||
local dir="$TMP/$1" src="$2"
|
||||
mkdir -p "$dir/build" "$dir/sdk/project" "$dir/sdk/sysdrv/source/buildroot"
|
||||
cp "$SCRIPT" "$dir/build/unpack-buildroot.sh"
|
||||
{
|
||||
echo '#!/usr/bin/env bash'
|
||||
echo "BRVER=$VER"
|
||||
echo "echo fetch-called >> \"$dir/fetch-calls\""
|
||||
if [ "$src" = FAIL ]; then echo 'exit 1'; else echo "cp \"$src\" \"\$1\""; fi
|
||||
} > "$dir/build/fetch-buildroot-tarball.sh"
|
||||
# shellcheck disable=SC2016 # build.sh carries the literal text
|
||||
printf 'BUILDROOT_PATH=${SDK_SYSDRV_DIR}/source/buildroot/buildroot-%s\n' "$VER" \
|
||||
> "$dir/sdk/project/build.sh"
|
||||
printf 'BUILDROOT_VER ?= buildroot-%s\n' "$VER" > "$dir/sdk/sysdrv/Makefile"
|
||||
printf '%s' "$dir"
|
||||
}
|
||||
|
||||
run() { # run <dir> -> $OUT, $RC
|
||||
OUT="$(bash "$1/build/unpack-buildroot.sh" "$1/sdk" 2>&1)"; RC=$?
|
||||
}
|
||||
tree() { printf '%s' "$1/sdk/sysdrv/source/buildroot/buildroot-$VER"; }
|
||||
fetches() { [ -f "$1/fetch-calls" ] && wc -l < "$1/fetch-calls" || echo 0; }
|
||||
no_scratch() { ! compgen -G "$1/sdk/sysdrv/source/buildroot/.unpack-buildroot.*" >/dev/null; }
|
||||
|
||||
# A. Fresh SDK: fetched once, unpacked to the selected path, no scratch left.
|
||||
d="$(setup fresh "$TMP/good.tar.xz")"; run "$d"
|
||||
if [ "$RC" -eq 0 ] && [ -f "$(tree "$d")/Makefile" ] && [ -f "$(tree "$d")/package/busybox/busybox.config" ] \
|
||||
&& [ "$(fetches "$d")" -eq 1 ] && no_scratch "$d"; then
|
||||
ok "fresh SDK: tree unpacked, one fetch, no scratch left"
|
||||
else
|
||||
bad "fresh SDK: tree unpacked, one fetch, no scratch left (rc=$RC, out=$OUT)"
|
||||
fi
|
||||
|
||||
# B. Rerun on that SDK: already present, no second fetch, content untouched.
|
||||
printf 'LOCAL\n' > "$(tree "$d")/package/busybox/busybox.config"
|
||||
run "$d"
|
||||
if [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'tree already present' \
|
||||
&& [ "$(fetches "$d")" -eq 1 ] && grep -qx LOCAL "$(tree "$d")/package/busybox/busybox.config"; then
|
||||
ok "existing tree: left alone, not re-fetched"
|
||||
else
|
||||
bad "existing tree: left alone, not re-fetched (rc=$RC, out=$OUT)"
|
||||
fi
|
||||
|
||||
# C. project/build.sh still selects the vendor tree: refuse, fetch nothing.
|
||||
d="$(setup unpatched-build "$TMP/good.tar.xz")"
|
||||
# shellcheck disable=SC2016 # build.sh carries the literal text
|
||||
printf 'BUILDROOT_PATH=${SDK_SYSDRV_DIR}/source/buildroot/buildroot-2023.02.6\n' > "$d/sdk/project/build.sh"
|
||||
run "$d"
|
||||
if [ "$RC" -ne 0 ] && printf '%s' "$OUT" | grep -q 'project/build.sh selects' \
|
||||
&& [ "$(fetches "$d")" -eq 0 ] && [ ! -e "$(tree "$d")" ]; then
|
||||
ok "unpatched project/build.sh: refused before fetching"
|
||||
else
|
||||
bad "unpatched project/build.sh: refused before fetching (rc=$RC, out=$OUT)"
|
||||
fi
|
||||
|
||||
# D. sysdrv/Makefile still selects the vendor tree: refuse, fetch nothing.
|
||||
d="$(setup unpatched-make "$TMP/good.tar.xz")"
|
||||
printf 'BUILDROOT_VER ?= buildroot-2023.02.6\n' > "$d/sdk/sysdrv/Makefile"
|
||||
run "$d"
|
||||
if [ "$RC" -ne 0 ] && printf '%s' "$OUT" | grep -q 'sysdrv/Makefile selects' \
|
||||
&& [ "$(fetches "$d")" -eq 0 ] && [ ! -e "$(tree "$d")" ]; then
|
||||
ok "unpatched sysdrv/Makefile: refused before fetching"
|
||||
else
|
||||
bad "unpatched sysdrv/Makefile: refused before fetching (rc=$RC, out=$OUT)"
|
||||
fi
|
||||
|
||||
# E. Tarball without a Buildroot Makefile: refuse, no tree, no scratch.
|
||||
d="$(setup bad-tarball "$TMP/nomakefile.tar.xz")"; run "$d"
|
||||
if [ "$RC" -ne 0 ] && printf '%s' "$OUT" | grep -q 'did not contain' \
|
||||
&& [ ! -e "$(tree "$d")" ] && no_scratch "$d"; then
|
||||
ok "tarball without Makefile: refused, nothing left behind"
|
||||
else
|
||||
bad "tarball without Makefile: refused, nothing left behind (rc=$RC, out=$OUT)"
|
||||
fi
|
||||
|
||||
# F. A half-present tree (an interrupted hand unpack): refuse, keep it as is.
|
||||
d="$(setup half-tree "$TMP/good.tar.xz")"
|
||||
mkdir -p "$(tree "$d")/output"; printf 'keep\n' > "$(tree "$d")/output/marker"
|
||||
run "$d"
|
||||
if [ "$RC" -ne 0 ] && printf '%s' "$OUT" | grep -q 'not a complete Buildroot tree' \
|
||||
&& [ -f "$(tree "$d")/output/marker" ] && [ "$(fetches "$d")" -eq 0 ]; then
|
||||
ok "half-present tree: refused and left untouched"
|
||||
else
|
||||
bad "half-present tree: refused and left untouched (rc=$RC, out=$OUT)"
|
||||
fi
|
||||
|
||||
# G. Fetch fails (network down, sha256 mismatch): nonzero, no tree.
|
||||
d="$(setup fetch-fails FAIL)"; run "$d"
|
||||
if [ "$RC" -ne 0 ] && [ ! -e "$(tree "$d")" ] && no_scratch "$d"; then
|
||||
ok "failed fetch: nonzero, no tree"
|
||||
else
|
||||
bad "failed fetch: nonzero, no tree (rc=$RC, out=$OUT)"
|
||||
fi
|
||||
|
||||
if [ "$FAIL" -eq 0 ]; then echo "ALL UNPACK-BUILDROOT TESTS PASSED"; else echo "UNPACK-BUILDROOT TESTS FAILED"; fi
|
||||
exit "$FAIL"
|
||||
Reference in New Issue
Block a user