Skip to content

Commit 88f5a82

Browse files
authored
docs: 状态从「在问一个问题」改为「已发布」,并记录载荷自足是实测出来的 (#1)
补三条实施中才出现的事实:载荷自足的第一次测量什么也没测到(ldd 崩在 stderr); 捆绑让 macOS 那条腿静默退 1(空匹配的 grep + pipefail + errexit);归档是扁平的, 这决定了描述符只能按名搬而且断言必须放在搬之前。
1 parent 8171b41 commit 88f5a82

1 file changed

Lines changed: 49 additions & 5 deletions

File tree

README.md

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22

33
Cross-host builds of `qemu-system-x86_64` for the mcpp/xlings package index.
44

5-
**Status: a question being asked, not a package.** Nothing here is published,
6-
and nothing here should be added to the index until the workflow is green on
7-
all five hosts.
5+
**Status: published.** `9.2.4-1` is released here, mirrored to
6+
`xlings-res/qemu-x86` on GitCode, and admitted to the index as `xim:qemu-x86`
7+
(openxlings/xim-pkgindex#665).
8+
9+
```
10+
xlings install qemu-x86 -y
11+
```
12+
13+
⭐ The reason it exists is `mcpplibs/openarch`: its `examples/switch` now boots
14+
on `x86_64-none-elf` through `mcpp run` and prints `switch ok`, which is the one
15+
claim a working `--version` does not make.
816

917
## Why this repository exists
1018

@@ -41,9 +49,8 @@ Linux leg does.
4149

4250
| | |
4351
|---|---|
44-
| An index descriptor | Admission is a separate decision, made after five green legs |
4552
| Committed binaries | The workflow builds what it checks, so nothing here is a blob whose provenance has to be trusted |
46-
| A mirror upload | Mirroring an artifact that has not been shown to run would publish the untested thing faster |
53+
| Firmware pruning | Which `pc-bios` blob a machine type loads is a runtime question. Answering it by deleting until something breaks is how a payload ends up missing one blob on somebody else's machine — this was attempted once during development and reverted |
4754

4855
## What "it works" means here
4956

@@ -70,3 +77,40 @@ resulting size.
7077

7178
The version is pinned to the series `qemu-arm` and `qemu-riscv` already carry, so
7279
that a user who installs all three gets one QEMU generation rather than two.
80+
81+
## The payload is self-contained, and that was measured rather than assumed
82+
83+
The first build produced binaries that ran on the machine that built them and
84+
nowhere else: the Linux legs left `libpixman-1`, the glib family, `libz` and
85+
`libzstd` to the host, and the darwin legs hardcoded `/opt/homebrew/opt/...`.
86+
87+
Every non-system shared library is now bundled beside the emulator and reached
88+
through `$ORIGIN/../lib` (linux), `@loader_path/../lib` (darwin) or the
89+
executable's own directory (win32, where PE has no runtime search path). The
90+
workflow asserts it: what remains outside the payload must be core libc and
91+
system frameworks, nothing else.
92+
93+
Measured on the released linux-x64 asset — fifteen objects resolve, twelve from
94+
the payload's own `lib/`, and the two that cross the boundary are `libc.so.6`
95+
and `libm.so.6`. That measurement is what lets `xim:qemu-x86` declare no `deps`.
96+
97+
⚠️ **The first attempt at that measurement measured nothing.** It was written as
98+
`ldd <bin> 2>/dev/null | grep -v <payload>`, which printed nothing and read
99+
exactly like "nothing escapes" — the `ldd` on the PATH was a shell script that
100+
failed to parse, and it failed on stderr. The numbers above come from
101+
`LD_TRACE_LOADED_OBJECTS=1` invoked on the loader directly.
102+
103+
⚠️ **Bundling also broke the macOS leg silently.** Its pipelines end in `grep`,
104+
an empty-matching `grep` returns 1, `pipefail` promotes it and `errexit` turns
105+
it into an exit — so the leg exited 1 after reporting `1564/1564`. `set +e`
106+
around the bundling blocks fixes it.
107+
108+
## Archive layout
109+
110+
The archives are flat: `bin/` and `share/` at the top level, no wrap directory.
111+
112+
⚠️ That is a choice the consumer has to know about. xim extracts in place, into
113+
a directory it also uses for other things, so a descriptor cannot move the
114+
extraction directory wholesale the way `qemu-arm`'s can — `xim:qemu-x86` moves
115+
the two entries by name, and asserts the emulator *before* the move rather than
116+
after, because the source directory is shared.

0 commit comments

Comments
 (0)