wip(kernel): Artemis grows to fill the stick at its first boot -- metadata only, capped at 256 GiB (#92, Task 2) [skip ci]

Not yet accepted (plan 2026-10-29-stick-5, Task 2, step 3).
- gpt.c: the writer, gpt_grow_last() -- the backup entry array and header to
  the disk's end, the last partition to the last usable sector (whole MiB,
  capped), both headers' CRCs, the backup before the primary, the
  protective MBR's size; gpt_alternate_lba().
- sk_v4_grow.c: the volume grown to its partition -- its fence (the Artemis
  signature, Zuse's genesis marker) moved to the new top, the header last;
  the partition grown no further than the BAM tracks (the block subsystem
  places the fence by the device's size, so a volume must fill it).
- sk_v4_identity.c: a stick of 8 GB or more whose GPT ends short of the disk
  is grown before its partitions are opened; "Artemis: grown to fill the
  stick" / "under 8 GB -- not grown" / "past 256 GiB ... left unused".
- block_subsystem: blk_volume_compute_totals() (compute_totals_from_B,
  public) and blk_subsys_set_format_bam_for(); v3's behaviour unchanged.
- mkartemis --bam-for, mkdiskimage.sh --bam-for, kernel/Makefile
  STICK_GROW_MIN_BYTES / STICK_ARTEMIS_CAP_GIB: the stick's and data stick's
  Artemis BAM sized for 256 GiB (6144 devblocks). STICK.md 5a: 256 GiB (R1).

After: stick_grow PASS (16 GiB: 12129370 user blocks, 8 s POST to prompt;
second boot not grown, recognised; sfdisk --verify: no errors), stick_small
PASS, check_images.sh PASS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
This commit is contained in:
Claude
2026-11-08 12:03:46 +00:00
parent 4e935e4825
commit 5bb247d678
17 changed files with 889 additions and 22 deletions
+8 -4
View File
@@ -122,9 +122,13 @@ gains the partitions below). Three partitions:
- **The minimum stick: 8 GB.** Sticks on the shelf are 16–64 GB; 8 GB is the floor.
- **The identity partition stays 500 MiB.** About half a million 1 KiB blocks for Zuse's keys and
her own pool.
- **Artemis grows to fill the stick at its first boot (§5a),** up to **2 TiB** for the partition
(the block layer numbers 1 KiB blocks with 32 bits: 4 TiB is its hard limit; 2 TiB keeps a margin
and is past any thumb drive). Space past 2 TiB is left unused, and the boot says so.
- **Artemis grows to fill the stick at its first boot (§5a),** up to **256 GiB** for the partition
(**amended 2026-10-29**, Captain Bob: "256 GiB is ruled" -- plan
`plans/2026-10-29-stick-5-proxy-zuse-and-real-zuse.md`, R1. This said 2 TiB: the block layer
numbers 1 KiB blocks with 32 bits, so 4 TiB is its hard limit, but the block subsystem keeps two
bytes of kernel heap per block and the heap is 2 GiB, so a 2 TiB Artemis could not attach; 256 GiB
takes about 384 MiB. The stick's Artemis is formatted with a BAM sized for 256 GiB, so growth
writes metadata only.) Space past 256 GiB is left unused, and the boot says so.
- **A stick under 8 GB** is not grown: it runs at the 2 GiB it was written with, and the boot says
so.
- **The Artemis partition is formatted when the image is built (my call),** not on first boot:
@@ -168,7 +172,7 @@ Before genesis, on a stick whose GPT ends where the 2 GiB image ended and whose
first boot of a freshly written stick), the kernel grows Artemis:
- It moves the backup GPT header and entry array to the disk's end, extends the Artemis partition's
last LBA to the end of the usable space (capped at 2 TiB of partition), and rewrites both headers
last LBA to the end of the usable space (capped at 256 GiB of partition, amended -- §4), and rewrites both headers
with their CRCs (the GPT writer; `INSTALL` reuses it).
- It grows Artemis's volume to the partition: its `STFR` header's size, its free map for the new
blocks, and its metadata fence (with the genesis marker's slot) moved to the new top, as the block