feat(boot): the loader tells the kernel its boot disk; system=v3 is refused on a stick

uefi.h: the UEFI device path and Block I/O protocols, a typed LocateDevicePath, and BootDisk
{gpt, is_stick, disk_guid[16]} appended to BootInfo after args (boot_info_offsets.h unchanged).
The loader, before ExitBootServices, cuts its image's device path at the partition's HardDrive
node, locates the whole disk's Block I/O (whole path consumed, not a logical partition, 512-byte
blocks), reads it as 1 KiB blocks through a loader-side blkio adapter, and runs the kernel's own
gpt_read: is it a StarshipOS stick (identity and Artemis partitions), and its DiskGUID
(gpt_disk_guid, new). No HardDrive node (an ISO/CD boot), no GPT, or any failure: not a stick.
Monolithic builds only (the non-monolithic loader does not link gpt.c, and does not build today:
kernel/src/vm/vm_core.c -- reported, not fixed).

The kernel prints 'Boot disk: a StarshipOS stick' or '... not a StarshipOS stick', and on a stick
system=v3 gives 'System: v3 is not on this stick -- StarForth v4' and boots v4.

Tests: stick_v3 (new), stick_boot and zuse x3 failed on the new lines before, pass after; v3_keys
still boots v3 off a stick. Acceptance: amd64, aarch64, riscv64 to [zuse@Hera] ok>, POST 538/538,
dict_hash 0xfec8c47cfc6f437f; v4 suite and test-32 0 failures.

Plan: docs/v4.0.0/plans/2026-10-27-stick-4-one-disk.md, Task 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-28 12:08:48 -04:00
co-authored by Claude Opus 5.5
parent a321c537f7
commit 1b45f5f85f
34 changed files with 20202 additions and 5 deletions
+16 -2
View File
@@ -49,6 +49,8 @@ the stick's, plan 2026-10-26-stick-1-screen-and-keyboard.md):
blank identity partition attached (500 MiB, not the 2 GiB disk); headless
datastick --make "DATASTICK=1 ...": the data stick over USB beside Zuse's drive; Zuse
still logs in; the data stick's identity partition attached
stick_v3 --target qemu-stick, system=v3 in the stick's starforth.cfg: "Boot disk: a StarshipOS
stick", the refusal, then v4's POST; no v3 (plan 2026-10-27-stick-4-one-disk.md, Task 3)
entropy after "System: StarForth v4", the entropy backend -- rdrand on amd64 (qemu and
--target qemu-stick), virtio-rng on aarch64 and riscv64 -- then "entropy: ready";
on the qemu target, [zuse@Hera] ok> (plan 2026-10-27-stick-4-one-disk.md, Task 2)
@@ -74,7 +76,7 @@ NO_ZUSE_MODES = {"gpt_zuse", "gpt_hotplug", "gpt_foreign", "gpt_bad_crc", "gpt_b
"gpt_read_error", "headless", "hotplug", "midpull", "waitpull", "typeahead", "emergency",
"alttab_after_logout", "alttab_before_pull", "emergency_pull",
"screen_dark_until_login", "screen_console_after_login", "screen_dark_after_logout",
"kbd_typeahead", "stick_boot"}
"kbd_typeahead", "stick_boot", "stick_v3"}
label = a.label or f"{a.mode}-{a.arch}"
work = os.path.join(ROOT, "build", "qemu-session", label)
shutil.rmtree(work, ignore_errors=True)
@@ -96,7 +98,7 @@ attach_zuse = not (a.no_zuse or a.mode in NO_ZUSE_MODES)
zdrive = ident if a.mode == "v3_keys" else zimg
make_args = ["make", "-f", "kernel/Makefile", f"ARCH={a.arch}", "clean", a.target, f"ARTDISK={art}",
f"ZUSEDISK={zdrive if attach_zuse else ''}"] + shlex.split(a.make)
if a.mode == "v3_keys":
if a.mode in ("v3_keys", "stick_v3"):
make_args.append("KERNEL_ARGS=system=v3")
start = time.time()
make_log = open(os.path.join(work, "make.txt"), "w")
@@ -297,6 +299,8 @@ if m == "headless":
check("no ok> for 60 s after POST", not wait_for(ANYPROMPT, 60))
elif m == "zuse":
check("Boot disk: not a StarshipOS stick (an ISO or ESP boot)",
re.search(r"Boot disk: not a StarshipOS stick", text()) is not None)
check("Zuse: identity confirmed", wait_for(r"Zuse: identity confirmed from attached thumbdrive", 120))
check("[zuse@Hera] ok>", wait_for(PROMPT, 60))
n = count(PROMPT)
@@ -312,6 +316,7 @@ elif m in ("stick_boot", "datastick"):
users = [int(u) for u in re.findall(r"blk: disk .*?\((\d+) use", text())]
return any(300000 < u < 512000 for u in users), users
if m == "stick_boot":
check("Boot disk: a StarshipOS stick", re.search(r"Boot disk: a StarshipOS stick", text()) is not None)
check("System: StarForth v4", re.search(r"System: StarForth v4", text()) is not None)
time.sleep(20)
found, users = ident_attached()
@@ -329,6 +334,15 @@ elif m in ("stick_boot", "datastick"):
check(f"the data stick's identity partition attached (user blocks {users})", found)
check("no fault", count(r"EXCEPTION|PANIC|panic") == 0)
elif m == "stick_v3":
t = text()
check("Boot disk: a StarshipOS stick", re.search(r"Boot disk: a StarshipOS stick", t) is not None)
check("System: v3 is not on this stick -- StarForth v4",
re.search(r"System: v3 is not on this stick -- StarForth v4", t) is not None)
check("v4's POST (PARITY:V4_POST)", re.search(r"PARITY:V4_POST tests=\d+ pass=\d+ fail=0", t) is not None)
check("no System: StarForth v3", re.search(r"System: StarForth v3", t) is None)
check("no fault", count(r"EXCEPTION|PANIC|panic") == 0)
elif m == "entropy":
want = "rdrand" if a.arch == "amd64" else "virtio-rng"
wait_for(r"entropy: (ready|not available)|Zuse:|ok> ", 120) # the block chain runs after POST