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/tools/imac-image/README.md # 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 / tools / imac-image / README.md` 92 lines · 5952 bytes Raw Blame History Rendered 1 # Omega boot-image builder 2 3 `imac-image.om` writes the whole Allen boot medium with the seeded compiler: protective MBR, a GPT 4 with one FAT32 EFI System Partition, and `\EFI\BOOT\BOOTX64.EFI` plus `STARTUP.NSH` inside it. No 5 host partitioning tool, FAT tool or filesystem library is used — every byte, including both GPT 6 headers with their CRCs, the FAT32 BPB, FSInfo, both FAT copies and the directory entries, is 7 written by this program. 8 9 An unpartitioned FAT "superfloppy" boots on OVMF but is not what Apple firmware enumerates: 10 it looks for an `\EFI\BOOT\BOOTX64.EFI` on a partition. This builder exists so the attended iMac 11 trial stages a partitioned disk. 12 13 ## Build 14 15 Two steps, both from this directory: 16 17 ```sh 18 OMC=/seed/out/omc # the pinned seed compiler 19 export OMEGA_COMPILER="$OMC" ALLEN_SRC=/native/omega/allen 20 21 # 1. the EFI application, composed in the order that compiles (exit 65 on digest drift) 22 sh build-efi.sh BOOTX64.EFI `ff17a936719049af35c793860d246003170ade526bc8da4a421bdaf9cf0dc33b` 23 24 # 2. the boot medium that carries it 25 "$OMC" < imac-image.om > imac-image && chmod +x imac-image 26 ./imac-image # writes imac-boot.img next to BOOTX64.EFI 27 ``` 28 29 `build-efi.sh` writes `target x86efi`, concatenates the twenty sources in the verified order, pipes 30 them to the pinned compiler, prints the compiler and output digests, and exits 65 when the digest 31 does not match the one you passed. The twenty sources are **not on main**: they are on aienux 32 `feat/allen-imac-competition` (``d4ffde3c``), so point `ALLEN_SRC` at a checkout of that branch. On the 33 ``d4ffde3c`` sources with compiler ``c99eda24`…` it reproduces ``ff17a936`…` exactly. 34 35 `build-efi.sh` exit status: 0 written, 64 the compiler refused (nothing published), 65 digest 36 mismatch, 66 missing sources, 69 no `OMEGA_COMPILER`, 73 `$out` already exists. 37 38 `imac-image` exit status: 0 written, 2 input open, 3 input empty, 4 output open, 5 truncate, 39 **10 the EFI is larger than the ESP data area** (191497 clusters, about 98 MB), 6 sync, 7 close 40 output, 8 a short write, 9 input seek/close. 41 42 The payload is streamed one 512-byte cluster at a time, copied from the input and written straight 43 into the image, so there is no in-memory size ceiling: a 1.5 MiB EFI and a 3 MiB EFI both build, and 44 the only limit is the fixed ESP geometry, which is checked before anything is written. The geometry is fixed (disk 196608 sectors, ESP 45 2048..196574, FAT32 with 512-byte sectors, 1 sector per cluster, 32 reserved, 2 FATs of 1497 sectors, 46 191501 clusters, constant volume serial and constant directory timestamps), so the same EFI bytes 47 always give the same image digest. 48 49 ## Receipt (first run, 2026-10-25) 50 51 | Item | Value | 52 |---|---| 53 | builder source | `imac-image.om` sha256 ``d76d3852daf026238d22b0d88faedba15338e372e5d423a8e3c5b677fdde5f14`` | 54 | compiler | omega `feat/allen-imac-competition` ``c3fb79697``, `seed/out/omc` sha256 ``c99eda2465036c0637a444689a65dd7fc736e4fa8a8b4cf3456b0ce1b57f8996`` | 55 | input EFI | aienux `feat/allen-imac-competition` ``d4ffde3c``, `target x86efi`, sha256 ``ff17a936719049af35c793860d246003170ade526bc8da4a421bdaf9cf0dc33b`` (`1528832` bytes) | 56 | output image | `imac-boot.img` sha256 ``f0811738c2a30bc93076f18884fb9cdc2c081ae83775d147565352b40a4c85f0``, `100663296` bytes | 57 58 Reproducibility is the useful property here, and it is checkable from the repositories rather than 59 asserted: `build-efi.sh` re-derives ``ff17a936`…` from the ``d4ffde3c`` sources with that compiler, and 60 two runs of `imac-image` on the same EFI produce the same image digest. This deliberately does not 61 chase byte-identity with the `sgdisk`/`mkfs.vfat`/`mtools` image that preceded it: `mkfs.vfat` takes 62 the volume serial from the clock and mtools stamps directory times, so that reference is not 63 reproducible by construction. The acceptance is same inputs, same digest, firmware boots it, and the 64 payload round-trips. 65 66 ## Verification performed 67 68 Reading tools are used only as independent checkers, never as part of the build: 69 70 - `sgdisk -p imac-boot.img` — partition 1, sectors 2048..196574, code `EF00`, name `ALLEN`. 71 - `sgdisk -v imac-boot.img` — `No problems found` (both CRCs, primary and backup headers agree). 72 - `fsck.vfat -n ` — clean: 5 files, 2990/191501 clusters, no FSInfo or `..` complaints. 73 - `mdir -i imac-boot.img@@1M ::/EFI/BOOT` — `BOOTX64.EFI`, `1528832` bytes. 74 - Payload sizes: `1528832` bytes → ``f0811738`…` (identical to the buffered builder's output, so the 75 streaming refactor changed no byte), `3145728` bytes → rc 0 with `fsck.vfat` clean at 6148 clusters, 76 `125829120` bytes → rc 10 before any write. The earlier whole-file read would have trapped at the 77 first byte past 2 MiB. 78 - The printed build block, executed verbatim in a clean directory: `build-efi.sh` → ``ff17a936`…` 79 (rc 0), `imac-image` → ``f0811738`…` (rc 0). Exit paths exercised rather than declared: 65 wrong 80 expected digest, 66 missing sources, 69 no `OMEGA_COMPILER`, 64 compiler refusal, 73 existing 81 output. A refusal publishes nothing (compile goes to a scratch file and is linked into place only 82 on success), so a retry at the same path succeeds and `imac-image` can never pick up a zero-byte 83 EFI. 84 - `mcopy` round trip on the final image ``f0811738`…` — the extracted EFI hashes to ``ff17a936`…` and 85 `cmp` is silent; `STARTUP.NSH` reads `fs0:\EFI\BOOT\BOOTX64.EFI\r\n`. 86 - OVMF with a fresh NVRAM (no boot entry) — `BdsDxe` creates its own entry from the ESP, starts the 87 image, and Allen's window renders with `Network is up. Type a request.` The capture holds only the 88 firmware's own ICMPv6 (3 packets, no DHCP/DNS/TCP), so this proves the layout, a cold boot and the 89 SNP probe; it is not evidence about the Omega transport path, which is still blocked on aienux#454. 90 91 Emulator evidence, not hardware qualification: no physical iMac was touched, and Apple firmware has 92 not been exercised.