§9.1 said a hook is where a board-setup step belongs and never said what such a step
costs. It runs on every board on every update, so "already done" is the normal case and
the price is paid on every future release rather than once — and the hook phase gains a
step per feature while the budget does not move. The budgets, now written down: 600s for
pre-install, which is `UPDATE_MAX_SILENCE_SECONDS` and therefore a contract with every
client rather than a private figure, and 120s for post-install, shared with the units, the
accounts and the restart.
Three of the four scripts already obeyed this and said so one comment at a time.
`setup-npu.sh` stamps the runtime version and compares it; `setup-gstreamer.sh` compares a
stamp and two `dpkg -s`; `setup-npu.sh` also skips the whole overlay path when a driver is
already bound, so a re-run does not touch /boot at all. The corollary states the shape
those three arrived at independently.
`setup-rkaiq.sh` did not: it ran `gcc -shared -fPIC -O2` on every update, on every board,
for ever. It now keeps the built source at /usr/local/lib/rkaiq-modinfo-shim.c the way
`setup-npu.sh` keeps its `.dts`, and rebuilds when that copy no longer matches — so a
release that changes the C file still gets a new shim, and one that does not pays a `cmp`.
**Keyed on the source and not on the kernel, which the shim's own header argued against.**
It said the object is built on the board because "the struct size it probes for is a
property of the running kernel, so a binary built anywhere else would be guessing". The
size is a property of the running kernel, but `probe_kernel_req` brute-forces it at
*runtime* on the first intercepted ioctl and caches it in a static; the includes are
libc's. The object is aarch64 and nothing more. Corrected there, because that sentence is
exactly what stops the next person adding this gate.
The python pass over the IQ file stays unconditional. It is one interpreter start against
a file that is already correct, it prints which of the two cases it found, and gating it
would cost more in machinery than it saves.
Assisted-by: Claude:claude-opus-5