build: bsp is a submodule, pinned by its gitlink

The board configs came from build/bsp, a clone sync-bsp.sh checked out at
PMB887X_BSP_REV in versions.env. They now come from the new top-level
bsp/ submodule (Azq2/pmb887x-dev, branch master), at the same commit,
191612cab6, which pmb887x-emu/bsp also pins.

- sync-bsp.sh checks bsp/ out the first time and otherwise uses it as it
  is, with one warning line when it is off its gitlink. It never patched
  or generated anything, so nothing is written into the submodule.
- build-dirs.sh's BSP_DIR defaults to bsp/; run-native.sh takes it from
  there (and so tests/run.mjs and the lockstep tools, which boot through
  it), as do pack-boards.sh and tools/gprscheck.mjs.
- build-release.sh requires bsp/ on its gitlink and clean, as qemu/.
- PMB887X_BSP_REPO and PMB887X_BSP_REV are gone from versions.env.

boards.tar packed from bsp/ has the same files, contents, modes and
owners as the one packed from build/bsp; only the tar headers' mtimes and
the entry order differ, which follow each checkout. build/bsp is no
longer read and is left on disk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xda8d7rfJjkFSmKVQtcBGh
This commit is contained in:
Konstantin Pereiaslov 2026-11-14 10:02:17 -06:00
parent 3221c8d0dc
commit b32cafda44
16 changed files with 46 additions and 49 deletions

4
.gitmodules vendored
View file

@ -6,3 +6,7 @@
path = qemu
url = https://github.com/Azq2/qemu-pmb887x
branch = wasm-browser-port
[submodule "bsp"]
path = bsp
url = https://github.com/Azq2/pmb887x-dev
branch = master

View file

@ -207,6 +207,9 @@ cover.
the source of the siemensfw library the page compiles
for key recalculation, ESN recovery and Siemens
device detection (scripts/build-recalc-wasm.sh)
bsp/ git submodule: Azq2/pmb887x-dev @ master, the
board configs (lib/data/board) that boards.tar,
run-native.sh and the native tests boot with
build.sh one-shot WASM build (toolchain → deps → qemu →
site/dist-jit)
serve.mjs static server for the WASM page (COOP/COEP); serves
@ -221,8 +224,8 @@ cover.
qemu out at the pinned rev, sync bsp/boards/siemensfw
and build the wasm dist (wasm64 backend →
site/dist-jit/)
sync-bsp.sh bsp checkout @ pin → build/bsp
pack-boards.sh build/bsp board configs → site/dist/boards.tar (run by
sync-bsp.sh checks the bsp/ submodule out the first time
pack-boards.sh bsp/ board configs → site/dist/boards.tar (run by
every deploy path)
build-recalc-wasm.sh pmb887x-emu's siemensfw library (src/siemens) +
the page's glue (site-src/recalc) →

1
bsp Submodule

@ -0,0 +1 @@
Subproject commit 191612cab6ccc37fe91acdee3302e5b537dc6e2d

View file

@ -151,7 +151,7 @@ thread is using them).
the filename first (`DEVICE_RULES`), then the image itself, so a dump named
`dump.bin` still selects its board:
- `0x3C` `"CJKT"` — every pmb887x NOR dump, LG included
(`build/bsp/boot/fakesign.py`). Separates "not a fullflash" from
(`bsp/boot/fakesign.py`). Separates "not a fullflash" from
"a fullflash I can't identify".
- Siemens phones are the library's business: `probeFullflash()` in
pmb887x-emu's siemensfw (`src/siemens`), whose browser build the page

View file

