Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/evidence/own-gpu-driver/rung2/window1-pre.sh # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / evidence / own-gpu-driver / rung2 / window1-pre.sh` 47 lines ยท 4381 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # L332 rung 2 window 1, part 1 (before the reboot). Run ONLY inside the coordinator-scheduled window 1, after window 0 3 # passed and the GPU users on the coordinator's list are stopped. Checks everything part 2 needs, records the box, writes 4 # a temporary "do not load NVIDIA" file (removed by part 2 as its first action) and reboots. 5 # Usage: window1-pre.sh PKG_DIR [--go] (without --go: checks only; PKG_DIR from window1-package.sh) 6 set -u 7 export PATH=$PATH:/usr/sbin:/sbin # modinfo, lsmod and friends live in sbin; a normal user shell may not list it 8 here=$(cd "$(dirname "$0")" && pwd); repo=$(cd "$here/../../.." && pwd) 9 PKG=${1:?usage: window1-pre.sh PKG_DIR [--go]}; PKG=$(cd "$PKG" && pwd) 10 log=$here/window1-$(date -u +%Y%m%dT%H%M%SZ).log; ln -sfn "$(basename "$log")" "$here/window1-current.log" 11 ts() { echo "$(date -u +%FT%T.%NZ) $*" | tee -a "$log"; } 12 fail() { ts "PRE FAIL: $*"; exit 1; } 13 SHIM=$repo/native/linux/aien-gpu 14 KO=$SHIM/aien_gpu.ko BOOT=$SHIM/build/aien_gsp_boot 15 ts "pre start, commit $(git -C "$repo" rev-parse HEAD), kernel $(uname -r), package $PKG" 16 { lsmod | grep -E '^nvidia'; nvidia-smi -L; cat /proc/cmdline; sha256sum "$KO" "$BOOT"; cat "$PKG/MANIFEST.txt"; } >> "$log" 2>&1 17 ls "$here"/window0-*.log 2>/dev/null | xargs -r grep -l 'WINDOW0 PASS' | grep -q . || fail "no window-0 log with WINDOW0 PASS: window 0 comes first" 18 # Chip identity gate (NoNvDriver review 2026-10-26). The package carries the GB10B images (GspRmBoot_GB10B, 19 # GspRmFmcGfwProdSigned_GB10B, .fwsignature_gb10y). NVIDIA's 580.173.02 source also has GB20B (arch 0x1B, impl 0xB, 20 # family gb20y) with DIFFERENT images, and the Spark's sm_121 points at the GB2XX line. Window 0 logs PMC_BOOT_42; 21 # CHIP_ID = bits 29:20 (nv_ref.h:171; ARCHITECTURE 29:24 = 0x1A GB100 / 0x1B GB200, nv_ref.h:182-183; 22 # IMPLEMENTATION 23:20 = 0xB). Hand SEC2 the GB10B image only when the chip measured 0x1AB. 23 w0=$(ls "$here"/window0-*.log 2>/dev/null | xargs -r grep -l 'WINDOW0 PASS' | tail -n 1) 24 b42=$(grep -ho 'PMC_BOOT_42 [0-9a-fA-F]\{8\}' "$w0" | tail -n 1 | cut -d' ' -f2) 25 [ -n "$b42" ] || fail "window-0 log $w0 has no PMC_BOOT_42 value: chip identity unmeasured" 26 chip=$(printf '%03x' $(( (0x$b42 >> 20) & 0x3ff ))) 27 ts "chip identity from $(basename "$w0"): PMC_BOOT_42 0x$b42 CHIP_ID 0x$chip" 28 [ "$chip" = 1ab ] || fail "chip is 0x$chip, not GB10B (0x1ab); this package holds GB10B images (GB20B is 0x1bb and needs the GB20B archives + gb20y signature): refusing" 29 [ -f "$KO" ] && [ -x "$BOOT" ] || fail "build first: make -C native/linux/aien-gpu all tools" 30 [ "$(modinfo -F vermagic "$KO" | cut -d' ' -f1)" = "$(uname -r)" ] || fail "aien_gpu.ko vermagic does not match $(uname -r)" 31 modinfo -F parm "$KO" | grep -q '^allow_boot:' || fail "aien_gpu.ko has no allow_boot (old build)" 32 for f in rm_elf rm_sig bootloader fmc fmc_hash fmc_pkey fmc_sig system_info; do [ -s "$PKG/$f.bin" ] || fail "package lacks $f.bin"; done 33 [ -s "$PKG/app_version.txt" ] || fail "package lacks app_version.txt" 34 [ "$(mokutil --sb-state 2>/dev/null)" = "SecureBoot disabled" ] || fail "Secure Boot state changed: unsigned module would be refused" 35 initrd=$(lsinitramfs "/boot/initrd.img-$(uname -r)") && [ -n "$initrd" ] || fail "cannot list the initramfs: the nvidia-in-initramfs check would pass silently" 36 grep -qE '/nvidia(_uvm|_modeset|_drm)?\.ko' <<< "$initrd" && fail "nvidia modules in initramfs: the modprobe.d file would not hold them back" 37 holders=$(sudo fuser /dev/nvidia* 2>/dev/null | tr -s ' ' '\n' | grep -E '^[0-9]+$' | sort -u) 38 for p in $holders; do ts "holder pid $p $(ps -o user=,comm= -p "$p")"; done 39 other=$(for p in $holders; do [ "$(ps -o comm= -p "$p")" = nvidia-persiste ] || echo "$p"; done) 40 [ -z "$other" ] || { [ "${2:-}" = --go ] && fail "GPU still held by: $other (coordinator stops them first)"; ts "WARN still held by: $other"; } 41 [ "${2:-}" = --go ] || { ts "checks only (no --go): PASS"; exit 0; } 42 echo "$PKG" > "$here/window1-package.path" 43 # Self-reverting hold-back (window-boot.sh): see window0-pre.sh. 44 "$here/window-boot.sh" check >> "$log" 2>&1 || fail "window-boot.sh check failed (see log); was 'window-boot.sh install --yes' run in prep?" 45 "$here/window-boot.sh" arm --yes >> "$log" 2>&1 || fail "window-boot.sh arm failed: not rebooting" 46 sync; ts "one-shot window entry armed; rebooting (part 2: window1-post.sh after ssh is back)" 47 sudo systemctl reboot