Files
qbuissondebon 294fb4a3c4 VBIOS backup: precise failure diagnosis plus opt-in unload retry
save_bios now distinguishes nvflash driver-loaded refusal from a
missing sysfs rom node (ROM BAR not exposed) vs enable denial,
and appends host lockdown/Secure Boot state to the note. New
opt-in last resort: unload NVIDIA modules, retry nvflash --save,
always reload (y/N prompt default n, or --bios-unload). Docs
(flow, flags, safety, AGENTS.md invariant) updated to match.
2026-10-15 00:30:02 +02:00

31 lines
3.7 KiB
Markdown

# Project instructions
## Purpose
This repository checks one NVIDIA CMP 170HX at a time on a fresh Ubuntu 26.04 x86-64 host. The normal sequence is: prepare driver and tools, check PCIe lane width, install cmpunlocker for stock memory, cold boot, confirm unlocked memory, then check the final PCIe link. The capacitor width check passes at **x16**, even if the link is Gen1. A completed post-unlock card check passes only at **Gen2 x16**.
## Source and outputs
- `check_cards.py` owns the CLI, per-card flow, report scoring, and terminal result.
- `cxlib.py` owns host setup, the cmpunlocker harness clone/update and opt-in installer, card identity, subprocess logging, PCIe inspection, and optional VBIOS backup.
- `README.md` is the operator guide. Keep its flags, output paths, reboot steps, and exit codes aligned with the code.
- `harness/`, `cards/`, and `unidentified/` contain generated source, logs, reports, or firmware backups. Do not commit their contents.
- The bundled `nvflash_5.867_linux/` contains the optional backup tool. Backups belong under `extras/`, not at repository root.
## Invariants
- A card folder is named from the automatically read **GPU UUID** (`nvidia-smi`). The physical serial (nvflash probe, else `N/A`) is recorded in `<folder>/serial.txt` and `report.json`. Never prompt for manual serial entry. When even the UUID is unavailable, continue the run under `unidentified/<bdf>/` and report it.
- Match every card-sensitive operation to the detected PCI address. A host may have another NVIDIA GPU even though only one CMP 170HX is being checked.
- Measure capacitor-related lane width before unlocking. The width result is independent of cmpunlocker: Gen1 x16 passes the width check, while x4 fails it. Do not claim the capacitor is physically verified; the width is an observed link result on the current host.
- Keep the final PCIe acceptance check after unlock. Preserve a red `[ERROR]` message and failing exit for any final link other than Gen2 x16. Gen1 x16 passes the earlier width check but fails the final card check.
- Preserve cold-boot state by card identity. The GPU UUID is the folder name and may be used internally for state tracking.
- The cmpunlocker harness is cloned from upstream **main** into `harness/cmpunlocker/`, and `git pull --ff-only` runs before every install (a failed pull warns and continues with the existing checkout). Invoke `install.sh` only with flags the checked-out version actually accepts — currently **no flags**; never pass `--no-passthrough` to older checkouts without verifying them first.
- VBIOS backup is optional. Prefer nvflash `--save`, then the sysfs ROM fallback, and report the precise failure cause (driver-loaded vs missing rom node). A driver unload -> save -> reload retry is opt-in only (y/N prompt or `--bios-unload`). Never add a flashing step to the normal workflow.
## Working in this repository
- The repository has a single remote, `origin` (`git@git.ssh.qbuissondebon.eu.org:qbuissondebon/cmp170hx_check.git`, web: https://git.qbuissondebon.eu.org/qbuissondebon/cmp170hx_check), default branch `main`. Local status, diff, and commits are allowed at any time. Push to `origin` only when the user explicitly asks for it. Never force-push, never rewrite pushed history, and never add another remote without an explicit request.
- Do not run host setup, unlock, VBIOS, or PCIe mutation commands on a development machine. Those actions belong on the intended Ubuntu host when the user requests them.
- Keep reports and long-running installation logs visible and useful to an operator. Save full output on disk; show installation progress in the terminal.
- If asked to verify without a card, `python3 check_cards.py --demo` is the synthetic path. It does not establish hardware correctness.