|
| 1 | +# VMware Fusion Support — Handoff Document |
| 2 | + |
| 3 | +**Branch:** `feat/vmware-support` (branched from `feat/full-gpu-compositing` at `c3744ea`) |
| 4 | +**Worktree:** `/Users/wrb/fun/code/breenix-vmware` |
| 5 | +**Date:** 2026-03-06 |
| 6 | + |
| 7 | +## What's Done |
| 8 | + |
| 9 | +### 1. `run.sh --vmware` flag (COMPLETE) |
| 10 | + |
| 11 | +Full VMware Fusion integration added to `run.sh`, mirroring the `--parallels` pattern: |
| 12 | + |
| 13 | +- Builds UEFI loader + ARM64 kernel + userspace + ext2 disk (same pipeline as Parallels) |
| 14 | +- Creates FAT32 ESP image with GPT ESP patch |
| 15 | +- Converts raw images to VMDK via `qemu-img convert -f raw -O vmdk` |
| 16 | +- Generates `.vmwarevm` bundle with unique timestamped name |
| 17 | +- Cleans up old `breenix-*` VMs automatically |
| 18 | +- Launches via `vmrun start`, tails serial log |
| 19 | + |
| 20 | +Usage: |
| 21 | +```bash |
| 22 | +./run.sh --vmware # Full build + boot |
| 23 | +./run.sh --vmware --no-build # Reuse last build |
| 24 | +./run.sh --vmware --clean # Clean rebuild |
| 25 | +``` |
| 26 | + |
| 27 | +### 2. VMX Generator (COMPLETE) |
| 28 | + |
| 29 | +`scripts/vmware/generate-vmx.sh` — generates a `.vmx` config file with: |
| 30 | +- ARM64 EFI guest (`guestOS = "arm-other-64"`, `firmware = "efi"`) |
| 31 | +- NVMe boot disk (boot.vmdk with FAT32 ESP) |
| 32 | +- SATA ext2 data disk (optional) |
| 33 | +- Serial port output to `/tmp/breenix-vmware-serial.log` |
| 34 | +- NAT networking (e1000e) |
| 35 | +- XHCI USB |
| 36 | +- 4 vCPUs, 2GB RAM, 256MB VRAM |
| 37 | + |
| 38 | +### 3. First Boot Test (DONE — partial success) |
| 39 | + |
| 40 | +The kernel DOES boot on VMware Fusion. Evidence from `vmware.log`: |
| 41 | +- `Guest: Firmware has transitioned to runtime` — UEFI loader executed |
| 42 | +- vcpu-0 active with valid state: `PC=fbce8774`, `VBAR_EL1=ff3dd000`, `TTBR0_EL1=fffdf000` |
| 43 | +- MMU enabled (`SCTLR_EL1=3050198d`), page tables set up |
| 44 | +- Screen resized: `Screen 1 Defined: xywh(0, 0, 2048, 1536)` |
| 45 | + |
| 46 | +## What's Broken |
| 47 | + |
| 48 | +### Serial Output — GARBLED (not GPU-related) |
| 49 | + |
| 50 | +The serial log (`/tmp/breenix-vmware-serial.log`) contains non-ASCII binary garbage (bytes in 0x00-0x1b range). The kernel is running but we can't see any output. |
| 51 | + |
| 52 | +**Root cause:** The UEFI loader discovers the UART via ACPI SPCR table. When SPCR isn't found or doesn't match, it falls back to the Parallels PL011 address `0x0211_0000`. VMware Fusion almost certainly has its UART at a different base address. |
| 53 | + |
| 54 | +**Key code path:** |
| 55 | +1. `parallels-loader/src/acpi_discovery.rs:187-219` — SPCR parsing, falls back to `0x0211_0000` |
| 56 | +2. `kernel/src/platform_config.rs:22` — QEMU default is `0x0900_0000` |
| 57 | +3. `kernel/src/serial_aarch64.rs` — PL011 driver (may need 16550 for VMware) |
| 58 | + |
| 59 | +## What Needs To Happen Next |
| 60 | + |
| 61 | +### Priority 1: Fix Serial Output |
| 62 | + |
| 63 | +This is the blocker — without serial we're flying blind. |
| 64 | + |
| 65 | +**Option A: Debug from UEFI loader side** |
| 66 | +- The UEFI loader has access to UEFI SimpleTextOutput (screen console) before handing off |
| 67 | +- Add SPCR table dump logging in `parallels-loader/src/acpi_discovery.rs` using UEFI output services |
| 68 | +- This will reveal what ACPI tables VMware provides and what UART address is in SPCR |
| 69 | + |
| 70 | +**Option B: Dump ACPI tables from VMware** |
| 71 | +- Boot a Linux ISO on the same VMware VM config |
| 72 | +- Run `cat /sys/firmware/acpi/tables/SPCR | xxd` to see the UART address |
| 73 | +- Or `dmesg | grep -i uart` to see what Linux discovers |
| 74 | + |
| 75 | +**Option C: Try known VMware UART addresses** |
| 76 | +- VMware ARM64 may use PL011 at `0x0900_0000` (same as QEMU virt) |
| 77 | +- Or it might use 16550-compatible UART at a different address |
| 78 | +- Could try hardcoding common addresses as a quick test |
| 79 | + |
| 80 | +### Priority 2: Verify UART Type |
| 81 | + |
| 82 | +VMware might not use PL011 at all on ARM64. It could use: |
| 83 | +- **16550 UART** (like x86) — different register layout, different init sequence |
| 84 | +- **PL011** at a different address — just need the right base |
| 85 | +- Check SPCR `interface_type` field: 0x03 = PL011, 0x12 = 16550 |
| 86 | + |
| 87 | +### Priority 3: Platform Abstraction |
| 88 | + |
| 89 | +Once serial works, consider: |
| 90 | +- Adding a `VMware` variant to platform detection (currently just QEMU vs Parallels) |
| 91 | +- VMware's virtio/GPU/network devices may differ from Parallels |
| 92 | +- The existing Breenix VM at `~/Virtual Machines.localized/Breenix.vmwarevm/Breenix.vmx` has a known-working VMware config for reference |
| 93 | + |
| 94 | +## File Inventory |
| 95 | + |
| 96 | +### New files |
| 97 | +- `scripts/vmware/generate-vmx.sh` — VMX config generator |
| 98 | +- `VMWARE_HANDOFF.md` — this document |
| 99 | + |
| 100 | +### Modified files |
| 101 | +- `run.sh` — added `--vmware` flag, VMWARE block (lines ~410-610) |
| 102 | + |
| 103 | +### Build artifacts |
| 104 | +- `target/vmware/boot.vmdk` — EFI boot disk |
| 105 | +- `target/vmware/ext2-data.vmdk` — ext2 data disk |
| 106 | +- VM bundles land in `~/Virtual Machines.localized/breenix-*.vmwarevm/` |
| 107 | + |
| 108 | +## VMware Fusion Tooling Reference |
| 109 | + |
| 110 | +| Tool | Path | Purpose | |
| 111 | +|------|------|---------| |
| 112 | +| vmrun | `/Applications/VMware Fusion.app/Contents/Public/vmrun` | VM lifecycle (start/stop) | |
| 113 | +| vmware-vdiskmanager | `/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager` | VMDK creation/conversion | |
| 114 | +| vmcli | `/Applications/VMware Fusion.app/Contents/Public/vmcli` | VM configuration | |
| 115 | +| EFI ROM | `.../Library/roms/arm64/EFIAARCH64.ROM` | ARM64 EFI firmware | |
| 116 | + |
| 117 | +Disk conversion uses `qemu-img` (already installed at `/opt/homebrew/bin/qemu-img`) rather than vmware-vdiskmanager, since qemu-img handles raw-to-vmdk directly. |
| 118 | + |
| 119 | +## Existing VMware VM (Manual Setup) |
| 120 | + |
| 121 | +There's an existing manually-created Breenix VM at: |
| 122 | +`~/Virtual Machines.localized/Breenix.vmwarevm/Breenix.vmx` |
| 123 | + |
| 124 | +This was set up before the automated `--vmware` flow. It has the ext2 image attached as `sata0:1` (cdrom-image pointing at `target/ext2-aarch64.img`). The `.vmx` from that VM was used as reference for `generate-vmx.sh`. The VM is currently suspended with a checkpoint. |
0 commit comments