diff --git a/device/flame/ABL-PLAN.md b/device/flame/ABL-PLAN.md new file mode 100644 index 000000000..88e624ee4 --- /dev/null +++ b/device/flame/ABL-PLAN.md @@ -0,0 +1,47 @@ + +# flame: direct ABL candidate, not a verified boot path + +Status: 2026-10-26, host assessment only. The measured Pixel 4 installation +still uses U-Boot. The Pixel 4 XL report in +[PR #52](https://github.com/derekross/omarchy-mobile/pull/52), +[BRINGUP-M1 at c0375d7](https://github.com/HemangKumawat/omarchy-mobile/blob/c0375d71e70bbba6a94c7901caa6bc01d3c8ed08/device/coral/BRINGUP-M1.md), +is a candidate recipe for the shared `c2f2-0.5-8906123` bootloader family. +Derek's [review](https://github.com/derekross/omarchy-mobile/pull/52#issuecomment-6428244248) +asks for the missing source branches and slot evidence. Its hardware results +have not been reproduced on flame and do not change flame's device matrix. + +## Source and image gates + +| Reported ABL requirement | Flame evidence / next gate | +| --- | --- | +| ARM64 Image `text_offset=0x80000` | The retained `7.0.0-sm8150` flame Image has `text_offset=0x0` (read-only host header inspection). Build a published, pinned GPL kernel branch with the reviewed `head.S` change; validate the built header. The current input does not pass this gate. | +| Modern LZ4 frame, magic `04 22 4d 18` | Build from that kernel's uncompressed Image with modern frame compression, then decompress and compare. The gzip payload used by U-Boot is not this ABL input. | +| Two base DTBs with `qcom,msm-id` revisions `<339 0x20000>` and `<339 0x20001>`, `qcom,board-id=<0 0>`, and symbols | Use the public flame DTS and its panel/touch configuration. Publish any source change in the kernel repository; validate both generated DTBs and retain their source pins. Coral's panel/board DTB is not a flame input. | +| Matched no-op `dtbo` entries | Derive count, IDs and revisions from the owner's own flame factory image and retain them privately. The coral MP1.0/index-11 values are evidence for coral only. Review a flame-specific guarded boot/dtbo path before any slot-B write. | + +The recipe needs Android header v2 with base `0`, page size `4096`, +kernel offset `0x8000`, ramdisk offset `0x01000000`, tags offset `0x100`, +and DTB offset `0x01f00000`. These values are a reported candidate, not a +flame boot test. The native U-Boot payload instead uses its standard +sentinel base `0x10000000`; the two images must never be interchanged. +Keep image roles and hashes separate. + +## Hardware gates after source and host validation + +Each step requires the owner's approval, current verified private backups, +physical Android Fastboot access, PID 1's watchdog, external logs and a fresh +independent RAM recovery login. This handset has no bootable stock A; +**recovery is the buttons alone** to Fastboot, with stock B backups ready. + +| Step | Expect / pass | Stop condition | Rollback | Risk | +| --- | --- | --- | --- | --- | +| Read-only slot/source check | Own boot/dtbo backups; B active; each slot's success/unbootable/retry flags and available bootloader versions recorded privately; source/header/DT checks pass | Missing or ambiguous evidence | Keep the current installation | Low | +| Separately reviewed candidate boot/dtbo stage | Named `boot_b`/`dtbo_b` writes only through a guarded flame-specific tool path, and only after explicit approval | No reviewed path, slot/size/hash mismatch, exhausted/unsuccessful B | Stay in Fastboot with private stock B images retained | High | +| Approved candidate boot | Guard holds; fresh root and RAM rescue logins; watchdog handoff; readable display | Hang, missing USB/control or unexpected write | Buttons to Android Fastboot | Medium | +| Approved normal/battery restarts | Fresh boot, clear UI, Wi-Fi traffic and protected hashes unchanged | Recovery loop, display fault, missing control | Buttons to Android Fastboot | Medium | + +Direct ABL could remove U-Boot and its small-image header-prefix erase. +It does not settle the boot-success policy: writing `boot_b` cleared its +success flag on the measured flame handset. GPT and userdata writes remain +held for the maintainer's named policy decision. No PMIC/PON latch or charger +register mechanism from the coral report is adopted by this assessment. diff --git a/device/flame/BRINGUP-M1.md b/device/flame/BRINGUP-M1.md index 113a3323f..b219e8452 100644 --- a/device/flame/BRINGUP-M1.md +++ b/device/flame/BRINGUP-M1.md @@ -287,3 +287,12 @@ and panic reset have not been exercised on the phone. The provisioning container integration and root-image smoke test were skipped because their test image and a completed Omarchy root image were not present. ShellCheck passed for the new scripts. + +## Separate native-root development path (2026-10-19) + +The default descriptor and first-light tool above remain RAM-only. The explicit +`FLAME_NATIVE=1` profile, runtime package, source-pinned loader build and +separate userdata/boot-B gates are documented in +[native/README.md](native/README.md), with bounded handset results and +host-only publication changes in [native/RESULTS.md](native/RESULTS.md). +This does not establish a release installer or a healthy stock A fallback. diff --git a/device/flame/native/README.md b/device/flame/native/README.md new file mode 100644 index 000000000..9e68a09b6 --- /dev/null +++ b/device/flame/native/README.md @@ -0,0 +1,179 @@ + +# flame: experimental permanent installation + +Status: 2026-10-19, measured on Pixel 4 with Linux `7.0.0-sm8150`. +Native Arch on ext4 `userdata` and a U-Boot loader in `boot_b` passed the +[recorded restart, display and app checks](RESULTS.md). This is an opt-in +contributor workflow, **not a release installer**. The published loader recipe +has additional host-only changes and needs a fresh approved RAM test. + +The ordinary `device/flame/device.conf` remains RAM-only. Only +`DEVICE=flame FLAME_NATIVE=1` selects [native/device.conf (review snapshot)](https://github.com/wirelessjoe/omarchy-mobile/blob/c6ce0c41f58a387f18e4f06a6de1a283698c9500/device/flame/native/device.conf). +The generic `tools/install-phone` still refuses flame. Native `push` and the +Tensor initramfs/image layout are refused; native boot writes go through +`bin/omamobile flash`. Nothing here automatically repairs GPT metadata, +selects a slot, restores calibration, or installs a separate Codex desktop app. + +The runtime package must land before native root/build use. Boot plumbing +and SSH options are separate review components. Links to companion files +pin the original review snapshot while those components land; the basic +recovery procedure below is independent of the held GPT proposal. + +## Prerequisites and source + +Read [proposed BOOT-PLAN](https://github.com/wirelessjoe/omarchy-mobile/blob/c6ce0c41f58a387f18e4f06a6de1a283698c9500/device/flame/BOOT-PLAN.md) and the repository safety rules first. +Obtain the owner's approval for every hardware reboot or write. Keep a current +verified private backup set, matching factory image, physical Fastboot access, +and the exact stock boot/DTBO backups. The tested handset's stock A is +**unbootable**; it is not an available fallback. Restoring Android after this +installation also needs a factory data reset. Never relock the bootloader. + +| Component | Source / role | +| --- | --- | +| U-Boot base | Andrew Gigena's GPL flame tree, `0c42ac323aea8368b0624e405ded403351022df2`, [source](https://gitlab.com/andrewgigena/u-boot/-/commit/0c42ac323aea8368b0624e405ded403351022df2) | +| Display fix and standalone configuration | [GPL source](https://github.com/wirelessjoe/u-boot/tree/e210c6956ce90e48b667eb15a8c6f20bc292b52e), pinned by `tools/build-flame-loader`; includes the missing-rotation/stride correction, overflow fixture and compiled-environment checks | +| Linux inputs | The matching kernel, DTB, watchdog and modules listed in [BRINGUP-M1](../BRINGUP-M1.md); documentary firewall additions remain in [kernel-extra.config](../kernel-extra.config) | +| Native root | `omamobile-device-flame` plus the normal Omarchy Mobile packages; the owner supplies local first-boot configuration and SSH keys | +| Wi-Fi | Separate firmware/NV gates below; no Google firmware or device data is distributed | + +The automatic U-Boot path waits two seconds, scans UFS, resolves GPT +`userdata`, reads `/boot/omamobile/boot.img` through ext4 and runs `bootm`. +Healthy boots do not wait for USB. Failure enters download-only Fastboot. +The new configuration has a volatile environment and removes EFI/FAT writes, +DFU, USB mass-storage and fastboot OEM run facilities. It is not a hardware +storage guard: never issue interactive U-Boot storage-write commands. + +## Build on the host + +The loader tool needs a Linux environment with an aarch64 GCC cross compiler, +make, dtc, flex, bison, OpenSSL/UUID development headers and Python 3. Supply +AOSP `mkbootimg.py` together with its `gki/` helpers. It does not use the phone. + +```sh +git clone https://github.com/wirelessjoe/u-boot /path/to/u-boot +cd /path/to/u-boot +git checkout e210c6956ce90e48b667eb15a8c6f20bc292b52e +cd /path/to/omarchy-mobile +tools/build-flame-loader --uboot /path/to/u-boot \ + --mkbootimg /path/to/mkbootimg.py --out /private/output/loader +``` + +Build the native Linux payload with `tools/build-flame-system`, using the +same input flags as `tools/build-flame-probe`. Use a fresh output directory. +It verifies Pixel 4/SM8150, ARM64 Image magic and watchdog vermagic. The +native init has a separate initial allowlist of `boot_b userdata`; it never +clears read-only flags or recreates `/dev/sda`. All other UFS nodes remain +protected through the handoff to Arch. + +The default native payload disables all remote processors. `--wifi` enables +only `/soc@0/remoteproc@4080000` after checking that its compatible is +`qcom,sm8150-mpss-pas`. It does not supply firmware, start the radio or enable +its service. Keep the other DSPs disabled. The final Android command line +uses `console=tty0` only: a USB console or journal forwarding to ttyGS0 can +stall a restart after unplugging. ACM is available for explicit attached-only +debugging; it is not a standalone boot console. + +`DEVICE=flame FLAME_NATIVE=1 tools/build-rootfs --keep-raw` selects the flame +package and ext4 features compatible with the storage loader. It still needs +the normal signed local package repository and the complete matching modules. +The image has no owner, credentials, SSH host keys or Google firmware. A full +new signed root build is not part of the recorded host validation. + +## Root preparation and the current write boundary + +The native builder selects `omamobile-device-flame`, with first-boot 0.1.3 +and shell 0.2.24 hooks. Keep all images, owner configuration, public keys, +firmware and current backup manifests outside Git. Root image preparation +is host-only; this split does not add a userdata flash command. The proposed +userdata write and GPT transaction await the maintainer's policy decision +in [the original review](https://github.com/derekross/omarchy-mobile/pull/17#issuecomment-6428241495). +The generic installer remains unavailable for flame. + +The loader plumbing accepts only the checked header-v0 loader or a verified +64 MiB stock header-v2 boot B backup. Every Fastboot query/write is pinned to +one selected handset, using current main's `FASTBOOT_SERIAL` selection. A +loader install requires already-active successful B, erases/writes only boot B, +and stops in Fastboot if the success flag is cleared. It never selects a slot +or starts a GPT repair. Do not repeatedly boot an unsuccessful B. + +The native package enables only the storage guard. Its dependencies include +Foot, `xdg-terminal-exec` and `udiskie`. SDDM/user services use the tested +software-rendering fallback. Normal user setup selects 2.5 scale and merges +the tested 0.6 Chrome scale only if Chrome is installed. The helper preserves +other flags and backs up prior files. The upstream AI Agent chooser is used. + +## Rescue SSH and its authority + +The initramfs listener on `172.16.42.1:22` and the RAM rescue listener on +`172.16.42.1:2222` use the **same builder-supplied `key.pub`**, installed as +`/root/.ssh/authorized_keys` in each filesystem. The second listener survives +`switch_root` in a separate RAM root, with the real root bind-mounted +**read-write at `/realroot`**. Its key grants recovery write access to that +root; a separate process is not a separate credential or storage boundary. +The storage guard still protects other partitions. + +The initial rescue listener is IPv4-only. A host using USB IPv6 needs an +explicit USB-only IPv6 RAM listener, a key verified through the trusted Arch +connection and a fresh independently pinned login. Do not assume the root +filesystem's SSH connection proves RAM recovery works. + +The `phone-ssh` options support a known scoped USB endpoint, an explicit key +and a strict known-hosts file. Shared connections retain upstream's +`OMAMOBILE_SSH_SHARE=1`, `--fresh` and `--stop`; use `--fresh` to prove that +USB or firewall changes left a new connection possible. There is no LAN scan. + +## Gates before another hardware test + +These are separate owner-approved operations; the new split is host-tested. +Stock A is unbootable on the measured handset: recovery is **the buttons +alone** to reach Android Fastboot, with the verified stock B backups ready. + +| Gate | Expect / pass | Stop condition | Rollback | Risk | +| --- | --- | --- | --- | --- | +| Offline source/image check | Pinned sources, matching modules, checked image header/hash, clean ext4 and private backup set | Missing provenance or any mismatch | Discard local output | Low | +| Approved temporary boot of reviewed loader/native payload | Correct root, absent whole-disk node, protected partitions RO, PID 1 watchdog, clear UI and fresh root/rescue logins | Wrong root, storage/display fault or lost control | Physical Android Fastboot | Medium | +| Optional guarded Wi-Fi start | Current firmware/NV checks, association, bound HTTPS, hashes unchanged | Firmware/storage error or failed-start marker | Independent RAM recovery timer / physical Fastboot | Medium | +| Approved boot B loader write | One handset selected, exact reviewed bytes, active B; stop on clear success flag | Any identity/write/metadata error | Stay in Fastboot; separately approved stock B restoration | High | +| GPT success / userdata write | **Blocked pending a named maintainer policy exception** | No policy decision | Keep current installation and private backups | High | +| Approved connected/battery restart | New boot, clear UI, fresh SSH, Wi-Fi and protected hashes pass | Loop, unreadable display or missing control | Physical Android Fastboot | Medium | + +Arm a host log stream, PID 1 watchdog and an independent RAM recovery timer +before a risky driver/USB test. Cancel the timer only after a **fresh** RAM +recovery login. Do not use U-Boot or SCSI writes to work around the pending +metadata policy. [Direct ABL boot](../ABL-PLAN.md) is a candidate from the +Pixel 4 XL report, with no flame hardware result yet. + +## Wi-Fi provisioning remains a separate gate + +Ship `flame-wifi.service` disabled. The owner supplies matching `rmtfs` and +`tqftpserv`, modem/WLAN firmware, API metadata, and raw factory +`ath10k/WCN3990/hw1.0/board.bin`. Keep generic `board-2.bin` (including +compressed and update-directory copies) outside every firmware search path: +API 2 takes precedence over the tested raw factory board file. + +Create private manifests at `/etc/omamobile/flame-calibration.sha256` and +`flame-firmware.sha256`. Calibration paths use unique GPT-name links under +`/run/omamobile/flame-partitions`; LUN letters changed in a measured reboot. +Keep current protected NV copies, mode 0600, in root-only +`/var/lib/omamobile/flame/nv` as `modem_fs1`, `modem_fs2`, `modem_fsg`, +`modem_fsc`. Refresh the backup and copies after any stock Android boot. +The helper verifies current real-partition hashes before using RAM shadows; +rmtfs never gets the protected NV block nodes. Preserve its failed-start +marker until logs have been reviewed. Do not retry a failed radio loop or +load the untested UART pin overlay. Bluetooth stays blacklisted. + +## Recovery and limits + +To restore only the verified 64 MiB stock boot B backup, stage it with +`FLAME_BOOT_ROLE=stock-recovery`, `UBOOT_IMAGE`, `UBOOT_SHA256`, `DEVICE=flame` +and `FLAME_NATIVE=1`. The flash tool writes only boot B and stays in Android +Fastboot. Restoring Android requires the matching factory data-reset path; +this loses native userdata. Never restore calibration as a routine rollback. +This stock restore role has mock coverage; the full post-native Android +restore/factory-reset cycle has not been performed on the handset. + +Hardware acceleration, Bluetooth pairing, modem calls, audio/camera and +release-quality power management are not established by these tests. Large +USB output still needs small verified transfers. The original spontaneous +runtime-reset cause remains unresolved. Read [RESULTS](RESULTS.md) before +interpreting the successful restart tests as general reliability evidence. diff --git a/device/flame/native/RESULTS.md b/device/flame/native/RESULTS.md new file mode 100644 index 000000000..cd20fde91 --- /dev/null +++ b/device/flame/native/RESULTS.md @@ -0,0 +1,122 @@ + +# Pixel 4 native-install validation — 2026-10-19 + +The handset ran Linux `7.0.0-sm8150`, native Arch on ext4 `userdata`, +Hyprland/Quickshell with software rendering, and a storage-loading U-Boot in +`boot_b`. Results below describe that measured development installation, +not a release claim for every Pixel 4 or the new recipe's exact output. +The review split was refreshed against main on 2026-10-26; no new hardware +result is implied by that rebase. +Private logs, backup manifests, device identifiers, credentials, NV data and +firmware are retained off-repository. No such input or binary is published. + +## Measured handset procedure + +| Check | Observed result | Scope / limit | +| --- | --- | --- | +| Native root handoff | Arch, PID 1 watchdog, storage guard and mobile home/PIN UI reached from ext4 userdata | The root was assembled locally, including owner inputs and matching external firewall modules | +| Installed loader bytes | Full reviewed image prefix matched, including zero-valued header fields | Boot B was erased before the small header-v0 image was written; payload-only comparison previously missed stale header bytes | +| Boot-success correction | Four sectors, backup table/header first, then primary table/header; each read back; only B success bit and required CRCs changed | A write past the storage guard, made on 2026-10-19 with the owner's approval, before the project's policy on Qualcomm slot flags (now AGENTS.md §1 and CONTRIBUTING §3.1; flame's own entry is #58); no automatic boot-success service; no calibration writes | +| Normal connected starts | Initial normal installed-loader start plus three further connected restarts passed | Different boot IDs; guard/desktop/Wi-Fi services active and protected hashes matched; not an endurance run | +| Deliberate abrupt restart | After stopping the display manager and syncing data, one intentional kernel panic returned automatically to Linux | Wi-Fi association, interface-bound HTTPS 200 and protected hashes passed; this was a deliberate test, not an observed spontaneous fault | +| Unplugged restart | A one-shot trigger requested one normal restart after charger-offline detection; owner saw a clear PIN screen before reconnecting | Fresh USB login verified new boot, Wi-Fi/HTTPS and protected hashes; trigger was transient and cannot repeat after reboot | +| Display power cycles | One earlier on/off/on check and five additional cycles passed at the existing 90 Hz mode | Reported off/on state and same boot checked; independent RAM recovery login passed and timer was cancelled; final PIN image was readable | +| Paced load / idle | Two 64 MiB hash workers at approximately 50% duty for 120 s, then 180 s without synthetic load; 301 s elapsed; same boot | Highest sampled sensor 60.8°C; hash loops, services, protected data and Wi-Fi HTTPS passed; not a full-load endurance pass | +| Full-duty stress attempt | Stopped at the first 10 s temperature check, processor sensor 71.7°C | Conservative test cutoff was 70°C, below the kernel's existing CPU thermal-control trips; workers stopped, temperature recovered and no reboot occurred; cooling settings unchanged | +| Protected data | Seven current calibration/modem hashes matched; complete 12-partition backup set verified off-device | Counts/results only; no real hashes, partition contents or device identifiers are published | +| Chrome license / scrolling | Native Wayland, disabled GPU and scale factor 0.6 fit the license dialog; owner accepted it and confirmed finger scrolling on a webpage | Chrome was owner-installed; no license was accepted automatically; profile retained; Chrome is not added as a project dependency | +| Agent app | The owner signed in and a short prompt replied normally | Controlled retry passed; an earlier full reset remains unexplained | +| Final state | Both GPT CRCs valid, B success set, other metadata/reserved bytes preserved outside B attributes/required CRCs; fresh SSH, Wi-Fi/HTTPS and protected hashes passed | No failed system units or active test/recovery timers; temporary IPv6 recovery listener removed; Docker builders stopped after work | + +The U-Boot driver correction is [cefacc22](https://github.com/wirelessjoe/u-boot/commit/cefacc22d1377071d70e5bc93e48ddbaf40fe65a): +missing `rot` no longer leaves a stack value in console selection, and the +probe honors and bounds framebuffer stride. The installed test image used +that driver plus the same peripheral USB DT and two-second storage path. +The later generic invalid-width guard and smaller configuration are separated +below; they were not silently substituted for the measured installed image. + +The standalone Linux payload used `console=tty0` only, and the journal did +not forward to ttyGS0. Earlier journal-only changes were insufficient while +USB remained the last Linux console. The final battery restart passed after +USB was removed from the console path. A USB replug/SSH failure alone was +not counted as a spontaneous reboot: a fresh boot-ID check distinguished a +large-transfer stall from an actual reset. + +## Host checks for this PR + +- `tests/all`: passed, including retained shared guard/USB-product/boot-method + tests and new native loader staging/role refusal, serial selection, first-guard + fail-fast, GPT failure/readback/padding, PARTNAME discovery and scoped/shared-SSH fixtures. + Container provisioning and root-image smoke cases skip when their optional + fixtures are unavailable; a new signed complete root image was not built. +- `packages/omamobile-device-flame/test/all`: guard-only activation, disabled + Wi-Fi unit, standalone journal and owner configuration merge/backup/repeat + checks passed. The browser helper preserves unrelated flags and refuses an + unknown monitor layout rather than overwriting it by guesswork. +- `packages/omamobile-shell/test/all`: passed with the documented optional + tool-dependent skips. The refreshed hooks are shell 0.2.24 and first-boot 0.1.3; + those package versions have host checks, with no fresh phone install. +- ShellCheck passed for added scripts. Changed legacy scripts were checked + with their pre-existing diagnostics excluded; no new warning was retained. +- `tools/build-flame-loader`: complete `W=1` build, generated configuration + and compiled environment inspection, Android header/payload checks and + output checksums passed. Inherited platform DTS/missing-prototype warnings + remain; the changed simplefb driver produced no new warning. +- The actual simplefb probe ran under host ASan/UBSan for missing/explicit + rotation, packed/padded/16-bit rows, invalid stride/buffer size and overflow. + The original driver is rejected by the regression fixture. Strict checkpatch + passed with sign-off omitted (human DCO still required for upstream) and + only the new-file MAINTAINERS advisory excluded for the new board/test files. +- `tools/build-flame-system --wifi`: rebuilt and inspected on the host with + the supplied matching kernel/watchdog and local public key. The resulting + image/key material stays private; nothing was booted or flashed in PR prep. + +### Changes requiring a new hardware gate + +The pinned U-Boot source is +[`e210c6956ce90e48b667eb15a8c6f20bc292b52e`](https://github.com/wirelessjoe/u-boot/tree/e210c6956ce90e48b667eb15a8c6f20bc292b52e). +Compared with the handset's tested image, it removes unused EFI/FAT-write, +DFU, mass-storage, environment-save and fastboot OEM facilities/menu entries +and adds an invalid-width arithmetic guard. Its healthy boot sequence and +USB role remain the measured ones. The new package explicitly supplies the watchdog/USB network policy measured +on the hand-built root, and first-boot 0.1.3 scopes recovery/DHCP firewall +rules to native flame on USB. The native init also now exits on the +first storage-guard failure and leaves USB getty startup explicit rather +than automatic. These outputs were host-built/checked only. Package assembly was host-fixture tested. The proposed userdata writer +is held out of the low-risk split pending the maintainer's policy decision. Perform the native runbook's new approved +RAM boot and recovery gates before installing any new output image. + +## Reproducing the bounded load check + +After owner approval, protected-data preflight, a fresh independent recovery +login and an external host kernel-log stream, stage `validation/load-idle.sh` +in RAM. PID 1 must hold the watchdog. Run it in a transient unit so an SSH +loss cannot leave workers running indefinitely: + +```sh +systemd-run --wait --pipe --collect --unit=flame-native-validation \ + --property=RuntimeMaxSec=340 --property=KillMode=control-group \ + /bin/bash /run/load-idle.sh +``` + +Keep output private. Stop on a temperature cutoff or new error. Require the +same boot, final service/Wi-Fi/protected-data checks and an inactive unit. +Screen cycles and each restart remain separate human-approved gates; never +turn the deliberate panic test into an automatic startup hook. + +## Open limits + +### Intermittent runtime reset + +One owner-reported full reset near agent sign-in remains unexplained. A +controlled sign-in and prompt retry passed on the same boot, with host +capture and unchanged protected hashes. No implementation change explains +that pass; sustained use and the reset investigation remain open. + +The original spontaneous runtime-reset cause is **not conclusively identified**. +The bounded tests did not reproduce an unplanned reset. Hardware GPU +acceleration remains disabled, Bluetooth firmware download/pairing has not +passed, and large phone-to-host USB output can stall (64 KiB verified +retrievals worked). Calls, audio/cameras, full Android rollback/factory reset, +release power management and long-term stability are not established. +A successful temporary boot or one working app does not close those gates. diff --git a/device/flame/native/validation/load-idle.sh b/device/flame/native/validation/load-idle.sh new file mode 100755 index 000000000..f23df761d --- /dev/null +++ b/device/flame/native/validation/load-idle.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +set -euo pipefail +python3 - <<'PY' +from pathlib import Path +import hashlib,json,multiprocessing as mp,subprocess,time + +assert Path('/usr/share/omamobile/flame-root').is_file(),'Not a native flame root' +assert Path('/proc/device-tree/model').read_bytes().rstrip(b'\0')==b'Google Pixel 4','Wrong model' +subprocess.run(['sha256sum','-c','/etc/omamobile/flame-calibration.sha256'],check=True,stdout=subprocess.DEVNULL) +held=False +for fd in Path('/proc/1/fd').iterdir(): + try:held=held or fd.resolve().as_posix()=='/dev/watchdog0' + except FileNotFoundError:pass +assert held,'PID 1 must hold the watchdog' +boot_path=Path('/proc/sys/kernel/random/boot_id') +boot=boot_path.read_text().strip() +started=time.monotonic() +zones=[] +for p in sorted(Path('/sys/class/thermal').glob('thermal_zone*')): + try: + label=(p/'type').read_text().strip() + temperature=int((p/'temp').read_text()) + except (OSError,ValueError): + continue + if -20000 <= temperature <= 150000: + zones.append((p,label)) +assert zones,'No thermal readings available' +maxima={} +context=mp.get_context('fork') +stop=context.Event() + +def worker(queue): + try: + block=bytes(range(256))*(256*1024) # 64 MiB per worker, 128 MiB total. + expected=hashlib.sha256(block).digest() + count=0 + while not stop.is_set(): + before=time.monotonic() + assert hashlib.sha256(block).digest()==expected,'Memory checksum changed' + count+=1 + stop.wait(max(.02,time.monotonic()-before)) # About 50% duty per worker. + queue.put(('pass',count)) + except BaseException as error: + queue.put(('error',repr(error))) + +def check(phase): + assert boot_path.read_text().strip()==boot,'Unexpected restart' + assert not Path('/dev/sda').exists(),'Whole-disk node appeared' + values={} + for p,label in zones: + value=int((p/'temp').read_text()) + key=p.name+':'+label + maxima[key]=max(value,maxima.get(key,value)) + values[key]=value + ceiling=45000 if 'batt' in label.lower() else 70000 + assert value < ceiling, f'Thermal stop: {label}={value}' + subprocess.run(['systemctl','is-active','--quiet','flame-storage-guard','flame-wifi','sddm'],check=True,timeout=10) + print(json.dumps({'phase':phase,'elapsed_s':round(time.monotonic()-started),'boot':boot,'temperatures_mC':values}),flush=True) + +queue=context.Queue() +workers=[context.Process(target=worker,args=(queue,)) for _ in range(2)] +check('preflight') +print('BOUNDED_LOAD: two CPU workers at about 50% duty, 128 MiB total, 120 seconds; then 180 seconds idle',flush=True) +try: + for process in workers:process.start() + deadline=time.monotonic()+120 + while time.monotonic()0 for result in results),results +print('WORKERS_VERIFIED',results,flush=True) +deadline=time.monotonic()+180 +while time.monotonic()