From 4ea992c71dd0cdcffe0f74216e748256bd700a31 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sat, 1 Aug 2026 01:56:12 +0200 Subject: scripts: automate the data-disk workflow (mkdisk / sendkeys / test-disk) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - scripts/mkdisk.sh: create the FAT32 disk with mkfs.fat -C (the flag that actually creates the file — plain mkfs.fat fails on a missing path), accept M/G/K sizes, seed seed/ files via mtools; --fresh re-formats, --no-seed skips seeding - scripts/sendkeys.py: type lines into the guest via the QEMU monitor (US layout). Punctuation must use QEMU's named keys (minus, slash, dot, ...) — bare '-', '.', '/' are not valid sendkey names, and '-' is the modifier separator, so they were silently dropped before - scripts/test-disk.sh: full automated round trip — build, deploy, ensure image, boot headless QEMU, drive the shell (ls /disk, mkdir, echo >, cat, poweroff), then verify with fsck.fat (must be clean) and mtype (file content must have survived poweroff) - Makefile: make disk / disk-fresh / inspect / test-disk; run, run-gui and debug now auto-create a missing DISK_IMG; fix the stale comment (mkfs.fat without -C) - scripts/boot.sh: auto-create a missing DISK_IMG via mkdisk.sh - seed/: motd.txt + lines.txt seeded onto fresh images - Verified end to end: ./scripts/test-disk.sh --fresh passes --- CONTEXT.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'CONTEXT.md') diff --git a/CONTEXT.md b/CONTEXT.md index aa9385b..39ce0bd 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -186,8 +186,25 @@ Single Rust crate (`x86_64-unknown-uefi` target). Module breakdown: `-device ide-hd,drive=disk,bus=ide.0` puts the data disk on AHCI port 0; the ESP gets `bus=ide.1`. (The implicit `-drive file=fat:rw:esp` otherwise grabs port 0.) Make targets (`run`, `run-gui`, `debug`) - attach `$(DISK_IMG)` (default `/tmp/disk.img`). OVMF writes its - `NvVars` varstore file onto the first FAT volume — harmless. + attach `$(DISK_IMG)` (default `/tmp/disk.img`) and auto-create it when + missing. OVMF writes its `NvVars` varstore file onto the first FAT + volume — harmless. + + The whole disk workflow is scripted (no manual mkfs/mcopy): + +- `make disk` / `./scripts/mkdisk.sh` — create the FAT32 image with + `mkfs.fat -C` (the flag that actually creates the file; plain + `mkfs.fat` needs an existing file), label `RSDOS`, seed from + `seed/` via mtools; `--fresh` re-formats, `--size 128M` sizes it +- `make inspect` — `mdir -i` listing of the image (mtools) +- `make test-disk` / `./scripts/test-disk.sh` — full automated round + trip: build → deploy → ensure image → boot QEMU headless → drive + the shell via `sendkey` through the monitor (`ls /disk`, `mkdir`, + `echo >`, `cat`, `poweroff`) → fsck-clean check → `mtype` verifies + the written file survived poweroff +- `./scripts/sendkeys.py` — types lines into the guest via the QEMU + monitor (`--sock`, US layout, named keys for punctuation; bare + `-`/`.`/`/` are not valid sendkey names) ## Known issues / perf notes -- cgit v1.2.3