ci / bench (push) Successful in 6s
ci / mcdc (push) Successful in 12s
ci / patches-apply (push) Successful in 15s
ci / test (pull_request) Successful in 14s
ci / quality (push) Successful in 29s
ci / badges (push) Skipped
ci / test (push) Successful in 13s
ci / prune-artifacts (push) Skipped
ci / kernel-build (push) Skipped
ci / qemu-tools (push) Successful in 42s
ci / patches-apply (pull_request) Successful in 16s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / quality (pull_request) Successful in 27s
ci / badges (pull_request) Skipped
ci / bench (pull_request) Successful in 4s
ci / mcdc (pull_request) Successful in 14s
ci / qemu-tools (pull_request) Successful in 41s
0004's gate read a missing /userdata/warden/role as router, so a fresh store never composed the gadget and the panel had no usb0 until its second boot (flare-edge#278). Every other role reader defaults unset to client. 0014 changes the gate to match. A new patch rather than an edit to 0004: build-firmware.sh skips an edited, already-applied 0004 as inconclusive, so the runner SDK would keep the old gate. 0014 applies on a pristine replay and on a tree that already carries 0004 and 0008. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg
362 lines
24 KiB
Markdown
362 lines
24 KiB
Markdown
# luckfox-sdk-patches
|
|
|
|
The Luckfox SDK (`LuckfoxTECH/luckfox-pico`, pinned in `../build/vendor.manifest`
|
|
as `luckfox-pico`) is a ~2 GB vendor checkout and is deliberately **not** in
|
|
this repo. Our changes to it were, until now, living only as uncommitted
|
|
edits in one person's working copy -- which is how a stale second copy on
|
|
another machine came within one command of silently reverting a day of work.
|
|
This directory is the tracked form of those changes.
|
|
|
|
**Moved here 2026-09-15** from `sdk-patches/` in `blueflare/flare-edge`
|
|
(source commit `flare-edge@86d4633`), so the SDK repo -- not the firmware
|
|
repo that merely consumes it -- is the single canonical home for every
|
|
kernel/U-Boot/driver delta. flare-edge's `tools/build-firmware.sh` and
|
|
friends now read this directory through the `vendor/warden-sdk` submodule
|
|
instead of a same-repo `sdk-patches/`.
|
|
|
|
**Vendor base: `824b817f8`** of <https://github.com/LuckfoxTECH/luckfox-pico>
|
|
(`Pullrequest 260319 (#355)`) -- the same commit `../build/vendor.manifest`
|
|
pins. Every patch here is `git diff` against that commit and has been
|
|
verified with `git apply --check` against a pristine tree at that revision.
|
|
If the vendor base moves, re-verify before trusting them.
|
|
|
|
**Not `patches/`, and not `sdk/`.** This repo's top-level `patches/` is a
|
|
different, unrelated thing: the from-scratch Linux 6.18.46 forward-port
|
|
series (see `../patches/README.md`). `luckfox-sdk-patches/` patches the
|
|
**legacy** vendor tree instead (U-Boot 2017.09 and, optionally, the vendor
|
|
5.10.160 kernel) -- naming it `luckfox-sdk-patches/` keeps the two
|
|
unmistakable next to each other. It also isn't named plain `sdk/`, carrying
|
|
forward the original naming rule from its flare-edge home: that repo's
|
|
`ui-src/pkgconfig-stub/libdrm.pc` resolves `${pcfiledir}/../../sdk`, so a
|
|
directory named `sdk/` anywhere it might be checked out alongside would
|
|
shadow the real vendor SDK checkout. That specific collision cannot happen
|
|
in this repo, but the name stayed to avoid a second rename and to keep the
|
|
provenance trail (wiki, commit messages, flare-edge doc citations) legible
|
|
across the move. Do not rename it.
|
|
|
|
## License
|
|
|
|
Everything here is a `git diff` against Rockchip/Luckfox's GPL-2.0 vendor
|
|
U-Boot (2017.09) and Linux (5.10.160) forks, plus a handful of small
|
|
standalone files we authored (`uboot/include/flare_touch.h`,
|
|
`uboot/include/flare_trace.h`, the bluez5 `wordexp.h` compat shim, the mpv
|
|
Bessel-function patch). The diffs are themselves GPL-2.0 derivative work,
|
|
consistent with this repo's repo-wide GPL-2.0-only license (`../LICENSE`);
|
|
the small standalone files carry no GPL restriction of their own but are
|
|
distributed here under the same license for simplicity. Unlike `../patches/`
|
|
(the 6.18 port), no per-driver provenance ledger exists for this directory
|
|
yet -- everything here predates that convention. If one is wanted, it
|
|
belongs beside `../kernel/rv1106-enablement/PROVENANCE.md`.
|
|
|
|
## Layout
|
|
|
|
```
|
|
luckfox-sdk-patches/uboot/patches/ diffs against sysdrv/source/uboot/u-boot/
|
|
luckfox-sdk-patches/uboot/configs/ new config fragments (not patches -- whole new files)
|
|
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/ 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
|
|
`-p1` from there:
|
|
|
|
```sh
|
|
cd /path/to/vendor/sdk
|
|
for p in /path/to/warden-sdk/luckfox-sdk-patches/uboot/patches/*.patch \
|
|
/path/to/warden-sdk/luckfox-sdk-patches/kernel/patches/*.patch \
|
|
/path/to/warden-sdk/luckfox-sdk-patches/board/patches/*.patch; do
|
|
git apply --check "$p" && git apply "$p"
|
|
done
|
|
cp /path/to/warden-sdk/luckfox-sdk-patches/uboot/configs/*.config sysdrv/source/uboot/u-boot/configs/
|
|
cp /path/to/warden-sdk/luckfox-sdk-patches/uboot/include/*.h sysdrv/source/uboot/u-boot/include/
|
|
cp /path/to/warden-sdk/luckfox-sdk-patches/kernel/configs/*.config sysdrv/source/kernel/arch/arm/configs/
|
|
```
|
|
|
|
**You no longer have to run the above by hand.** flare-edge's
|
|
`tools/build-firmware.sh` (in the `blueflare/flare-edge` repo, which carries
|
|
this SDK as the `vendor/warden-sdk` submodule) applies everything in
|
|
`luckfox-sdk-patches/` (patches idempotently, config fragments by copy)
|
|
before it builds -- see its `apply_sdk_patches` step. The manual recipe is
|
|
kept here as documentation of *what* that step does and for one-off use against
|
|
a pristine tree. Idempotency rule the script uses per patch: if
|
|
`git apply --reverse --check` succeeds the patch is already in the tree and is
|
|
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`
|
|
|
|
The U-Boot boot logo never appeared at all before this, and four separate bugs
|
|
had to be fixed before it did. Each was measured on hardware, not inferred.
|
|
|
|
| file | fix |
|
|
|---|---|
|
|
| `rockchip_display.c` | `malloc` -> `calloc`. `enabled_at_spl` is only ever assigned under `#ifdef CONFIG_SPL_BUILD`, so in U-Boot proper it read uninitialised heap. Garbage read as truthy meant `display_enable()` skipped the connector pre-enable/enable path -- the only path that reaches `backlight_enable()`. |
|
|
| `pwm_backlight.c` | `args.args[2] & 1`. The DT has `pwms = <&pwm1 0 100000 50000>`; assigning `50000` to a `bool` polarity field inverted the PWM. Measured `DUTY=0x26e8` (99.6%) with `CTRL=0x13`; after the fix `CTRL=0x0b`. The backlight was running at 0.4%. |
|
|
| `clk_rv1106.c` | Two bugs. `rv1106_clk_set_rate()` returned a stale `ret` instead of the computed `rate`, so it always reported 0 Hz. And `DCLK_VOP_DIV_MASK` is 5 bits (max ÷32) while `DIV_ROUND_UP(1188 MHz, 30 MHz) = 40` wrote 39, truncated to 7 -- **the VOP was running at 125 MHz, not 30**. Now clamps to 32, picks the closest parent, and retunes CPLL 1000 -> 960 MHz when neither divides evenly, giving exactly 30.000 MHz. |
|
|
| `rockchip_panel.c` | `FLARE_PANEL_SETTLE_MS`: wait after scanout starts before switching the backlight on. See the comment in the file -- it distinguishes two artefacts that look similar and have different causes. |
|
|
| `board.c` | Release `RGB_RES` (GPIO0_A1) at the top of `board_init()` instead of `board_late_init()`, and `FLARE_TRACE` instrumentation. `setup_download_mode()` is deliberately kept **first** in `board_late_init()`: moving the logo ahead of it pushed BOOT-key sampling from 1.18 s to ~4-5 s and the key had to be held for eight seconds. |
|
|
| `rv1106-u-boot.dtsi` | `u-boot,spl-boot-order = <&emmc>`. It was `<&sdmmc, &spi_nor, &spi_nand, &emmc>` -- the only fitted medium was last. Walking the dead entries cost **267 ms** every boot: ~212 ms failing to identify a non-existent SPI-NAND (`unknown raw ID 0 0 0`) and ~57 ms probing an SD slot this board does not have (`sdmmc` is wired to the AIC8800 WiFi as SDIO). **This file is shared by every rv1106 U-Boot build in the tree**; an SD- or SPI-NAND-booting variant would no longer boot. |
|
|
| `console.c` | Timestamp every console line, including from SPL. Needed two fixes: the stock code formats with `%5lu.%06lu`, which `CONFIG_USE_TINY_PRINTF` cannot render (it supports only `%c %s %u %d %x`), and it hooked `puts()`, which SPL never calls -- tiny printf goes character-at-a-time through `putc()`. Costs 324 B of SPL. |
|
|
| `rockchip_post_csc.c` | Add `#include <common.h>`. An upstream SDK bug, not a consequence of our config -- the vendor's own `rv1106_defconfig` also lacks `CONFIG_DM_I2C`. |
|
|
|
|
### `uboot/patches/0002-boot-robustness.patch`
|
|
|
|
Unattended recovery: `spl-boot-order.c` + `spl.c` register `BOOT_DEVICE_BOOTROM`
|
|
as a last-resort SPL load method so a failed U-Boot load drops to MaskRom
|
|
instead of hanging, and `bootcount/Kconfig` exposes `BOOTCOUNT_LIMIT` so
|
|
repeated boot failures fall through to `altbootcmd`. The defconfig change adds
|
|
the bootcount variables to `CONFIG_ENVF_LIST`.
|
|
|
|
**Provenance note:** this is boot-robustness rather than display work and may
|
|
overlap with reliability work done in a parallel session. Review before merging.
|
|
|
|
### `kernel/patches/0001-panel-mcu-reset-and-logo-route.patch`
|
|
|
|
Two hunks, both display:
|
|
|
|
- **`&panel`** -- removes `reset-gpios` and `reset-delay-ms`. GPIO0_A1 is *not*
|
|
the panel's reset. Per the 86Panel schematic, net `RGB_RES` ties SoC GPIO0_A1,
|
|
the panel RESET pin (FPC 6) and the `NRST` of a WCH **CH32V003** MCU (U6)
|
|
together; that MCU's only wired pins are SPI to the same FPC, and its sole job
|
|
is to clock the panel's initialisation sequence in. Handing the GPIO to
|
|
`panel-simple` therefore made `drm_panel_prepare()` **reboot the panel
|
|
initialiser while the VOP was already scanning out** -- which is the faint
|
|
coloured vertical banding seen for ~1-3 s on every boot, and why adding a
|
|
"reset" never cured it. Luckfox deleted these same two properties in
|
|
`e2b0ffa22`. An earlier revision of our tree re-added them, having read that
|
|
deletion as an accidental regression. **Confirmed fixed on hardware.**
|
|
`backlight` stays, because U-Boot's `rockchip_panel.c` takes its backlight
|
|
handle from this node.
|
|
- **`&route_rgb`** -- `status = "okay"`. The rest of the RGB pipeline is already
|
|
enabled in `rv1106-luckfox-pico-86panel-ipc.dtsi`; `route_rgb` was the only
|
|
piece left off, and without it U-Boot's `rockchip_display` finds no route and
|
|
skips drawing entirely.
|
|
|
|
Deliberately **excluded** from this patch, though present in the same file in
|
|
the working tree: the `model` rename, and a `dr_mode = "peripheral"` revert that
|
|
was a bench workaround to keep the USB network gadget stable for flashing. The
|
|
latter is superseded by the live USB role-switching work on `main`.
|
|
|
|
### `kernel/patches/0005-pstore-ramoops.patch`
|
|
|
|
Adds a `ramoops@0f000000` node (1 MiB @ 240 MiB) to `reserved-memory` in
|
|
`rv1106-luckfox-pico-86panel-ipc.dtsi` so pstore/ramoops has a DRAM region that
|
|
survives a reset. Pairs with the `CONFIG_PSTORE*` lines in
|
|
`kernel/configs/flare-edge.config`: the kernel console ring + oops/panic survive
|
|
into the next boot (`/sys/fs/pstore`), which is the ONLY way to diagnose a
|
|
pre-userspace hang (the c8a3 `0x40000` class) with no serial console. Placed
|
|
HIGH, above the low kernel-image/DTB/initrd zone, so the carve-out can only
|
|
remove kernel RAM -- it cannot recreate the c8a3 under-reservation collision.
|
|
Needs a `boot.img` reflash.
|
|
|
|
### `kernel/patches/0006-reboot-mode-maskrom.patch`
|
|
|
|
Adds `&reboot_mode { mode-maskrom = <0xEF08A53C>; };` (`BOOT_BROM_DOWNLOAD`) to
|
|
the 86Panel ipc.dtsi, so the OS helper `warden-maskrom maskrom`
|
|
(`reboot(RESTART2,"maskrom")`) writes that magic to the boot-mode reg
|
|
(`0xff020200`) and the next reset enters **true BootROM MaskRom** -- where
|
|
`upgrade_tool db`+`wl` / `provision-ab.sh` flash reliably. The stock
|
|
`mode-loader`/`-bootloader` only reach U-Boot rockusb "Loader" mode, whose
|
|
multi-partition WL is unreliable (writes report 100% but may not persist).
|
|
One-shot (PMU-domain reg, cleared by POR). Verified: the DTB compiles and
|
|
carries `mode-maskrom=0xEF08A53C`. Needs a `boot.img` reflash -- and the FIRST
|
|
deployment still needs one physical-MaskRom flash (chicken-and-egg), after which
|
|
remote MaskRom flashing works. Independent hunk (end of ipc.dtsi) -- applies in
|
|
any order vs 0005.
|
|
|
|
### `buildroot/files/package/mpv/0002-change-j1.patch`
|
|
|
|
Swaps mpv's `j1(x)` (video/out/filter_kernels.c, backing the EWA/jinc
|
|
scalers) for a local `BesselJ1()`. Needed because this target's uClibc-ng
|
|
does not provide `j1()`/`j0()`/`jn()` -- confirmed absent from
|
|
`libuClibc-1.0.31.so` in the arm-rockchip830-linux-uclibcgnueabihf
|
|
sysroot, the same kind of gap the bluez5_utils wordexp patch works around
|
|
for a different function.
|
|
|
|
The first version of `BesselJ1()` summed a fixed 11-term power series.
|
|
`jinc()` multiplies its argument by M_PI before calling it, and mpv's
|
|
`--scale-radius` is user-settable, so any radius reaching roughly x=20
|
|
already returns garbage: 11 terms had not converged there, so the value
|
|
was 3.1e6 instead of the correct 0.0668, growing to 3.3e42 by x=1000.
|
|
The current version sums a term-to-term-ratio series while each new term
|
|
is still negligible (stable for the range where that converges) and
|
|
falls back to the standard second-order asymptotic expansion for Bessel
|
|
functions beyond that, checked against the host's real `j1()` across
|
|
x in [0, 5000]: max absolute error 5e-8. `tools/bessel-j1-test.sh` pulls
|
|
whatever `BesselJ1()` the patch currently carries out of the diff and
|
|
checks it the same way, so a regression back to an unconverged series
|
|
is caught there instead of showing up as scaler artifacts on a panel.
|
|
|
|
### `buildroot/files/package/bluez5_utils/0001-add-uclibc-wordexp-compat.patch`
|
|
|
|
Adds a `wordexp.h` at the BlueZ source root: a minimal wordexp(3)/wordfree(3)
|
|
for uClibc-ng, which this toolchain does not provide. `bluetoothctl` and a few
|
|
BlueZ tools include `<wordexp.h>` unconditionally and only ever pass
|
|
`WRDE_NOCMD` ("no command substitution"), so a whitespace/quote tokenizer is a
|
|
semantically complete substitute -- the same kind of gap the mpv `j1()` patch
|
|
above works around for a different function.
|
|
|
|
`WRDE_APPEND` lets a caller accumulate words across more than one call onto
|
|
the same `wordexp_t`. An allocation failure partway through such a call used
|
|
to free the words the *earlier* call had already produced and leave
|
|
`we_wordv` pointing at memory `realloc()` had already relocated or freed --
|
|
reachable any time a second `WRDE_APPEND` call runs out of memory, not only
|
|
under theoretical low-memory conditions. Fixed by capturing the pre-call word
|
|
count and only ever freeing/relocating entries at or past it.
|
|
|
|
`tools/wordexp-test.sh` extracts `wordexp.h` from this patch's diff into a
|
|
scratch dir (nothing else in the tree has a copy -- it is a full new-file
|
|
patch, applied only during a firmware build) and runs `tools/wordexp_test.c`
|
|
against it: plain and quoted tokenizing, an unterminated quote, growth past
|
|
the initial capacity, `WRDE_APPEND` across two calls, and the allocation-
|
|
failure case above. Wired into CI's `daemons` job.
|
|
|
|
### Seatbelt build changes (docs/firmware-update.md section 6.6)
|
|
|
|
The firmware-update **seatbelt** (auto-revert of a bad remote reflash) needs a
|
|
handful of small U-Boot/OS build changes. Design section 6.6 lists six; items **1, 3,
|
|
4** are the low-risk, independently-shippable wiring, and they were -- until now -- present only in one person's hand-patched SDK, which is the exact "stale
|
|
second copy nearly reverted a day of work" trap that created this directory.
|
|
They are tracked here and applied by `tools/build-firmware.sh`, so a clean SDK
|
|
checkout plus that script reproduces them with no manual editing.
|
|
|
|
| section 6.6 | tracked as | what it does |
|
|
|---|---|---|
|
|
| **item 1** | `board/patches/0001-86panel-seatbelt-wiring.patch` (first hunk) + `uboot/configs/flare-bootcount.config` | Wires the bootcount fragment into the build: appends `flare-bootcount.config` to `RK_UBOOT_DEFCONFIG_FRAGMENT` in the 86Panel board `.mk`. The fragment itself (already tracked, see the Config-fragments table) turns on `CONFIG_BOOTCOUNT{,_LIMIT,_ENV}` and the extended `CONFIG_ENVF_LIST`. Without the wiring the fragment is inert and U-Boot never counts boots -- the seatbelt's U-Boot layer (section 6.1) is silently absent. |
|
|
| **item 3** | `board/patches/0001-86panel-seatbelt-wiring.patch` (second hunk) + `board/patches/0002-build-honor-bootargs-extra.patch` | `panic=10` on the kernel cmdline (`sys_bootargs`) so a kernel panic **reboots** after 10 s instead of hanging (section 6.4). The board `.mk` sets `RK_BOOTARGS_EXTRA="panic=10"`; the second patch teaches `project/build.sh`'s `__GET_BOOTARGS_FROM_BOARD_CFG()` to append `RK_BOOTARGS_EXTRA` verbatim to `sys_bootargs` (the same place it already appends `rk_dma_heap_cma=`). That variable flows to `RK_KERNEL_CMDLINE_FRAGMENT` -> `sysdrv/Makefile`'s `KERNEL_CMDLINE_FRAGMENT` -> the actual boot args. The hook is generic and inert: a board that never sets `RK_BOOTARGS_EXTRA` is unaffected. |
|
|
| **item 4** | `kernel/patches/0002-watchdog-enable.patch` | Enables the hardware watchdog DT node -- `&wdt { status = "okay"; };` on the 86Panel board dts. `CONFIG_DW_WATCHDOG` is already built, but `rv1106.dtsi` ships `wdt` `disabled`, so `/dev/watchdog` does not exist until this override. Once present, `warden-flared` pets it only while healthy; a post-boot hang then hard-resets and converges to `altbootcmd` -> recovery, the backstop to bootcount (section 6.7). Needs a `boot.img` reflash. |
|
|
|
|
Items **2** (provision recovery env at flash time), **5** (recovery partition +
|
|
image) and **6** (`CONFIG_ENV_OFFSET_REDUND`) are *not* build-time source
|
|
changes: item 2 is a provisioning-step env write (see `tools/envf.py` and the
|
|
flash scripts), item 5 is a partition-table + recovery-FIT change scheduled with
|
|
a hardware-validation pass, and item 6 is a hardening nice-to-have. They are
|
|
tracked where they live, not here.
|
|
|
|
**Apply-order note.** `kernel/patches/0002-watchdog-enable.patch` and the
|
|
existing `kernel/patches/0001-panel-mcu-reset-and-logo-route.patch` both edit
|
|
the same board dts, but at non-overlapping anchors (0002 inserts after the
|
|
`&gmac` block near the top; 0001 appends `&panel`/`&route_rgb` at the tail), so
|
|
they apply in either order. Verified with `git apply --check` against the
|
|
pristine vendor base and by applying both in sequence.
|
|
|
|
**Precise apply targets** (relative to the SDK root -- the same `-p1` convention
|
|
as every other patch here):
|
|
|
|
- `board/patches/0001-86panel-seatbelt-wiring.patch` -> `project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_86Panel-IPC.mk`
|
|
- `board/patches/0002-build-honor-bootargs-extra.patch` -> `project/build.sh` (function `__GET_BOOTARGS_FROM_BOARD_CFG`)
|
|
- `board/patches/0003-build-fix-rkvar-grep-quote.patch` -> `project/build.sh` (functions `unset_env_config_rk`, `unset_board_config_all`)
|
|
- `kernel/patches/0002-watchdog-enable.patch` -> `sysdrv/source/kernel/arch/arm/boot/dts/rv1106g-luckfox-pico-86panel.dts`
|
|
|
|
**`board/patches/0003-build-fix-rkvar-grep-quote.patch`** -- required by item 3.
|
|
`unset_board_config_all()` reset-sources every `RK_*` var out of the board `.mk`s
|
|
with a greedy `grep -oh "^export.*RK_.*="`, whose `.*=` runs to the *last* `=` on
|
|
the line. Once item 3 adds `export RK_BOOTARGS_EXTRA="panic=10"`, that grep yields
|
|
`export RK_BOOTARGS_EXTRA="panic=` -- an unbalanced quote that makes the sourced
|
|
temp file a syntax error and aborts **every** `build.sh` invocation on a clean SDK
|
|
(`unexpected EOF while looking for matching '"'`). The fix narrows both greps
|
|
(here and `unset_env_config_rk`) to the variable **name** only,
|
|
`^export RK_[A-Za-z0-9_]*=`, dropping the value. Without this, a from-scratch
|
|
checkout cannot build the 86Panel firmware at all; the runner's hand-patched SDK
|
|
had masked it (the reproducibility gap `tools/build-firmware.sh` exists to close).
|
|
- `uboot/configs/flare-bootcount.config` is **copied** into
|
|
`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 |
|
|
|
|
### `board/patches/0014-s50usbdevice-unset-role-is-client.patch`
|
|
|
|
0004's S50usbdevice gate read an unset role as router, so a fresh `/userdata`
|
|
never composed the USB gadget and the panel had no `usb0` until its second
|
|
boot (flare-edge#278). 0014 makes unset mean client (0), like every other
|
|
role reader; flare-edge's `tests/guards/run-role-default-tests.sh` pins the
|
|
gate to them. It is a separate patch, not an edit to 0004, because
|
|
`build-firmware.sh` would skip an edited 0004 as inconclusive on an SDK that
|
|
already carries 0004 and 0008.
|
|
|
|
## Config fragments
|
|
|
|
| fragment | why |
|
|
|---|---|
|
|
| `uboot/flare-display.config` | the DRM/panel/PWM symbols the logo path needs |
|
|
| `uboot/flare-verbose.config` | `CONFIG_BOOTSTAGE_PRINTF_TIMESTAMP=y` -- µs timestamps on every line. ~15 chars/line ~ 1.3 ms/line at 115200, so read instrumented timings as an upper bound |
|
|
| `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
|
|
|
|
Instrumented boot, t=0 at the BootROM DDR banner:
|
|
|
|
| milestone | before this work | after |
|
|
|---|---|---|
|
|
| SPL total (self-reported) | 420.6 ms | 153.6 ms |
|
|
| U-Boot logo drawn | 0.866 s | 0.604 s |
|
|
| backlight on (logo visible) | 1.157 s | 0.695 s |
|
|
| kernel handoff | 1.757 s | 1.292 s |
|
|
| userspace colour splash | 4.335 s | 3.87 s |
|
|
|
|
`tools/boot-trace.py` produces this table from a UART capture. It splits U-Boot
|
|
from kernel at the `Starting kernel` line rather than at the kernel banner,
|
|
because with `ignore_loglevel` at 115200 the banner is regularly lost to
|
|
`** N printk messages dropped **`.
|
|
|
|
## Still open
|
|
|
|
- The white logo starts **inverted and fades to correct** in its first instant.
|
|
Believed to be the CH32V003's init still completing when the backlight lands,
|
|
so we see the tail of the driver IC's internal rail ramp; `FLARE_PANEL_SETTLE_MS`
|
|
is currently `250` as a test of that. The cost-free fix, if confirmed, is to
|
|
release `RGB_RES` in SPL (~0.03 s) instead of `board_init()` (~0.21 s) and take
|
|
the settle back toward zero -- that needs an `idblock` flash.
|
|
- No display-driver-IC part number has been identified. The panel is a 4-inch
|
|
720x720 RGB666 module, flex marked `BV-FPC39510A-N-V0`. Note the GT911 on this
|
|
board is the **touch** controller on `i2c3@0x14` and has nothing to do with the
|
|
display path.
|