@ -198,7 +198,7 @@ Probes and traces:
## Native reference runs
```
env PMB887X_BOARD=build/bsp/lib/data/board/siemens-s75.toml \
env PMB887X_BOARD=bsp/lib/data/board/siemens-s75.toml \
PMB887X_STARTUP=ONLINE \
PMB887X_FLASH0_OTP0=02004AB3C31100000000 PMB887X_FLASH0_OTP1=000094104502237315FF \
build/qemu-native-build/qemu-system-arm -display none -icount shift=3,sleep=off -machine pmb887x \

View file

@ -428,7 +428,7 @@ always revert with `git apply -R`.
- **Old dists** can hang silently under the current scenebench (empty logs).
Rebuild the old commit into a fresh dist instead.
- **Board configs:** `site/dist/boards.tar` is shared by every dist and
repacked from `build/bsp` on every ninja-fast deploy. A dist that needs
repacked from `bsp/` on every ninja-fast deploy. A dist that needs
another BSP must be served from a second site root
(`WEB_SITE_DIR=<root> PORT=8081 node serve.mjs`, then
`PORT_B=8081 tools/perf/swab.sh ...`).

View file

@ -2,11 +2,11 @@
# one setting moves them all:
# WEB_BUILD the build tree (default build/ in the repository)
# WASM_DEPS the emsdk + wasm64 dependency stack (default $WEB_BUILD/deps)
# PMB887X_BSP_DIR the bsp checkout (default $WEB_BUILD/bsp)
# PMB887X_BSP_DIR the bsp checkout (default the bsp/ submodule)
# Expects WEB_DIR, the repository root.
BUILD="${WEB_BUILD:-$WEB_DIR/build}"
DEPS_ROOT="${WASM_DEPS:-$BUILD/deps}"
BSP_DIR="${PMB887X_BSP_DIR:-$BUILD/bsp}"
BSP_DIR="${PMB887X_BSP_DIR:-$WEB_DIR/bsp}"
# the pinned emsdk's environment, quietly, or what to run to get it
use_emsdk() {

View file

@ -78,6 +78,6 @@ if [ "$MODE" = tci ]; then
echo "=== native TCI qemu ready (plugins on): $BUILD/qemu-system-arm (qemu $ID) ==="
else
echo "=== native qemu ready: $BUILD/qemu-system-arm (qemu $ID) ==="
echo "board configs: bash scripts/sync-bsp.sh (build/bsp)"
echo "board configs: bash scripts/sync-bsp.sh (the bsp/ submodule)"
echo "run: scripts/run-native.sh fullflashes/<device>.bin"
fi

View file

@ -32,7 +32,7 @@ for sub in qemu pmb887x-emu; do
submodule_warn_off_pin "$sub"
done
# --- board configs from bsp (pinned rev) ---
# --- board configs from the bsp/ submodule ---
bash "$WEB_DIR/scripts/sync-bsp.sh"
bash "$WEB_DIR/scripts/pack-boards.sh"

View file

@ -4,11 +4,10 @@
#
# What "latest code" means here: the superproject's HEAD is the source of
# truth —
# - qemu/ and pmb887x-emu/ must sit exactly on their gitlinks with no
# - qemu/, bsp/ and pmb887x-emu/ must sit exactly on their gitlinks with no
# local changes, or the release stops (it never moves or cleans a
# checkout: an edited file must not leak into a release artifact, and
# a commit not yet in a gitlink must not either)
# - bsp is re-synced at the pin (sync-bsp.sh, idempotent)
# - build/qemu-wasm64 is wiped, so no ninja object
# from an earlier tree can survive into the artifacts
# The pinned toolchain/deps (build/deps: emsdk + glib/pixman/zlib/libffi)
@ -30,13 +29,13 @@ source scripts/submodules.sh
note() { echo "build-release: $*"; }
# ---- 1. qemu source = the gitlink, exactly ----------------------------
# ---- 1. sources = the gitlinks, exactly --------------------------------
# (only pmb887x-emu's own top level, not its nested qemu)
for sub in qemu pmb887x-emu; do
for sub in qemu bsp pmb887x-emu; do
submodule_require_pin "$sub"
done
note "qemu @ $(git -C qemu rev-parse --short HEAD) (the gitlink)"
note "qemu @ $(git -C qemu rev-parse --short HEAD), bsp @ $(git -C bsp rev-parse --short HEAD) (the gitlinks)"
# ---- 2. wipe the qemu build dirs (toolchain/deps stay) ------------------

View file

@ -29,7 +29,9 @@ set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
QEMU="${QEMU_BIN:-$ROOT/build/qemu-native-build/qemu-system-arm}"
BOARDS="${BOARDS_DIR:-$ROOT/build/bsp/lib/data/board}"
WEB_DIR="$ROOT"
source "$ROOT/scripts/build-dirs.sh"
BOARDS="${BOARDS_DIR:-$BSP_DIR/lib/data/board}"
[ -x "$QEMU" ] || { echo "qemu-system-arm not built — see scripts/build-native.sh" >&2; exit 1; }
[ -n "${1:-}" ] || { echo "usage: $0 <fullflash.bin> [extra qemu args...]" >&2; exit 1; }

View file

@ -1,34 +1,25 @@
#!/bin/bash
# Check out the pinned pmb887x-dev (BSP) revision into build/bsp.
# The board configs come from the bsp/ submodule (pmb887x-dev), pinned by its
# gitlink. This checks it out the first time; after that the checkout is
# used as it is, with one warning line when it is not at its gitlink.
# PMB887X_BSP_DIR (scripts/build-dirs.sh) points the build at another
# checkout instead, which is then used as it is.
#
# There is nothing to patch or merge any more: bsp master absorbed
# everything this script used to carry — the hd155153np RF peripheral is
# commented out at the source (bsp 55752c5, 2026-09-15, which retired the
# old bsp-patches/ dir), and perk11's "board: LG boards read the RTC
# counter as packed calendar fields" (PR#6) landed upstream as e8d490e
# (2026-09-20), which retired PMB887X_BSP_FIX_REV and the merge it used to
# recreate. A plain checkout of PMB887X_BSP_REV is the whole story.
# There is nothing to patch or merge: bsp master absorbed everything this
# script used to carry — the hd155153np RF peripheral is commented out at
# the source (bsp 55752c5, 2026-09-15, which retired the old bsp-patches/
# dir), and perk11's "board: LG boards read the RTC counter as packed
# calendar fields" (PR#6) landed upstream as e8d490e (2026-09-20), which
# retired PMB887X_BSP_FIX_REV and the merge it used to recreate.
set -euo pipefail
WEB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$WEB_DIR/versions.env"
source "$WEB_DIR/scripts/build-dirs.sh"
source "$WEB_DIR/scripts/submodules.sh"
BSP="$BSP_DIR"
if [ ! -d "$BSP/.git" ]; then
git clone "$PMB887X_BSP_REPO" "$BSP"
if [ "$BSP_DIR" = "$WEB_DIR/bsp" ]; then
submodule_init bsp
submodule_warn_off_pin bsp
fi
(
cd "$BSP"
git fetch --all --quiet 2>/dev/null || true
# The checkout is left alone while it already sits on the pin —
# rebuilding it from scratch on every run would churn for nothing.
if [ "$(git rev-parse HEAD)" != "$PMB887X_BSP_REV" ]; then
git checkout -q -f -B bsp "$PMB887X_BSP_REV"
fi
git checkout -q -f -- . 2>/dev/null || true
)
echo "bsp ready: $BSP @ $PMB887X_BSP_REV"
echo "bsp ready: $BSP_DIR @ $(git -C "$BSP_DIR" rev-parse --short HEAD)"

View file

@ -23,7 +23,7 @@ The lockstep harness is documented below.
```bash
scripts/build-native.sh # build/qemu-native-build/qemu-system-arm
bash scripts/sync-bsp.sh # build/bsp @ pinned rev
bash scripts/sync-bsp.sh # the bsp/ submodule, at its gitlink
node tests/run.mjs # ~1 min (see defaults below)
node tests/run.mjs --label after --timeout 150 --bench-secs 45

