Skip to content

Commit 0010c8d

Browse files
authored
docs: clarify QEMU detach behavior and release content details (#100)
1 parent 935be01 commit 0010c8d

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

‎AGENTS.md‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ spin-machine attach --qmp /tmp/q.sock --target 0 --disk disk.raw # sda, in the
191191
spin-machine detach --qmp /tmp/q.sock --target 0
192192
```
193193

194+
`detach` returns when QEMU reports the device free, but the guest notices the
195+
ejection asynchronously: a check that greps for the node inside the guest runs
196+
immediately after it can still see it, and saw it gone seconds later (measured
197+
2026-10-03). Leave the guest a moment before treating a visible node as a
198+
hot-unplug failure.
199+
194200
A one-off check needs no socket and no QMP: the shell's console is stdin/stdout, so
195201
a script on stdin is what the guest runs, and `poweroff -f` ends the boot. `--init
196202
/bin/sh` runs the script as PID 1 with nothing mounted, so it mounts `/proc` and
@@ -204,7 +210,9 @@ printf '\n\n\n\n\n\n\n\n\n\nmount -t proc proc /proc\ncat /proc/cpuinfo | head -
204210
The leading blank lines are load-bearing: the guest's shell is not reading its console
205211
when QEMU starts feeding it, so the first bytes of the first line are lost, and a
206212
leading `sleep` would be the thing eaten — `mount` arrived as `unt` and `sleep` as
207-
`ep` before the blanks absorbed it.
213+
`ep` before the blanks absorbed it. How far the window reaches is host timing, not a
214+
line count, so keep the number of blanks generous rather than tuning it; a blank
215+
costs only a prompt.
208216

209217
## Taskfiles
210218

‎README.md‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,13 @@ One tarball:
4848

4949
`LICENSE` and `NOTICE` sit at the root of the tarball.
5050

51-
`task build` writes that same tree into `_output/`, byte for byte the layout above, and
52-
`machine.OpenRelease` reads either. `_output/bin/` holds one thing more: `spin-machine`,
51+
`task build` writes that same tree into `_output/`, and `machine.OpenRelease` reads
52+
either. What a release has beyond a build directory is what `hack/release` creates or
53+
copies when it names one: `machine.env` and `SOURCES` it writes, and the QEMU and qboot
54+
patches under `qemu/` it takes from this repository, not from the build. A tree without
55+
a manifest is still a release for every purpose except being named — the fingerprint
56+
decides whether checkpoints resume, and it is computed from the files, not from
57+
`machine.env`. `_output/bin/` holds one thing more: `spin-machine`,
5358
which `task tools` builds for working in this repository and `hack/release` does not ship —
5459
a release is the machine, not the tool that boots it. There is one layout: nothing rearranges
5560
the files on the way out of a build, into a tarball or into a consumer. Let the three differ
@@ -85,8 +90,10 @@ printf '\n\n\n\n\n\n\n\n\n\nmount -t proc proc /proc\necho hello from $(uname -r
8590
so the script mounts `/proc` itself — `poweroff` refuses without it. The leading blank
8691
lines are load-bearing: the guest's shell is not reading its console when QEMU starts
8792
feeding it, so the first bytes of the first line are lost, and the blanks absorb that
88-
instead of the first real command. Nothing touches the base image — without `--disk`,
89-
QEMU boots it under a throwaway overlay (`-snapshot`).
93+
instead of the first real command. How far that window reaches is host timing, not a
94+
line count — a quiet host may lose nothing — so treat the number of blanks as
95+
insurance, not a figure to trim: a blank costs one prompt. Nothing touches the base
96+
image — without `--disk`, QEMU boots it under a throwaway overlay (`-snapshot`).
9097

9198
Read the output by grepping a marker, since the guest's prompt and the kernel's boot
9299
chatter share stdout: `| grep -a MARKER`. The exit status is QEMU's, so a script that

0 commit comments

Comments
 (0)