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