feat(kernel): Artemis and Zuse from one disk -- the stick; virtio Artemis leaves v4

sk_v4_identity.c: a USB drive is this system's stick if its GPT has both StarshipOS partitions and
it is the disk the loader booted from (BootDisk's DiskGUID), or, when the boot was not from a
stick, the first such disk while none is attached. Then: its Artemis partition must carry a good
artemis_sig ('Artemis: the stick's signature is bad -- not used' otherwise), is attached first --
the first disk slot -- ('Artemis: the stick's partition attached'), Zuse's key is read from its
genesis marker, and its identity partition is checked and attached as before. Any other drive,
raw or GPT: 'USB: a drive that is not this system's stick -- not used'. On a pull the identity
partition is detached, then Artemis. sk_v4_identity_boot / sk_v4_run take the loader's BootDisk.
kernel_main.c: no virtio Artemis on the v4 path. kernel/Makefile: ARTDISK= attaches no virtio disk
(every QEMU target); ARTDISK stays for system=v3.

STICK.md 4 amended as ruled (R2): on v4 only this system's stick is used; users' drives minted by
this system's Zuse come with the users design after INSTALL. BRINGUP.md: Secure Boot off on every
PC (ruled 2026-10-28), RDRAND in QEMU, the SER5 smoke-test stick, A4 not on v4.

Tests: new stick_artemis (x3, no virtio disk), stick_zuse, two_sticks (replaces datastick),
artemis_unsigned, raw_ident; changed stick_boot, gpt_zuse, gpt_hotplug, midpull (replug) -- all
failed before, pass after (two test defects found and fixed: the signature's offset, the 63-char
log cut). Regression 20/20. 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 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rajames
2026-10-28 16:10:33 -04:00
co-authored by Claude Opus 5.5
parent 1b45f5f85f
commit 1e8a6fed34
99 changed files with 16418 additions and 103 deletions
+5 -15
View File
@@ -500,19 +500,16 @@ static void sk_log_level_after_post(const BootInfo *boot_info)
/* THE BLOCK CHAIN, for the v4 node. It asks this kernel for its blocks
* (v4/include/v4/blocks.h, docs/v4.0.0/MESH.md 8.3). The chain is set up
* with the calls the v3 path makes and in its order -- fast RAM and the
* ramdrive, then PCI, then the virtio disk -- and, as there, after POST.
* What the v3 path does next with that disk is not done here, because it is
* Artemis's and Zuse's and v4 has neither yet: the genesis signature,
* Zuse's root key, and the owner's word that the disk may be formatted.
* Until an owner gives that word the subsystem reads the disk and will not
* write it. */
* ramdrive, then PCI -- and, as there, after POST. There is no virtio disk
* on the v4 path: Artemis is the stick's Artemis partition, attached when
* the stick arrives, before its identity partition (sk_v4_identity.c;
* docs/v4.0.0/STICK.md 4, plan 2026-10-27-stick-4-one-disk.md, Task 4). */
static BootInfo *sk_v4_boot_info;
static void sk_v4_block_chain(void)
{
const size_t ram_size = (size_t)BLK_RAM_BLOCKS * BLK_FORTH_SIZE, krd_size = 1024u * 1024u;
uint8_t *blk_ram = (uint8_t *)kmalloc(ram_size);
uint8_t *krd = (uint8_t *)kmalloc(krd_size);
static blkio_dev_t artemis_dev;
size_t i;
/* POST is done: the logger drops to --log-level, as on the v3 path
@@ -541,13 +538,6 @@ static void sk_v4_block_chain(void)
} else {
console_println("entropy: not available (continuing without)");
}
if (virtio_blk_find_artemis(&artemis_dev) != 0) {
console_println("Artemis: no virtio-blk disk");
} else if (blk_subsys_attach_device(&artemis_dev) == BLK_OK) {
console_println("Artemis: virtio-blk attached");
} else {
console_println("Artemis: virtio-blk found, and could not be attached");
}
/* The screen and the keyboards, as the v3 path has them: the screen is
* cleared and stays dark -- console text goes to serial only -- until
@@ -641,7 +631,7 @@ static void kernel_main_deep(BootInfo *boot_info) {
* engine, in place of the v3 VM and everything below. It does not
* return. */
sk_v4_boot_info = boot_info;
sk_v4_run(sk_v4_block_chain);
sk_v4_run(sk_v4_block_chain, &boot_info->boot_disk);
}
}
console_println(boot_info->args.system == KARGS_SYSTEM_V3