View file

@ -18,7 +18,7 @@
// [--keep] (keep run dirs under /tmp)
//
// Env: QEMU_BIN + BOARDS_DIR are forwarded to run-native.sh (defaults:
// build/qemu-native-build + build/bsp of this workspace).
// build/qemu-native-build + the bsp/ submodule of this workspace).
//
// Screenshots: the first LCD-content screendump (boot-progress proof) and
// the final screendump are saved per flash to

View file

@ -71,7 +71,7 @@ const log = (s) => console.log(`[gprs] t=${((Date.now() - t0) / 1000).toFixed(0)
// serial() and close(). Key names are HMP's.
async function nativeBackend() {
const QEMU = process.env.QEMU_BIN || path.join(ROOT, "build", "qemu-native-build", "qemu-system-arm");
const BOARDS = process.env.BOARDS_DIR || path.join(ROOT, "build", "bsp", "lib", "data", "board");
const BOARDS = process.env.BOARDS_DIR || path.join(ROOT, "bsp", "lib", "data", "board");
if (!/^user$/m.test(spawnSync(QEMU, ["-machine", "pmb887x", "-netdev", "help"], { encoding: "utf8" }).stdout ?? ""))
throw new Error(`${QEMU} has no slirp (-netdev user): install libslirp-dev, rebuild with scripts/build-native.sh`);

View file

@ -1,10 +1,7 @@
# Pins for the qemu-pmb887x builds, sourced by scripts/build-deps.sh,
# build-qemu.sh, build-release.sh and sync-bsp.sh. What each pin moved to
# and why is in doc/version-pins.md. qemu is pinned by the qemu/ gitlink.
# board configs (boards.tar); must match the generated tables in that qemu
export PMB887X_BSP_REPO="https://github.com/Azq2/pmb887x-dev"
export PMB887X_BSP_REV="191612cab6ccc37fe91acdee3302e5b537dc6e2d"
# build-qemu.sh and build-release.sh. What each pin moved to
# and why is in doc/version-pins.md. qemu and bsp are pinned by their
# submodules' gitlinks.
# Toolchain versions (mirror qemu's tests/docker/dockerfiles/emsdk-wasm64-cross.docker)
export EMSDK_VERSION="4.0.10"