luckfox-sdk-patches: capture the SDK deltas that lived only in one tree

A clean vendor checkout plus this series could not build WardenOS: the
workstation SDK that CI copies carried tracked changes and two untracked
kernel fragments that no patch recorded (#4).

- board/0009: sysdrv/Makefile selects buildroot-2025.02.8 and relaxes the
  vendor unpack fallback's cp lines.
- board/0010: removes the five 2023-era busybox/hcitool package patches.
- board/0011: flare_minimize strips camera/ISP payload from /oem.
- board/0012: removes the generic S50sshd init script.
- board/0013: e2fsprogs BUILD_CFLAGS for gcc 14 host helpers.
- kernel/configs: flare-wireguard.config and rv1106-usb-host-ethernet.config,
  which the 86Panel board .mk names for the vendor 5.10 kernel.

Every hunk is git diff output against 824b817f8, byte for byte.

Refs #4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg
This commit is contained in:
Noah
2026-09-28 11:10:53 -06:00
co-authored by Claude Opus 5.5
parent eb0691d84f
commit 5f36beb44a
8 changed files with 3425 additions and 1 deletions
+41 -1
View File
@@ -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