pmb887x-emu-web/site-src/recalc
Konstantin Pereiaslov 06e5c4a96a Rebase the Siemens toolchain on upstream: pmb887x-emu master, bsp master + PR#6
Upstream moved everything the page did with a fork of its own: the
recalculation code that was src/siemens_recalc.cpp is a library now
(src/siemens, "siemensfw", namespace SiemensFW), and device detection
lives in it (probeFullflash). This drops our copies of both and builds
on the library, the way the emulator itself does. (Re-commit after the
.git loss; the tree is the same work as before, rebased around round
twenty-nine — the qemu pin it bumped is kept.)

  pmb887x-emu  4f2ac1d -> 4ba4a58 (master). Not built from — qemu still
              comes from the root submodule — but the page's Siemens
              module is compiled out of this tree now.
  bsp         21fdacb -> 23fc945 (master: END_CALL on SGOLD, WHBABCON
              flags) + e6e73d1 (PR#6, LG [rtc] format = "calendar",
              still unmerged upstream). The pin is (master, fix) and
              sync-bsp.sh does the merge itself, so a fresh clone
              reproduces it — the old pin was a merge commit that
              existed only in the local checkout.

The wasm module (scripts/build-recalc-wasm.sh) now compiles the library
sources + glue instead of #including one cpp: probeFullflash (sr_probe),
getFullflashInfo (sr_read_identity), recalculateFullflash (sr_recalc),
calculateBkeyAndHash (sr_verify), and a re-expressed ESN sweep (sr_scan)
over the library's batched MD5 — the same message layout its own
recoverEsn() BKEY/HASH method hashes, minus the std::thread pool a
browser cannot host. 561 KB wasm (the library's own iostream-based
probe and spdlog are the bulk; toml++/filesystem dead-code-eliminate),
~25 M candidates/s per core against the old ~10 M. The spdlog output is
captured into the log buffer the page shows on a failed recalc.

Device detection (site/fullflashes.js) is the library's for Siemens
phones — vendor at four offsets, SIEMENS and BENQ-SIEMENS, board name
"siemens-" + lowercase(model), all upstream's code through
site/siemensfw.js — with the stand-in table and the filename rules as
fallbacks for models without a board. The JS keeps only what the
library cannot do: the CJKT gate and the LG J2ME user-agent scan. The
bootcore-block reading is gone: if upstream's probe cannot place an
image, walking the boot area in JS was re-guessing what upstream
decided not to read.

Verified against every dump in fullflashes/: old/new module parity is
byte-identical on all four Siemens images (identity, recalc output at
two ESNs, verify, scan); recalc-check 13/13 on S75 and on CX70 (a real
phone's dump — its 67 non-canonical bytes are pre-existing, identical
under the old module, and the tool now checks the idempotence of their
canonicalization instead of a byte-restore that never held for it);
detect-check 8/8 and detect-web 9/9 including the S66 stand-in and the
KE800 LG scan; keysboot PASS in all three Siemens-keys modes, including
a full 2^32 browser sweep on the foreign-ESN image (found deadbeef at
84 %); bootcheck ke800 PASS on the new bsp.
2026-09-17 07:47:30 +00:00
..
recalc_wasm.cpp Rebase the Siemens toolchain on upstream: pmb887x-emu master, bsp master + PR#6 2026-09-17 07:47:30 +00:00