Repository navigation
tools: board inputs for a second Pixel SoC in boards.py, mkadt.py, mkpayload.py (split plan #3, A3) - #5
Draft
flo071 wants to merge 4 commits into
Draft
tools: board inputs for a second Pixel SoC in boards.py, mkadt.py, mkpayload.py (split plan #3, A3)#5flo071 wants to merge 4 commits into
flo071 wants to merge 4 commits into
Conversation
A SoC opts into the shim board hooks (shim/soc_hooks.h, next commit) with "shim_hooks": true in its soc.json. boards.py then emits `#define SOC_SHIM_HOOKS 1` into board_config.h, after the SOC_* family macros, and `--get shim_hooks` prints 1 (else 0) for shim/build.sh. The key is refused in a board.json and when it is not a JSON boolean. No SoC sets it, so every generated header is unchanged (bluejay's board_config.h compared byte for byte). Test: tools/test_boards_shim_hooks.py (trunk headers carry no macro; a copied tree without the key renders identical headers; opting gs101 in adds exactly one line; false == absent; non-bool and board.json values refused, also through the CLI). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shim/soc_hooks.h declares the points where the shared flow hands over to SoC code, with the rules for them (read-only unless audited, bounded waits, no hook on the stop path): soc_hook_entry (top of the probe, may ask for the USB live log early), soc_hook_video / soc_hook_console (around con_set_video), soc_hook_pstore_fallback (pstore_init found no zone), soc_hook_probes (after checkpoint 1), soc_hook_pre_xnu (first step of --boot-xnu), and in the loader soc_hook_payload, soc_hook_bootflags, soc_hook_before_jump. The loader ones are SOC_HOOK_* macros that expand to the replaced code without hooks and sit on existing lines, so loader.c keeps its line numbers (SHIM_ASSERT __LINE__). Every call site is under `#if SOC_SHIM_HOOKS`, a capability flag from tools/boards.py (soc.json "shim_hooks"), never a SoC name. The probe flow (bluejay_probe, try_write32, the exception skip) now builds for SHIM_PROBE = SOC_GS101 || SOC_SHIM_HOOKS, identical to SOC_GS101 on gs101; its gs101-only steps keep SOC_GS101 guards (DECON re-arm, PMU CPU prep; REBOOT_BL is an #error elsewhere) and reset()/shim_halt() take a PSCI-only branch on a hook SoC instead of sweet's Qualcomm words. build.sh compiles and links soc/<vendor>/<soc>/shim/soc_hooks.c only when `boards.py --get shim_hooks` is 1 (also in the ABS64 list), and its host-test block compiles shim.c/loader.c for a non-gs101 hook SoC into $O/hookcheck and checks every always-built hook is referenced, because no SoC on trunk sets the key. Inert on trunk: bluejay objects, shim.elf and Image are byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New board inputs for a second Pixel SoC, inert for every trunk board: - board.json pstore_base / pstore_size / pstore_console_size (all three or none; page-aligned base, console zone inside the window) emit PSTORE_BASE, PSTORE_SIZE, PSTORE_CONSOLE_SIZE into board_config.h, for the fixed ramoops zone soc_hook_pstore_fallback (shim/soc_hooks.h) uses before the FDT is parsed. No trunk board sets them, so no header changes. - device_name(board): board.json "name", for the ADT's About > Model Name. - soc_flag(board, key): the shim_hooks rules (soc.json only, JSON boolean, absent = false) for any SoC opt-in flag; shim_hooks() now calls it. Used by mkadt.py (adt_hooks). - wlan_seq.h names the SoC's own table in its first line; the gs101 text is unchanged. tools/test_boards_board_inputs.py covers each on a private copy of the JSON. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mkadt.py, every change a board/soc table input; bluejay and sweet trees are byte-identical: - root model-number = the board codename, /product product-description = board.json "name" (sweet keeps main's 'bluejay' / 'Pixel 6a'). - /sweet-ufs reg size = soc.json ufs_map_size when set (else ufs_size). - /sweet-wlan compatible from SWEET_WLAN_COMPAT, one row per SoC (gs101's string unchanged); a SoC without a row gets neither /sweet-wlan nor the launchd /wlan node (wlan_node_default; same result as board != 'sweet' on trunk). - board.json artwork_display_gamut (sRGB|P3, env PIXOS_ADT_GAMUT overrides) replaces the D22AP /product artwork-display-gamut. - board.json adt_d22ap_backlight: true copies the D22AP /backlight node (without function-* properties) after build(). - soc.json adt_hooks: true loads tools/mkadt_<soc>.py: add_nodes() after build(), optional product_required() before it (--allow-no-product). mkpayload.py: - --board takes every board of tools/boards.py. - the ADT RAM range may span physically adjacent dram_banks (banks_cover), asked only after the single-bank check failed. No trunk SoC or board sets any of the new keys. Tests: tools/test_mkadt_board_inputs.py, tools/test_mkpayload_board_inputs.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #4 (A2). Review only the last two commits until #4 is merged; I will rebase this onto
mainthen.What and why
Step A3 of the cheetah (Pixel 7 Pro, gs201) split agreed in #3: the shared host tools learn the inputs a second Pixel SoC
needs, each one a board/soc table key or a per-SoC table row, never a board name. No SoC or board on
mainsets any of thenew keys, so every bluejay output is unchanged (proof below).
Stacked on #4 (A2):
soc_flaggeneralises A2'sshim_hookscheck. Until #4 lands, the diff againstmainincludes A2's twocommits; this PR's own changes are the last two commits (6 files).
What changed
tools/boards.pysoc_flag(board, key): A2'sshim_hooksrules (soc.json only, JSON boolean, absent = false) for any SoC opt-in;shim_hooks()now calls it. Used below foradt_hooks.pstore_base/pstore_size/pstore_console_size(all three or none, page-aligned base, consolezone inside the window) ->
PSTORE_BASE/PSTORE_SIZE/PSTORE_CONSOLE_SIZEinboard_config.h, for the fixedramoops zone
soc_hook_pstore_fallback(A2) uses before the FDT is parsed.device_name(board)= board.jsonname.wlan_seq.hnames its SoC's table in its first line (the gs101 text is unchanged).tools/mkadt.pymodel-number= the board codename and/product product-description= board.jsonname(sweet keeps main'sbluejay/Pixel 6a, as before)./sweet-ufsreg size = soc.jsonufs_map_sizewhen set (gs201's UFS HCI window is larger thanufs_size), elseufs_size./sweet-wlancompatible fromSWEET_WLAN_COMPAT, one row per SoC (gs101's row = the string main hard-codes); a SoC without arow gets no
/sweet-wlanand no launchd/wlannode. Onmainthat gives the same result asboard != 'sweet'.artwork_display_gamut(sRGB|P3; envPIXOS_ADT_GAMUToverrides one build) replaces the D22AP/product artwork-display-gamut. [guess, cheetah runs 2026-11-28] MobileGestalt derives HasExtendedColorDisplay from it,and the 10-bit surfaces that follows from
P3stay empty on a port whose GPU path does not render them.adt_d22ap_backlight: truecopies the D22AP/backlightnode (without itsfunction-*properties) afterbuild(), like/sweet-wdt; backboardd looks it up for the brightness slider.adt_hooks: trueloadstools/mkadt_<soc>.py:add_nodes(root, board, qemu)afterbuild()and, if present,product_required(...)before it (new flag--allow-no-product). The gs201 module comes with the board.tools/mkpayload.py--boardtakes every board oftools/boards.py(wassweet,bluejay).dram_banks(banks_cover); asked only after the single-bank check failed.Not in this PR (listed per file in the split inventory, available on request):
mkpayload.py --gpufw(the Mali CSFfirmware as
/chosen/memory-map GPUFW) goes with the GPU PR, becausetools/lint-consumedrightly fails a packed tag that nokernel code reads yet (its consumer is the GPU patch); the gs201 pins in
boards.py(ACPM,S2MPG13, DVFS201, GPU) go with their board PRs together with their soc.json blocks and citations;
tools/gen_wlan_seq.py's--sochook goes with the gs201 Wi-Fi generator (the file is at its size cap, and the hook is useless without thatgenerator); the
USB_BASEmacro is a follow-up of its own (gs101's soc.json already hasusb_base, so emitting it changesbluejay's
board_config.h);tools/mklogo.pygoes with theBOOT_LOGObuild option that calls it.Hardware evidence
Not tested on hardware: no bluejay output changes, and no board uses the new inputs yet.
Bluejay (Pixel 6a) impact
Shared tools changed; every bluejay output is unchanged (observed, build host, 2026-12-04).
Host tools (
a3-host-compare.sh): the origin/main copy oftools/,soc/,device/(b5baf08) and this branch eachproduce, for
bluejayandsweet: the ADT (mkadt.pyplain,--qemu,--highmem,--no-ufs,--no-wlan-node,--no-bt-node,--cpu-order 0,6,7,4,5,1,2,3) with its stdout/stderr,board_config.h, bluejay'swlan_seq.h, and the payload(
mkpayload.pyplain,--ramdisk, from the--highmemADT) from one kernel. mkadt's/chosen random-seedcomes fromos.urandom, so both sides run through a wrapper that returns zero bytes. Result: 58 of 58 files identical; the PR'smkpayload also packs main's bluejay ADT to the same bytes.
(same value from main and from the PR; any kernel with the 0176/0320 boot-line tag serves, this one has sha256 741d2e5086d7b297...)
Shim build (
a3-shim-compare.sh, A2's method):tools/pix build bluejayof cleanorigin/main(b5baf08), then of the sameHEAD with this branch's diff against main applied uncommitted (A2 + A3), so both embed build id
b5baf08. All 48 objects,shim.elf,Image,Image.lz4,board_config.handwlan_seq.hare identical;ramdisk.binand the two boot imagesdiffer as between any two builds of
main(the placeholder ramdisk's cpio carries an inode and mtime, see #4), and re-packedwith one fixed ramdisk they are identical. This PR changes no C file, so the
__LINE__ = 0pair of #4 is not repeated.(the same values as in #4.)
Tests and gate
New, each on a private copy of the device/soc JSON (nothing of the checkout is written), no skips:
tools/test_boards_board_inputs.py(6): no trunk header hasPSTORE_*; the window adds exactly three lines beforeBOARD_MPIDR_0; partial, oversized-console, unaligned and zero windows are refused;device_name;soc_flagforshim_hooksandadt_hooks(false on trunk, true only for the opted-in SoC, non-boolean and board.jsonrefused);
wlan_seq.hsource line.tools/test_mkadt_board_inputs.py(7): identity from a made-up boardtestphone(bluejay and sweet unchanged),display_gamut(board key, env override, refusals),ufs_map_size, the/sweet-wlantable (a SoC without a row getsneither node), the
/backlightcopy from a stand-in D22AP tree (nofunction-*, fresh phandle, nothing on trunk/qemu),and
adt_hooksend to end through the CLI (module not loaded without the key;product_requiredrefuses without--allow-no-product;add_nodesadds its node).tools/test_mkpayload_board_inputs.py(4):banks_cover(adjacent banks, gaps, overruns),--boardchoices = theboards, and end to end: bluejay's high range listed as two adjacent 2 GiB banks gives the same payload as the merged bank,
with a hole between them the build is refused.
Existing mkadt/mkpayload tests (
test_mkadt_*,test_mkpayload_*,test_mkwlancred.py,test_boards_shim_hooks.py) pass.tools/lint-c --style --base origin/main:RESULT: PASS style new=0 baseline=1468(no C change).tools/lint-size --base origin/main: PASS (the one warning is A2'sshim/shim.c, port code)..github/scripts/pr_rules.py --profile kernel origin/main HEAD:RESULT: PASS 12 files, 0 rule(s) failed(
split/a2-board-hooks HEAD: 6 files, PASS).tools/check-all.sh: on the final head (observed, build host, 2026-12-04;LINT_STYLE_BASE=origin/main GATE_JOBS=2 GATE_STEP_TIMEOUT=2400 --keep-going, the same knobs and reasons as in shim: board hooks (soc_hooks.h), opt-in per SoC (split plan #3, A2) #4):GATE FAIL 879523b unit failed: test_devd_mutants.py, test_safety_xrun.py, test_adversary_matrix.py +22 more.Every other step passes (all 12 build variants, host-tests, boot-safety, wlan-mutants, validate, rules, public-guard,
public-split, shellcheck, lint-c, xnu-build, stack-apply, mutant-needles, boot-markers, lint-silent, consumed, inputs), and
the three new test files pass in their shards. The lane-B steps after
unit(wlan-tbl,phone-state,hang-recover,probe-run,phone-converge,rootless) are skipped by--keep-goingonceunitfails in that lane, as in shim: board hooks (soc_hooks.h), opt-in per SoC (split plan #3, A2) #4. NoGATE PASSon this host. The unit failures are exactly shim: board hooks (soc_hooks.h), opt-in per SoC (split plan #3, A2) #4's set: 14failing files + 11 skips not pinned in
tools/unit-skip-allow.txt(4 files) + theCOUNT MISMATCH(2399 collected vs 2394run: the 5 tests of
test_safety_xrun.py). Each file run standalone onorigin/main(b5baf08) and on this head gives thesame result on both:
tools/triage-settle-guardunshare -r -nnot permitted (netns)tools/wake/ wake hook heretest_usbroot_hostenvironmentgit rev-parseoutside a repo in its temp dirsunshare -r -n -mnot permittedtest_guard_refuses_a_root_image_file: this host's standard root image (newest line offlashed-userdata.txt) is a cheetah root without/usr/local/bin/wifid-probe(as in shim: board hooks (soc_hooks.h), opt-in per SoC (split plan #3, A2) #4)None of these files or the code they test is touched by this PR. A first gate run on an earlier version of this branch
failed
consumed(GPUFW packed by--gpufwwith no consumer yet); that is why--gpufwmoved to the GPU PR.Size: 6 files, +520 / -23 lines (387 of the added lines are the three tests).
Safety checklist
userdata; no new UFS write path in the shimtools/check-all.shprintsGATE PASS(not on this host: only the unit step fails, every failure listed above and the same onmain)xnu/patches/untouched; changes come as new numbered patches (no patch touched)a3-host-compare.sh, fixed-seed-run.py, a3-shim-compare.sh
🤖 Generated with Claude Code