aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
GitHub aien-dev/aienux#16 (code only)
Apply it
git checkout -b patch-f34020b189a36a91 52109bcb334a95bdd33410b4d22c59dee8c917f4 curl -fsSL https://interplane.io/drakestapleton/aienux/patches/f34020b189a36a91.patch | git am
Provenance
github-import 1
aien-dev/aienux
16
2b2c75528adeda42d3cfde6976ffa0c44a453166
{"kind":"github-import","owner":"aien-dev","repo":"aienux","number":16,"url":"https://github.com/aien-dev/aienux/pull/16","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:35:51Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/docs/MILESTONES.md b/docs/MILESTONES.md index a1b85882..7c249344 100644 --- a/docs/MILESTONES.md +++ b/docs/MILESTONES.md @@ -34,16 +34,17 @@ only at M8. Status words: **done** = verified on this repository's evidence; |---|---|---|---| | **M0** Close Config A | Clean reference snapshot | done | PR #12: schema 3.0.0 bundle, all repositories clean | | | Benchmark evidence | done | CPU baseline: Llama-3.2-1B Q4_K_M on 20 Arm cores, 256-token samples, mean decode 54.2 tokens/s | -| | Verified recovery and rollback | pending | Needs the attended one-time boot ([procedure](NATIVE_BOOT_ONE_TIME.md)) | +| | Native-boot rollback | done | First native boot returned to Linux on its own; BootNext consumed, Linux entry and kernel unchanged ([M2 evidence](../evidence/m2_first_boot_2026-09-24.md)) | +| | Bootable recovery media | pending | The only USB stick holds a key backup, not a recovery system | | **M1** UEFI/QEMU substrate | Automated emulator boot proof | pending | No `qemu-system-aarch64` or AArch64 UEFI firmware on the host; UEFI images are format-checked only | -| **M2A** Spark firmware handoff | Memory map into early allocator | built | PR #10 | -| | GB10 PCI identity, BAR0, PMC_BOOT registers | built | PR #11 | -| | CPU topology from the ACPI MADT (efficiency classes) and boot-core MIDR | built | Parser tested on constructed tables; Linux shows boot cpu0 is a Cortex-A725 | +| **M2A** Spark firmware handoff | Memory map into early allocator | done on hardware | PR #10; 184 descriptors, 36 conventional regions, 0 rejected ([M2 evidence](../evidence/m2_first_boot_2026-09-24.md)) | +| | GB10 PCI identity, BAR0, PMC_BOOT registers | built, not found on hardware | PR #11; pre-exit discovery reported `gb10: unavailable` although Linux sees it at `000f:01:00.0` | +| | CPU topology from the ACPI MADT (efficiency classes) and boot-core MIDR | done on hardware | 10 cores in class 0, 10 in class 1; boot core class 0, MIDR part `0xd87` (Cortex-A725) ([M2 evidence](../evidence/m2_first_boot_2026-09-24.md)) | | | Broader ACPI device discovery | pending | | -| **M2B** Human bring-up console | GOP framebuffer text after firmware exit | built | PR #13 | -| | UART at `0x16A00000` (bounded, Spark only) | built | PR #13; external reachability unknown | +| **M2B** Human bring-up console | GOP framebuffer text after firmware exit | built, unconfirmed | PR #13; the report does not record post-exit drawing, so the operator photograph is the evidence | +| | UART at `0x16A00000` (bounded, Spark only) | built, not attempted | PR #13; skipped on the first boot because GB10 discovery failed | | | USB keyboard (xHCI + HID) | pending | | -| **M2C** Hardware test automation | Exclusive Machine 1 key and ledger records in `aien-proof` | built | aien-sovereign-core PR #126: `aien-proof hold --resource machine-1 -- CMD` | +| **M2C** Hardware test automation | Exclusive Machine 1 key and ledger records in `aien-proof` | done on hardware | aien-sovereign-core PR #126; first boot staged and collected under `machine-1` (ledger events 83 to 85) | | | Power/reset control, HDMI capture, USB input emulation | pending | Needs hardware chosen by the operator | | **M3** Kernel isolation | MMU, exceptions, interrupts, timer, scheduler, IPC/capabilities | pending | Scheduler consumes M2A CPU topology | | **M4** Storage and recovery | | pending | Host crates exist (`recovery`, `store`) | @@ -79,6 +80,8 @@ evidence that it did so, and returns to the existing system without damaging it. `scripts/collect_boot_report.sh` prints `M2_GATE: PASS` only when all of those checks hold. +**Result 2026-09-24: `M2_GATE: PASS`** on the first attended boot ([evidence](../evidence/m2_first_boot_2026-09-24.md)). Open items: GB10 discovery before firmware exit, the pre-exit report file, recording post-exit screen drawing, UART output, and bootable recovery media. + --- ## 1. Master Phased Execution Framework diff --git a/evidence/m2_first_boot_2026-09-24.md b/evidence/m2_first_boot_2026-09-24.md new file mode 100644 index 00000000..5405c2a9 --- /dev/null +++ b/evidence/m2_first_boot_2026-09-24.md @@ -0,0 +1,118 @@ +# M2 first native boot on Machine 1: evidence (2026-09-24) + +**Result: `M2_GATE: PASS`.** Machine 1 (DGX Spark, spark-b87b) left firmware, +ran native AIENOS code at EL2 with no Linux underneath (`kernel: alive`), +left a report in firmware variable storage that Linux read after the reset +(ADR 0008), and returned to the existing Linux system undamaged. + +| Item | Value | +| --- | --- | +| AIENOS commit | `52109bcb334a95bdd33410b4d22c59dee8c917f4` | +| Boot image sha256 | `79505373088d2464b82181c06f07e18e20e4e9b2b55dbc9fc46e3f0a2e2e3ada` | +| Machine 1 lease holder | `claude-code` (aien-proof hold, stage and collect) | +| Operator at the machine | Drake (Secure Boot off, reboot, observation) | +| Staged | 2026-09-24T01:50:27Z, one-time entry Boot0000 via BootNext | +| Previous Linux stopped | 2026-09-23 20:52:35 CDT | +| Next Linux started | 2026-09-23 20:53:50 CDT (75 s gap: firmware, AIENOS, 30 s countdown, reset, firmware) | + +## Hardware facts observed by native AIENOS code + +- CPU: 20 cores in the firmware MADT, 10 in efficiency class 0 and 10 in + efficiency class 1. The boot core is listed with class 0; MIDR `0x410fd871` + (part `0xd87`, Cortex-A725). The boot path runs on an efficiency core. +- Exception level at handoff: EL2. +- Memory map: 184 descriptors, 36 conventional regions, 0 rejected, + 130073720 KiB conventional. Largest region at `0x323800000`, 30776318 pages. + The early allocator reserved its first frame there. +- Timing: 64 ms from UEFI entry to handoff, 0 ms from handoff to kernel entry. +- Firmware variable writes: progress record (write 1) and final report (write 2 + of 3); attributes `0x07` (NV, BS, RT). + +## Gaps (not gate failures; next iteration) + +- `gb10: unavailable`: pre-exit GB10 discovery found no match through the UEFI + PCI root bridge protocol, although Linux sees `10de:2e12` at + `000f:01:00.0`. Because the UART path runs only when the GB10 was found, no + UART output was attempted. +- The pre-exit report file `\EFI\AIENOS\BOOTREPORT.TXT` was not saved. The + reason printed on the firmware console is recorded only in the operator's + photograph, if taken. +- Post-exit screen drawing is not recorded in the variable (the final report + is written after the kernel stage but its `last_stage` precedes drawing); + the operator's photograph is the evidence for it. +- Firmware appended `Boot0004` (the attached USB stick) to BootOrder on its + own; the original entries `0001,0003` keep their order. +- No bootable recovery media: the only USB stick holds a key backup, not a + recovery system. + +## Hardware-test ledger + +| Index | Action | Target | Intent | +| --- | --- | --- | --- | +| 83 | audit | stage-native-boot | pass exit=0 resources=machine-1 | +| 84 | audit | collect-native-boot | fail exit=1 (collector bug: efivarfs cannot seek; boot order check too strict) | +| 85 | audit | collect-native-boot | pass exit=0, hash `3120ca800f79cfbd1ef52d28e3b36cfd9c09e2cb76777a6b9e1ffd86676a8faf` | + +## Ledger payload of event 85 (verbatim) + +```text +== staging record (/boot/efi/EFI/AIENOS/STAGED.TXT) +aienos_commit: 52109bcb334a95bdd33410b4d22c59dee8c917f4 +image_sha256: 79505373088d2464b82181c06f07e18e20e4e9b2b55dbc9fc46e3f0a2e2e3ada +staged_by: claude-code +staged_at_utc: 2026-09-24T01:50:27Z +boot_current_before: 0001 +boot_order_before: 0001,0003 +linux_kernel_before: 7.0.0-1019-nvidia +aienos_boot_entry: 0000 +== staged image +sha256: 79505373088d2464b82181c06f07e18e20e4e9b2b55dbc9fc46e3f0a2e2e3ada +== pre-exit report (/boot/efi/EFI/AIENOS/BOOTREPORT.TXT) +missing +== native firmware-variable report +report_version: 1 +aienos_commit: 52109bcb334a95bdd33410b4d22c59dee8c917f4 +report_kind: final +last_stage: kernel_entered +nvram_write_index: 2 of 3 +AIENOS +arch: aarch64 +boot: native +conventional_memory_kb: 130073720 +memory_map_descriptors: 184 +memory_map_conventional_regions: 36 +memory_map_rejected_regions: 0 +memory_map_largest_region: 0x323800000 pages 30776318 +gb10: unavailable +cpu_cores: 20 +cpu_efficiency_class_0: 10 +cpu_efficiency_class_1: 10 +cpu_boot_core_listed: yes +cpu_boot_core_class: 0 +boot_cpu_midr: 0x410fd871 (part 0xd87) +allocator_managed_frames: 4096 +allocator_reserved_frame_phys: 0x323800000 +uefi_entry_to_handoff_ms: 64 +handoff_to_kernel_entry_ms: 0 +exception_level: EL2 +kernel: alive +progress_record: saved +== current boot state +BootCurrent: 0001 +Timeout: 1 seconds +BootOrder: 0001,0003,0004 +Boot0000* AIENOS handoff (one-time) HD(1,GPT,7c2b24e9-0ceb-4ad7-a401-9bf3c92c26ee,0x800,0x95000)/File(\EFI\AIENOS\aienos-handoff.efi) +kernel: 7.0.0-1019-nvidia +root: rw +== verdict +PASS image_unchanged: staged 52109bcb334a, image 79505373088d2464 +PASS left_firmware_into_aienos: pre-exit file: missing, native report: present +PASS native_code_after_firmware_exit: firmware variable written by AIENOS after ExitBootServices (kind final) +PASS kernel_alive: last stage kernel_entered +PASS boot_next_consumed: no pending one-time boot +PASS boot_order_preserved: before 0001,0003, now 0001,0003,0004 (added by firmware: 0004) +PASS linux_entry_booted: BootCurrent 0001 +PASS linux_kernel_unchanged: 7.0.0-1019-nvidia +PASS root_filesystem_writable: / +M2_GATE: PASS +``` diff --git a/scripts/collect_boot_report.sh b/scripts/collect_boot_report.sh index dfb7edc0..1b5defc2 100755 --- a/scripts/collect_boot_report.sh +++ b/scripts/collect_boot_report.sh @@ -42,7 +42,8 @@ echo "== native firmware-variable report" native="" if [[ -r "${report_var}" ]]; then # efivarfs prefixes the value with 4 bytes of attributes. - native="$(tail -c +5 "${report_var}")" + # efivarfs files cannot seek, so stream the value instead of `tail` on the path. + native="$(cat "${report_var}" 2>/dev/null | tail -c +5)" fi printf '%s\n' "${native:-missing}" @@ -55,16 +56,25 @@ echo "root: $(findmnt -no OPTIONS / | cut -d, -f1)" echo "== verdict" check "image_unchanged" "$([[ -n "${digest_now}" && "${digest_now}" == "$(field image_sha256 "${staged}")" ]] && echo 1 || echo 0)" \ "staged ${commit:0:12}, image ${digest_now:0:16}" -check "left_firmware_into_aienos" "$([[ "$(field aienos_commit "${pre}")" == "${commit}" ]] && echo 1 || echo 0)" \ - "pre-exit report from this commit, last stage $(field last_stage "${pre}")" +# Either report proves the firmware ran this image; the variable is written only +# after ExitBootServices, so it alone also proves firmware exit. +check "left_firmware_into_aienos" "$([[ "$(field aienos_commit "${pre}")" == "${commit}" || "$(field aienos_commit "${native}")" == "${commit}" ]] && echo 1 || echo 0)" \ + "pre-exit file: $([[ -n "${pre}" ]] && echo present || echo missing), native report: $([[ -n "${native}" ]] && echo present || echo missing)" check "native_code_after_firmware_exit" "$([[ -n "${native}" && "$(field aienos_commit "${native}")" == "${commit}" ]] && echo 1 || echo 0)" \ "firmware variable written by AIENOS after ExitBootServices (kind $(field report_kind "${native}"))" check "kernel_alive" "$(grep -qx "kernel: alive" <<<"${native}" && echo 1 || echo 0)" \ "last stage $(field last_stage "${native}")" check "boot_next_consumed" "$(grep -q "^BootNext:" <<<"${boot_state}" && echo 0 || echo 1)" \ "no pending one-time boot" -check "boot_order_unchanged" "$([[ "$(field BootOrder "${boot_state}")" == "$(field boot_order_before "${staged}")" ]] && echo 1 || echo 0)" \ - "$(field BootOrder "${boot_state}")" +# Firmware may append entries for removable media it finds (a USB stick). The +# gate is that the original entries keep their order and AIENOS never joined. +order_before="$(field boot_order_before "${staged}")" +order_now="$(field BootOrder "${boot_state}")" +kept="$(tr ',' '\n' <<<"${order_now}" | grep -Fx -f <(tr ',' '\n' <<<"${order_before}") | paste -sd,)" +added="$(tr ',' '\n' <<<"${order_now}" | grep -Fvx -f <(tr ',' '\n' <<<"${order_before}") | paste -sd,)" +aienos_in_order="$(tr ',' '\n' <<<"${order_now}" | grep -Fxc "$(field aienos_boot_entry "${staged}")")" +check "boot_order_preserved" "$([[ "${kept}" == "${order_before}" && "${aienos_in_order}" == 0 ]] && echo 1 || echo 0)" \ + "before ${order_before}, now ${order_now}${added:+ (added by firmware: ${added})}" check "linux_entry_booted" "$([[ "$(field BootCurrent "${boot_state}")" == "$(field boot_current_before "${staged}")" ]] && echo 1 || echo 0)" \ "BootCurrent $(field BootCurrent "${boot_state}")" check "linux_kernel_unchanged" "$([[ "$(uname -r)" == "$(field linux_kernel_before "${staged}")" ]] && echo 1 || echo 0)" \