From 195b7feb07f87201f64fe95d2935b937ce53d112 Mon Sep 17 00:00:00 2001 From: rajames Date: Tue, 27 Oct 2026 19:02:54 -0400 Subject: [PATCH] fix(build): image checks cannot pass on a stale stick; mkartemis refuses bad numbers and reads its format back Review of the stick's increment 3 (a4221d8b..c416c805), on Captain Bob's word: - check_images.sh deletes both images before building and makes each build a check: a failed build left last run's lithos-pc.img in place, and every stick check passed against it. - mkartemis takes --first-lba and --sectors as plain decimal numbers only: "abc", "-2", "2048x" and the like formatted at LBA 0, over the GPT. - mkartemis --format reopens the image read-only and reads the volume back: blk_commit_format ignores its own write errors, so a header that never landed was reported formatted. The header is read from the disk and judged as attach judges it (magic, version 2, BAM size); blk_get_volume_meta gives the in-memory geometry of a blank disk, magic included, so --check no longer relies on it either. check_images.sh keeps each case as a check (40, PASS). stick_boot and datastick on amd64/aarch64/riscv64 PASS on the rebuilt tools. Co-Authored-By: Claude Opus 5.5 --- .../runs/doe-aarch64-20261027-185447.csv | 0 .../runs/doe-amd64-20261027-184901.csv | 0 .../runs/doe-amd64-20261027-185215.csv | 0 .../runs/doe-riscv64-20261027-185849.csv | 0 .../amd64/qemu-amd64-20261027-184901.log | 158 +++++++++++++ .../amd64/qemu-amd64-20261027-185215.log | 164 ++++++++++++++ .../aarch64/qemu-aarch64-20261027-185447.log | 136 ++++++++++++ .../riscv64/qemu-riscv64-20261027-185849.log | 207 ++++++++++++++++++ scripts/check_images.sh | 40 +++- tools/mkartemis.c | 80 +++++-- 10 files changed, 765 insertions(+), 20 deletions(-) create mode 100644 experiments/bare_metal/runs/doe-aarch64-20261027-185447.csv create mode 100644 experiments/bare_metal/runs/doe-amd64-20261027-184901.csv create mode 100644 experiments/bare_metal/runs/doe-amd64-20261027-185215.csv create mode 100644 experiments/bare_metal/runs/doe-riscv64-20261027-185849.csv create mode 100644 logs/20261027-184901/amd64/qemu-amd64-20261027-184901.log create mode 100644 logs/20261027-185215/amd64/qemu-amd64-20261027-185215.log create mode 100644 logs/20261027-185447/aarch64/qemu-aarch64-20261027-185447.log create mode 100644 logs/20261027-185849/riscv64/qemu-riscv64-20261027-185849.log diff --git a/experiments/bare_metal/runs/doe-aarch64-20261027-185447.csv b/experiments/bare_metal/runs/doe-aarch64-20261027-185447.csv new file mode 100644 index 00000000..e69de29b diff --git a/experiments/bare_metal/runs/doe-amd64-20261027-184901.csv b/experiments/bare_metal/runs/doe-amd64-20261027-184901.csv new file mode 100644 index 00000000..e69de29b diff --git a/experiments/bare_metal/runs/doe-amd64-20261027-185215.csv b/experiments/bare_metal/runs/doe-amd64-20261027-185215.csv new file mode 100644 index 00000000..e69de29b diff --git a/experiments/bare_metal/runs/doe-riscv64-20261027-185849.csv b/experiments/bare_metal/runs/doe-riscv64-20261027-185849.csv new file mode 100644 index 00000000..e69de29b diff --git a/logs/20261027-184901/amd64/qemu-amd64-20261027-184901.log b/logs/20261027-184901/amd64/qemu-amd64-20261027-184901.log new file mode 100644 index 00000000..849f9822 --- /dev/null +++ b/logs/20261027-184901/amd64/qemu-amd64-20261027-184901.log @@ -0,0 +1,158 @@ +[=3hBdsDxe: loading Boot0002 "UEFI QEMU QEMU USB HARDDRIVE 1-0000:00:03.0-1" from PciRoot(0x0)/Pci(0x3,0x0)/USB(0x0,0x0) +BdsDxe: starting Boot0002 "UEFI QEMU QEMU USB HARDDRIVE 1-0000:00:03.0-1" from PciRoot(0x0)/Pci(0x3,0x0)/USB(0x0,0x0) +[=3hStarKernel UEFI Loader +Loading kernel from ESP... +[CKPT 001] Entered efi_main - ConOut live +RAW SERIAL UP +[CKPT 002] Serial (COM1) initialized +Monolithic build - kernel linked directly +Collecting boot information... +CmdLine: from starforth.cfg +CmdLine: parsed OK +[CKPT 004] Command line parsed +[CKPT 005] Kernel stack allocation decided +[CKPT 006] Boot info collected (ACPI table located) +GOP: linear framebuffer found +[CKPT 007] GOP: linear framebuffer found +[CKPT 008] About to enter ExitBootServices retry loop +EBS... +EBS OK +Calling kernel_main (monolithic)... + + + _____ _ _ __ _ + / ____| | | |/ / | | + | (___ | |_ __ _ _ __| ' / ___ _ __ _ __ ___| | + \___ \| __/ _` | '__| < / _ \ '__| '_ \ / _ \ | + ____) | || (_| | | | . \ __/ | | | | | __/ | + |_____/ \__\__,_|_| |_|\_\___|_| |_| |_|\___|_| + +LithosAnanke v2.1.0 amd64 +Architecture: amd64 +Build: Oct 27 2026 18:48:55 + +UEFI BootServices: EXITED +Console: serial line is a 16550 at port 0x00000000000003f8 (COM1, probed) + +=== StarKernel Boot Information === +Memory map entries: 113 +Total memory: 1023 MB +Usable memory: 965 MB +=================================== + +PMM initialized. +PMM statistics: + Total pages: 248528 + Free pages : 247005 + Used pages : 1523 + Total MB : 970 + Free MB : 964 + Used MB : 5 + +VMM initialized (mapped RAM, CR3 switched) +VMM initialized (mapped RAM, CR3 switched) +VMM self-test: mapped OK at 0xffff800000000000 +VMM self-test complete. + +IDT installed. + +APIC: init... +APIC: IA32_APIC_BASE MSR=0x00000000fee00900 +APIC: stale-ISR drain: 0 EOI(s) issued +APIC: initialized (xAPIC MMIO, TPR=0, SIVR=0x1FF, EOI-clear) +APIC: init done + +I/O APIC: init... +I/O APIC: base=0xfec00000, gsi_base=0, overrides=5 + override: source=00 gsi=2 flags=0x0000 + override: source=05 gsi=5 flags=0x000d + override: source=09 gsi=9 flags=0x000d + override: source=0a gsi=10 flags=0x000d + override: source=0b gsi=11 flags=0x000d +i8042: keyboard ACKed enable-scanning +i8042: IRQ1 enabled in controller config byte +I/O APIC: keyboard IRQ1 routed (masked) + +Timer: init... +Timer: init start +Timer: PM_TMR_BLK discovered from FADT at port 1544 +Timer: VM mode detected (hypervisor present). +Timer: HPET calibration disabled (VM-exit MMIO would poison timing). +Timer: WARNING: invariant TSC not present under hypervisor. +Timer: continuing in RELATIVE mode (no determinism guarantees). +Timer: RDTSCP not present; using RDTSC (less serialized). +Timer: CPUID frequency unavailable; trying PM Timer... +Timer: trust=1 (0=NONE,1=REL,2=ABS), TSC=2107178780 Hz +Timer: init done + +Kernel heap initialized. +Heap statistics: + Total bytes: 536870872 + Free bytes: 536870872 + Used bytes: 0 + Peak bytes: 0 + Heap base addr: 24641536 + Heap end addr: 561512448 + +Heartbeat: init... +APIC Timer: calibrating... +APIC Timer: apic_hz=1010574938, tick_hz=100, initial_count=10105749 +APIC Timer: configured (masked, ready to start) +Heartbeat: init done +Kernel initialization complete. +Boot successful! + +System: StarForth v4 (system=v4) +StarForth v4: one host node, the F18-derived engine +V4: capsule v4:sys:map-64.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:map-64.f18 capsule_hash=0x949eb6a1e9260e49 +V4: capsule v4:sys:core.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:core.f18 capsule_hash=0xb8f167892ec18c28 +V4: capsule v4:sys:input.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:input.f18 capsule_hash=0x85d3ec486d929a79 +V4: capsule v4:sys:dict.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:dict.f18 capsule_hash=0x1379bd3b5de811dc +V4: capsule v4:sys:codegen.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:codegen.f18 capsule_hash=0x36d2ae84d2911b90 +V4: capsule v4:sys:compile.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:compile.f18 capsule_hash=0x11145c4c2ab819d8 +V4: capsule v4:sys:quit.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:quit.f18 capsule_hash=0x43cadf3b21ddbf3e +V4: capsule v4:sys:forth.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:forth.f18 capsule_hash=0x16cab4a1268b85da +V4: capsule v4:sys:numout.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:numout.f18 capsule_hash=0x85a240ad3fb2b299 +V4: capsule v4:sys:words.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:words.f18 capsule_hash=0xb1d381f927d9f14e +V4: capsule v4:sys:system.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:system.f18 capsule_hash=0xd92203664c2915bd +V4: capsule v4:sys:qmath.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:qmath.f18 capsule_hash=0xdb4140713dd857f3 +V4: capsule v4:sys:blocks.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:blocks.f18 capsule_hash=0x76307ef48678dc2a +V4: capsule v4:sys:log.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:log.f18 capsule_hash=0xfc6540e6b824a52b +V4: capsule v4:sys:acl.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:acl.f18 capsule_hash=0x6845aa048db7eb22 +V4: capsule v4:sys:end.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:end.f18 capsule_hash=0x5ef01312c07b79cc +PARITY:V4_ROM words=2372 rom_hash=0x87b23d3ae2643c8d instructions=59145258 +V4: capsule v4:forth79.4th signature: missing (unsigned) +PARITY:V4_CAPSULE name=v4:forth79.4th capsule_id=0x4055641ee17d176b capsule_hash=0x4055641ee17d176b dict_hash=0x033e1c05c09a1df8 +PARITY:V4_POST tests=538 pass=538 fail=0 +PARITY:V4_SYSTEM word_count=317 dict_hash=0xfec8c47cfc6f437f +PARITY:OK +POST: PASSED +[HADES][INFO ] [KRELTSC: 0] blk: raw device LBN 2048..3071 (1024 blocks) +PCI: init... +PCI: ECAM mapped (amd64) +virtio-blk: no device on PCI bus 0 +Artemis: no virtio-blk disk +virtio-input: no device on PCI bus 0 +Starting heartbeat... +APIC Timer: started (LVT=0x00020020 ICR=10105749) +I/O APIC: keyboard IRQ1 unmasked +Heartbeat running. +blkio_usb: MSC device ready +[HADES][INFO ] [KRELTSC: 10819783653] blk: disk 'StarForth Volume' v2 LBN 3072..386613 (383542 user b +Zuse: no genesis on this disk -- the system stays headless diff --git a/logs/20261027-185215/amd64/qemu-amd64-20261027-185215.log b/logs/20261027-185215/amd64/qemu-amd64-20261027-185215.log new file mode 100644 index 00000000..119a73f7 --- /dev/null +++ b/logs/20261027-185215/amd64/qemu-amd64-20261027-185215.log @@ -0,0 +1,164 @@ +[=3hBdsDxe: loading Boot0002 "UEFI QEMU DVD-ROM QM00005 " from PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0xFFFF,0x0) +BdsDxe: starting Boot0002 "UEFI QEMU DVD-ROM QM00005 " from PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0xFFFF,0x0) +[=3hStarKernel UEFI Loader +Loading kernel from ESP... +[CKPT 001] Entered efi_main - ConOut live +RAW SERIAL UP +[CKPT 002] Serial (COM1) initialized +Monolithic build - kernel linked directly +Collecting boot information... +CmdLine: from starforth.cfg +CmdLine: parsed OK +[CKPT 004] Command line parsed +[CKPT 005] Kernel stack allocation decided +[CKPT 006] Boot info collected (ACPI table located) +GOP: linear framebuffer found +[CKPT 007] GOP: linear framebuffer found +[CKPT 008] About to enter ExitBootServices retry loop +EBS... +EBS OK +Calling kernel_main (monolithic)... + + + _____ _ _ __ _ + / ____| | | |/ / | | + | (___ | |_ __ _ _ __| ' / ___ _ __ _ __ ___| | + \___ \| __/ _` | '__| < / _ \ '__| '_ \ / _ \ | + ____) | || (_| | | | . \ __/ | | | | | __/ | + |_____/ \__\__,_|_| |_|\_\___|_| |_| |_|\___|_| + +LithosAnanke v2.1.0 amd64 +Architecture: amd64 +Build: Oct 27 2026 18:51:46 + +UEFI BootServices: EXITED +Console: serial line is a 16550 at port 0x00000000000003f8 (COM1, probed) + +=== StarKernel Boot Information === +Memory map entries: 131 +Total memory: 1023 MB +Usable memory: 965 MB +=================================== + +PMM initialized. +PMM statistics: + Total pages: 248638 + Free pages : 247115 + Used pages : 1523 + Total MB : 971 + Free MB : 965 + Used MB : 5 + +VMM initialized (mapped RAM, CR3 switched) +VMM initialized (mapped RAM, CR3 switched) +VMM self-test: mapped OK at 0xffff800000000000 +VMM self-test complete. + +IDT installed. + +APIC: init... +APIC: IA32_APIC_BASE MSR=0x00000000fee00900 +APIC: stale-ISR drain: 0 EOI(s) issued +APIC: initialized (xAPIC MMIO, TPR=0, SIVR=0x1FF, EOI-clear) +APIC: init done + +I/O APIC: init... +I/O APIC: base=0xfec00000, gsi_base=0, overrides=5 + override: source=00 gsi=2 flags=0x0000 + override: source=05 gsi=5 flags=0x000d + override: source=09 gsi=9 flags=0x000d + override: source=0a gsi=10 flags=0x000d + override: source=0b gsi=11 flags=0x000d +i8042: keyboard ACKed enable-scanning +i8042: IRQ1 enabled in controller config byte +I/O APIC: keyboard IRQ1 routed (masked) + +Timer: init... +Timer: init start +Timer: PM_TMR_BLK discovered from FADT at port 1544 +Timer: VM mode detected (hypervisor present). +Timer: HPET calibration disabled (VM-exit MMIO would poison timing). +Timer: WARNING: invariant TSC not present under hypervisor. +Timer: continuing in RELATIVE mode (no determinism guarantees). +Timer: RDTSCP not present; using RDTSC (less serialized). +Timer: CPUID frequency unavailable; trying PM Timer... +Timer: trust=1 (0=NONE,1=REL,2=ABS), TSC=2111989690 Hz +Timer: init done + +Kernel heap initialized. +Heap statistics: + Total bytes: 536870872 + Free bytes: 536870872 + Used bytes: 0 + Peak bytes: 0 + Heap base addr: 24641536 + Heap end addr: 561512448 + +Heartbeat: init... +APIC Timer: calibrating... +APIC Timer: apic_hz=1013219043, tick_hz=100, initial_count=10132190 +APIC Timer: configured (masked, ready to start) +Heartbeat: init done +Kernel initialization complete. +Boot successful! + +System: StarForth v4 (this build's default) +StarForth v4: one host node, the F18-derived engine +V4: capsule v4:sys:map-64.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:map-64.f18 capsule_hash=0x949eb6a1e9260e49 +V4: capsule v4:sys:core.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:core.f18 capsule_hash=0xb8f167892ec18c28 +V4: capsule v4:sys:input.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:input.f18 capsule_hash=0x85d3ec486d929a79 +V4: capsule v4:sys:dict.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:dict.f18 capsule_hash=0x1379bd3b5de811dc +V4: capsule v4:sys:codegen.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:codegen.f18 capsule_hash=0x36d2ae84d2911b90 +V4: capsule v4:sys:compile.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:compile.f18 capsule_hash=0x11145c4c2ab819d8 +V4: capsule v4:sys:quit.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:quit.f18 capsule_hash=0x43cadf3b21ddbf3e +V4: capsule v4:sys:forth.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:forth.f18 capsule_hash=0x16cab4a1268b85da +V4: capsule v4:sys:numout.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:numout.f18 capsule_hash=0x85a240ad3fb2b299 +V4: capsule v4:sys:words.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:words.f18 capsule_hash=0xb1d381f927d9f14e +V4: capsule v4:sys:system.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:system.f18 capsule_hash=0xd92203664c2915bd +V4: capsule v4:sys:qmath.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:qmath.f18 capsule_hash=0xdb4140713dd857f3 +V4: capsule v4:sys:blocks.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:blocks.f18 capsule_hash=0x76307ef48678dc2a +V4: capsule v4:sys:log.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:log.f18 capsule_hash=0xfc6540e6b824a52b +V4: capsule v4:sys:acl.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:acl.f18 capsule_hash=0x6845aa048db7eb22 +V4: capsule v4:sys:end.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:end.f18 capsule_hash=0x5ef01312c07b79cc +PARITY:V4_ROM words=2372 rom_hash=0x87b23d3ae2643c8d instructions=59145258 +V4: capsule v4:forth79.4th signature: missing (unsigned) +PARITY:V4_CAPSULE name=v4:forth79.4th capsule_id=0x4055641ee17d176b capsule_hash=0x4055641ee17d176b dict_hash=0x033e1c05c09a1df8 +PARITY:V4_POST tests=538 pass=538 fail=0 +PARITY:V4_SYSTEM word_count=317 dict_hash=0xfec8c47cfc6f437f +PARITY:OK +POST: PASSED +[HADES][INFO ] [KRELTSC: 0] blk: raw device LBN 2048..3071 (1024 blocks) +PCI: init... +PCI: ECAM mapped (amd64) +virtio-blk: found device +[HADES][INFO ] [KRELTSC: 101666334] blk: disk 'StarForth Volume' v2 LBN 3072..789009 (785938 user b +Artemis: virtio-blk attached +virtio-input: no device on PCI bus 0 +Starting heartbeat... +APIC Timer: started (LVT=0x00020020 ICR=10132190) +I/O APIC: keyboard IRQ1 unmasked +Heartbeat running. +blkio_usb: MSC device ready +[HADES][INFO ] [KRELTSC: 10862393745] blk: disk 'StarForth Volume' v2 LBN 789010..837733 (48724 user +[Hera] Zuse: identity confirmed from attached thumbdrive +[zuse@Hera] blkio_usb: MSC device ready +[zuse@Hera] [HADES][INFO ] [KRELTSC: 11008859463] blk: disk 'StarForth Volume' v2 LBN 837734..1221275 (383542 use +[zuse@Hera] ok> 3 4 + . +[zuse@Hera] 7 ok +[zuse@Hera] ok>  \ No newline at end of file diff --git a/logs/20261027-185447/aarch64/qemu-aarch64-20261027-185447.log b/logs/20261027-185447/aarch64/qemu-aarch64-20261027-185447.log new file mode 100644 index 00000000..f81dac1d --- /dev/null +++ b/logs/20261027-185447/aarch64/qemu-aarch64-20261027-185447.log @@ -0,0 +1,136 @@ +UEFI firmware (version 2025.11-3ubuntu7.3 built at 15:40:26 on Sep 23 2026) +[=3hBdsDxe: failed to load Boot0002 "UEFI Misc Device" from PciRoot(0x0)/Pci(0x2,0x0): Not Found +BdsDxe: failed to load Boot0003 "UEFI QEMU QEMU USB HARDDRIVE 1-0000:00:04.0-1" from PciRoot(0x0)/Pci(0x4,0x0)/USB(0x0,0x0): Not Found +BdsDxe: failed to load Boot0004 "UEFI QEMU QEMU USB HARDDRIVE 1-0000:00:04.0-2" from PciRoot(0x0)/Pci(0x4,0x0)/USB(0x1,0x0): Not Found +BdsDxe: loading Boot0005 "UEFI Misc Device 2" from PciRoot(0x0)/Pci(0x6,0x0) +BdsDxe: starting Boot0005 "UEFI Misc Device 2" from PciRoot(0x0)/Pci(0x6,0x0) +[=3hStarKernel UEFI Loader +Loading kernel from ESP... +[CKPT 001] Entered efi_main - ConOut live +Collecting boot information... +[CKPT 004] Command line parsed +[CKPT 005] Kernel stack allocation decided +[CKPT 006] Boot info collected (ACPI table located) +[CKPT 007] GOP: linear framebuffer found +[CKPT 008] About to enter ExitBootServices retry loop + + + _____ _ _ __ _ + / ____| | | |/ / | | + | (___ | |_ __ _ _ __| ' / ___ _ __ _ __ ___| | + \___ \| __/ _` | '__| < / _ \ '__| '_ \ / _ \ | + ____) | || (_| | | | . \ __/ | | | | | __/ | + |_____/ \__\__,_|_| |_|\_\___|_| |_| |_|\___|_| + +LithosAnanke v2.1.0 aarch64 +Architecture: aarch64 +Build: Oct 27 2026 18:54:18 + +UEFI BootServices: EXITED +Console: serial line is a PL011 at 0x0000000009000000 (no devicetree: QEMU's) + +=== StarKernel Boot Information === +Memory map entries: 110 +Total memory: 4093 MB +Usable memory: 4054 MB +=================================== + +PMM initialized. +PMM statistics: + Total pages: 1039249 + Free pages : 1037838 + Used pages : 1411 + Total MB : 4059 + Free MB : 4054 + Used MB : 5 + +VMM initialized (mapped RAM, CR3 switched) +VMM initialized (mapped RAM, CR3 switched) +VMM self-test: mapped OK at 0xffff800000000000 +VMM self-test complete. + +AArch64: running at EL1 +IDT installed. + +APIC: init... +PSCI: no DTB -- using HVC (QEMU virt-machine default) +GICv2: no DTB GIC node -- using QEMU virt-machine defaults +GICv2: distributor+CPU interface enabled, PPI 30 +APIC: init done + +Timer: init... +Timer: AArch64 generic timer initialised. +Timer: init done + +Kernel heap initialized. +Heap statistics: + Total bytes: 2147483608 + Free bytes: 2147483608 + Used bytes: 0 + Peak bytes: 0 + Heap base addr: 1207959552 + Heap end addr: 3355443200 + +Heartbeat: init... +Heartbeat: init done +Kernel initialization complete. +Boot successful! + +System: StarForth v4 (this build's default) +StarForth v4: one host node, the F18-derived engine +V4: capsule v4:sys:map-64.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:map-64.f18 capsule_hash=0x949eb6a1e9260e49 +V4: capsule v4:sys:core.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:core.f18 capsule_hash=0xb8f167892ec18c28 +V4: capsule v4:sys:input.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:input.f18 capsule_hash=0x85d3ec486d929a79 +V4: capsule v4:sys:dict.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:dict.f18 capsule_hash=0x1379bd3b5de811dc +V4: capsule v4:sys:codegen.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:codegen.f18 capsule_hash=0x36d2ae84d2911b90 +V4: capsule v4:sys:compile.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:compile.f18 capsule_hash=0x11145c4c2ab819d8 +V4: capsule v4:sys:quit.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:quit.f18 capsule_hash=0x43cadf3b21ddbf3e +V4: capsule v4:sys:forth.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:forth.f18 capsule_hash=0x16cab4a1268b85da +V4: capsule v4:sys:numout.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:numout.f18 capsule_hash=0x85a240ad3fb2b299 +V4: capsule v4:sys:words.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:words.f18 capsule_hash=0xb1d381f927d9f14e +V4: capsule v4:sys:system.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:system.f18 capsule_hash=0xd92203664c2915bd +V4: capsule v4:sys:qmath.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:qmath.f18 capsule_hash=0xdb4140713dd857f3 +V4: capsule v4:sys:blocks.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:blocks.f18 capsule_hash=0x76307ef48678dc2a +V4: capsule v4:sys:log.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:log.f18 capsule_hash=0xfc6540e6b824a52b +V4: capsule v4:sys:acl.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:acl.f18 capsule_hash=0x6845aa048db7eb22 +V4: capsule v4:sys:end.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:end.f18 capsule_hash=0x5ef01312c07b79cc +PARITY:V4_ROM words=2372 rom_hash=0x87b23d3ae2643c8d instructions=59145258 +V4: capsule v4:forth79.4th signature: missing (unsigned) +PARITY:V4_CAPSULE name=v4:forth79.4th capsule_id=0x4055641ee17d176b capsule_hash=0x4055641ee17d176b dict_hash=0x033e1c05c09a1df8 +PARITY:V4_POST tests=538 pass=538 fail=0 +PARITY:V4_SYSTEM word_count=317 dict_hash=0xfec8c47cfc6f437f +PARITY:OK +POST: PASSED +[HADES][INFO ] [KRELTSC: 0] blk: raw device LBN 2048..3071 (1024 blocks) +PCI: init... +virtio-blk: found device +[HADES][INFO ] [KRELTSC: 3522088] blk: disk 'StarForth Volume' v2 LBN 3072..789009 (785938 user b +Artemis: virtio-blk attached +virtio-input: found device +virtio-input: driver ready +Starting heartbeat... +Heartbeat running. +blkio_usb: MSC device ready +[HADES][INFO ] [KRELTSC: 334672071] blk: disk 'StarForth Volume' v2 LBN 789010..837733 (48724 user +[Hera] Zuse: identity confirmed from attached thumbdrive +[zuse@Hera] blkio_usb: MSC device ready +[zuse@Hera] [HADES][INFO ] [KRELTSC: 340242107] blk: disk 'StarForth Volume' v2 LBN 837734..1221275 (383542 use +[zuse@Hera] ok> 3 4 + . +[zuse@Hera] 7 ok +[zuse@Hera] ok>  \ No newline at end of file diff --git a/logs/20261027-185849/riscv64/qemu-riscv64-20261027-185849.log b/logs/20261027-185849/riscv64/qemu-riscv64-20261027-185849.log new file mode 100644 index 00000000..2faff8b8 --- /dev/null +++ b/logs/20261027-185849/riscv64/qemu-riscv64-20261027-185849.log @@ -0,0 +1,207 @@ + +OpenSBI v1.8 + ____ _____ ____ _____ + / __ \ / ____| _ \_ _| + | | | |_ __ ___ _ __ | (___ | |_) || | + | | | | '_ \ / _ \ '_ \ \___ \| _ < | | + | |__| | |_) | __/ | | |____) | |_) || |_ + \____/| .__/ \___|_| |_|_____/|____/_____| + | | + |_| + +Platform Name : riscv-virtio,qemu +Platform Features : medeleg +Platform HART Count : 1 +Platform HART Protection : pmp +Platform IPI Device : aclint-mswi +Platform Timer Device : aclint-mtimer @ 10000000Hz +Platform Console Device : uart8250 +Platform HSM Device : --- +Platform PMU Device : --- +Platform Reboot Device : syscon-reboot +Platform Shutdown Device : syscon-poweroff +Platform Suspend Device : --- +Platform CPPC Device : --- +Firmware Base : 0x80000000 +Firmware Size : 321 KB +Firmware RW Offset : 0x40000 +Firmware RW Size : 65 KB +Firmware Heap Offset : 0x47000 +Firmware Heap Size : 37 KB (total), 0 KB (reserved), 12 KB (used), 23 KB (free) +Firmware Scratch Size : 4096 B (total), 1464 B (used), 2632 B (free) +Runtime SBI Version : 3.0 +Standard SBI Extensions : ipi,pmu,srst,sse,hsm,rfnc,fwft,time,base,legacy,dbcn,dbtr +Experimental SBI Extensions : none + +Domain0 Name : root +Domain0 Boot HART : 0 +Domain0 HARTs : 0* +Domain0 Region00 : 0x0000000080040000-0x000000008005ffff M: (F,R,W) S/U: () +Domain0 Region01 : 0x0000000080000000-0x000000008003ffff M: (F,R,X) S/U: () +Domain0 Region02 : 0x0000000000100000-0x0000000000100fff M: (I,R,W) S/U: (R,W) +Domain0 Region03 : 0x0000000010000000-0x0000000010000fff M: (I,R,W) S/U: (R,W) +Domain0 Region04 : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: () +Domain0 Region05 : 0x000000000c400000-0x000000000c5fffff M: (I,R,W) S/U: (R,W) +Domain0 Region06 : 0x000000000c000000-0x000000000c3fffff M: (I,R,W) S/U: (R,W) +Domain0 Region07 : 0x0000000000000000-0xffffffffffffffff M: () S/U: (R,W,X) +Domain0 Next Address : 0x0000000020000000 +Domain0 Next Arg1 : 0x00000000bfe00000 +Domain0 Next Mode : S-mode +Domain0 SysReset : yes +Domain0 SysSuspend : yes + +Boot HART ID : 0 +Boot HART Domain : root +Boot HART Priv Version : v1.12 +Boot HART Base ISA : rv64imafdch +Boot HART ISA Extensions : sstc,zicntr,zihpm,zicboz,zicbom,sdtrig,svadu +Boot HART PMP Count : 16 +Boot HART PMP Granularity : 2 bits +Boot HART PMP Address Bits : 54 +Boot HART MHPM Info : 16 (0x0007fff8) +Boot HART Debug Triggers : 2 triggers +Boot HART MIDELEG : 0x0000000000001666 +Boot HART MEDELEG : 0x0000000000f4b509 +[=3hRISC-V EDK2 firmware version 2025.11-3ubuntu7.3 +Press ESCAPE within 5 seconds for boot options ERROR: C40000002:V03051002 I0 6D33944A-EC75-4855-A54D-809C75241F6C 83FFF850 +BdsDxe: failed to load Boot0001 "UEFI Misc Device" fr +om PciRoot(0x0)/Pci(0x1,0x0): Not Found +[=3hStarKernel UEFI Loader +Loading kernel from ESP... +[CKPT 001] Entered efi_main - ConOut live +Monolithic build - kernel linked directly +Collecting boot information... +CmdLine: from starforth.cfg +CmdLine: parsed OK +[CKPT 004] Command line parsed +[CKPT 005] Kernel stack allocation decided +[CKPT 006] Boot info collected (ACPI table located) +GOP: linear framebuffer found +[CKPT 007] GOP: linear framebuffer found +[CKPT 008] About to enter ExitBootServices retry loop +Calling kernel_main (monolithic)... +riscv64 item 4.3.5a: satp state at kernel entry (before switch) + satp.MODE = 0x000000000000000a + satp.PPN = 0x00000000000bf868 + __kernel_start = 0x00000000bdc07efa +riscv64: satp cleared -- Bare mode, explicit (item 4.3.5a) + + + _____ _ _ __ _ + / ____| | | |/ / | | + | (___ | |_ __ _ _ __| ' / ___ _ __ _ __ ___| | + \___ \| __/ _` | '__| < / _ \ '__| '_ \ / _ \ | + ____) | || (_| | | | . \ __/ | | | | | __/ | + |_____/ \__\__,_|_| |_|\_\___|_| |_| |_|\___|_| + +LithosAnanke v2.1.0 riscv64 +Architecture: riscv64 +Build: Oct 27 2026 18:58:08 + +UEFI BootServices: EXITED +Console: serial line is a 16550 at 0x0000000010000000 (no devicetree: QEMU's) + +=== StarKernel Boot Information === +Memory map entries: 96 +Total memory: 1020 MB +Usable memory: 974 MB +=================================== + +PMM initialized. +PMM statistics: + Total pages: 250168 + Free pages : 249516 + Used pages : 652 + Total MB : 977 + Free MB : 974 + Used MB : 2 + +VMM initialized (mapped RAM, CR3 switched) +VMM initialized (mapped RAM, CR3 switched) +VMM self-test: mapped OK at 0xffff800000000000 +VMM self-test complete. + +IDT installed. + +APIC: init... +PLIC: no DTB PLIC node -- using QEMU virt-machine default (base=0x0c000000) +PLIC: init (S-mode context 1, threshold=0) +APIC: init done + +Timer: init... +Timer: RISC-V time CSR @ 10000000 Hz (FALLBACK, no devicetree) +Timer: init done + +Kernel heap initialized. +Heap statistics: + Total bytes: 536870872 + Free bytes: 536870872 + Used bytes: 0 + Peak bytes: 0 + Heap base addr: 2214588416 + Heap end addr: 2751459328 + +Heartbeat: init... +Heartbeat: init done +Kernel initialization complete. +Boot successful! + +System: StarForth v4 (this build's default) +StarForth v4: one host node, the F18-derived engine +V4: capsule v4:sys:map-64.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:map-64.f18 capsule_hash=0x949eb6a1e9260e49 +V4: capsule v4:sys:core.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:core.f18 capsule_hash=0xb8f167892ec18c28 +V4: capsule v4:sys:input.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:input.f18 capsule_hash=0x85d3ec486d929a79 +V4: capsule v4:sys:dict.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:dict.f18 capsule_hash=0x1379bd3b5de811dc +V4: capsule v4:sys:codegen.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:codegen.f18 capsule_hash=0x36d2ae84d2911b90 +V4: capsule v4:sys:compile.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:compile.f18 capsule_hash=0x11145c4c2ab819d8 +V4: capsule v4:sys:quit.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:quit.f18 capsule_hash=0x43cadf3b21ddbf3e +V4: capsule v4:sys:forth.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:forth.f18 capsule_hash=0x16cab4a1268b85da +V4: capsule v4:sys:numout.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:numout.f18 capsule_hash=0x85a240ad3fb2b299 +V4: capsule v4:sys:words.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:words.f18 capsule_hash=0xb1d381f927d9f14e +V4: capsule v4:sys:system.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:system.f18 capsule_hash=0xd92203664c2915bd +V4: capsule v4:sys:qmath.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:qmath.f18 capsule_hash=0xdb4140713dd857f3 +V4: capsule v4:sys:blocks.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:blocks.f18 capsule_hash=0x76307ef48678dc2a +V4: capsule v4:sys:log.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:log.f18 capsule_hash=0xfc6540e6b824a52b +V4: capsule v4:sys:acl.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:acl.f18 capsule_hash=0x6845aa048db7eb22 +V4: capsule v4:sys:end.f18 signature: missing (unsigned) +PARITY:V4_F18 name=v4:sys:end.f18 capsule_hash=0x5ef01312c07b79cc +PARITY:V4_ROM words=2372 rom_hash=0x87b23d3ae2643c8d instructions=59145258 +V4: capsule v4:forth79.4th signature: missing (unsigned) +PARITY:V4_CAPSULE name=v4:forth79.4th capsule_id=0x4055641ee17d176b capsule_hash=0x4055641ee17d176b dict_hash=0x033e1c05c09a1df8 +PARITY:V4_POST tests=538 pass=538 fail=0 +PARITY:V4_SYSTEM word_count=317 dict_hash=0xfec8c47cfc6f437f +PARITY:OK +POST: PASSED +[HADES][INFO ] [KRELTSC: 0] blk: raw device LBN 2048..3071 (1024 blocks) +PCI: init... +virtio-blk: found device +[HADES][INFO ] [KRELTSC: 68409978] blk: disk 'StarForth Volume' v2 LBN 3072..789009 (785938 user b +Artemis: virtio-blk attached +virtio-input: found device +virtio-input: driver ready +Starting heartbeat... +SBI: timer armed (TIME extension) +Heartbeat running. +blkio_usb: MSC device ready +[HADES][INFO ] [KRELTSC: 10636363794] blk: disk 'StarForth Volume' v2 LBN 789010..837733 (48724 user +[Hera] Zuse: identity confirmed from attached thumbdrive +[zuse@Hera] blkio_usb: MSC device ready +[zuse@Hera] [HADES][INFO ] [KRELTSC: 10697949003] blk: disk 'StarForth Volume' v2 LBN 837734..1221275 (383542 use +[zuse@Hera] ok> 3 4 + . +[zuse@Hera] 7 ok +[zuse@Hera] ok>  \ No newline at end of file diff --git a/scripts/check_images.sh b/scripts/check_images.sh index 561e25a6..2d1255d1 100755 --- a/scripts/check_images.sh +++ b/scripts/check_images.sh @@ -64,8 +64,10 @@ artemis_check() { # artemis_check IMG N -- mkartemis --check on partition N uuid() { artemis_check "$1" "$2" 2>/dev/null | sed -n 's/.*disk_uuid \([0-9a-f]*\).*/\1/p'; } echo "== building" -make boot_image TARGET=PC >/dev/null 2>&1; echo "boot_image exit $?" -make -f kernel/Makefile ARCH=amd64 datastick >/dev/null 2>&1; echo "datastick exit $?" +# no image from an earlier run may stand in for one this run failed to build +rm -f "$STICK" "$DATA" +check "the stick builds (make boot_image TARGET=PC)" make boot_image TARGET=PC +check "the data stick builds (make datastick)" make -f kernel/Makefile ARCH=amd64 datastick echo "== the stick ($STICK)" check "it exists, 2048 MiB" eq "$(stat -c %s "$STICK" 2>/dev/null)" "$((2048 * 1048576))" @@ -92,10 +94,42 @@ check "sfdisk --verify: the GPT is clean" sfdisk --verify "$DATA" check "the identity partition is all zeros" zeros "$DATA" 1 check "Artemis: STFR v2, signature ok" artemis_check "$DATA" 2 U1=$(uuid "$DATA" 2) -make -f kernel/Makefile ARCH=amd64 datastick >/dev/null 2>&1 +check "the data stick builds again" make -f kernel/Makefile ARCH=amd64 datastick U2=$(uuid "$DATA" 2) check "made again, it is fresh: its own disk_uuid ($U1 / $U2)" test -n "$U1" -a -n "$U2" -a "$U1" != "$U2" +echo "== mkartemis refuses what it cannot do safely" +T=build/amd64/kernel/tools/check-images; mkdir -p "$T" +fresh() { rm -f "$T/t.img"; truncate -s 64M "$T/t.img"; } +untouched() { cmp -s -n $((64 * 1048576)) "$T/t.img" /dev/zero; } +refused() { ! "$MKARTEMIS" --format "$T/t.img" --first-lba "$1" --sectors "$2" && untouched; } +for bad in abc "" -2 2048x " 2048" +2048 99999999999999999999999; do + fresh; check "--first-lba '$bad' refused, nothing written" refused "$bad" 63488 + fresh; check "--sectors '$bad' refused, nothing written" refused 2048 "$bad" +done +# a header write that does not land: --format reads the volume back and fails +cat > "$T/failhdr.c" <<'SHIM' +#define _GNU_SOURCE +#include +#include +#include +#include +ssize_t pwrite(int fd, const void *b, size_t n, off_t off) +{ + static ssize_t (*real)(int, const void *, size_t, off_t); + const char *at = getenv("FAIL_AT"); + if (!real) real = (ssize_t (*)(int, const void *, size_t, off_t))dlsym(RTLD_NEXT, "pwrite"); + if (at && off == (off_t)strtoll(at, NULL, 10)) { errno = EIO; return -1; } + return real(fd, b, n, off); +} +SHIM +cc -shared -fPIC -o "$T/failhdr.so" "$T/failhdr.c" -ldl +fresh +check "a header write that fails, fails --format" eval '! FAIL_AT=$((2048 * 512)) LD_PRELOAD="$T/failhdr.so" "$MKARTEMIS" --format "$T/t.img" --first-lba 2048 --sectors 63488' +fresh +check "a good format reads back" "$MKARTEMIS" --format "$T/t.img" --first-lba 2048 --sectors 63488 +rm -f "$T/t.img" + # the builds regenerate these; put them back as committed (as qemu_session.py does) git checkout -q -- v3/include/version.h capsules/BLOCK_MAP.md sbom.spdx sbom.spdx.json diff --git a/tools/mkartemis.c b/tools/mkartemis.c index e1f02f88..cab7d282 100644 --- a/tools/mkartemis.c +++ b/tools/mkartemis.c @@ -115,6 +115,55 @@ static int usage(void) return 2; } +/* A sector count: decimal digits only, the whole string, no overflow. */ +static int parse_count(const char *s, unsigned long long *out) +{ + char *end; + if (*s < '0' || *s > '9') return -1; + errno = 0; + *out = strtoull(s, &end, 10); + return (errno != 0 || *end != '\0') ? -1 : 0; +} + +/* Put the partition into the block subsystem: its first LBN and user blocks. */ +static int attach(blkio_dev_t *dev, uint32_t *start_lbn, uint32_t *count) +{ + if (blk_subsys_init(g_ram, sizeof(g_ram)) != BLK_OK || blk_subsys_attach_device(dev) != BLK_OK || + blk_get_device_range(dev, start_lbn, count) != BLK_OK) { + fprintf(stderr, "mkartemis: the block subsystem would not take the partition\n"); + return -1; + } + return 0; +} + +/* The partition holds an STFR v2 volume and a good Artemis signature. The + * header is read from the disk itself and judged as attach judges it + * (block_subsystem.c blk_format_or_load_disk): blk_get_volume_meta would give + * the geometry computed in memory for a blank disk, magic and all. */ +static int check_volume(blkio_dev_t *dev, uint32_t *count, artemis_sig_t *sig) +{ + static uint8_t hdr[BLK_DEVICE_SECTOR]; + blk_volume_meta_t meta; + artemis_sig_result_t src; + uint32_t i; + uint32_t start_lbn; + int rc = -1; + + if (attach(dev, &start_lbn, count) != 0) return -1; + for (i = 0; i < BLK_DEVICE_SECTOR / BLKIO_FORTH_BLOCK_SIZE; i++) + if (blkio_read(dev, i, hdr + i * BLKIO_FORTH_BLOCK_SIZE) != BLKIO_OK) memset(hdr, 0, sizeof(hdr)); + memset(&meta, 0, sizeof(meta)); + memcpy(&meta, hdr, sizeof(meta) < sizeof(hdr) ? sizeof(meta) : sizeof(hdr)); + if (meta.magic != 0x53544652u || meta.version != 2u || meta.bam_devblocks == 0u) + fprintf(stderr, "mkartemis: no STFR v2 volume header\n"); + else if ((src = artemis_sig_check(dev, sig)) != ARTEMIS_SIG_OK) + fprintf(stderr, "mkartemis: the Artemis signature does not check out (%d)\n", (int)src); + else + rc = 0; + blk_subsys_shutdown(); + return rc; +} + int main(int argc, char **argv) { const char *mode, *img; @@ -132,8 +181,10 @@ int main(int argc, char **argv) if (strcmp(mode, "--format") == 0) format = 1; else if (strcmp(mode, "--check") == 0) format = 0; else return usage(); - first_lba = strtoull(argv[4], NULL, 10); - sectors = strtoull(argv[6], NULL, 10); + if (parse_count(argv[4], &first_lba) != 0 || parse_count(argv[6], §ors) != 0) { + fprintf(stderr, "mkartemis: --first-lba and --sectors take a number of sectors\n"); + return 1; + } if (first_lba % 2u != 0u || sectors % 2u != 0u || sectors == 0u || sectors / 2u > 0xFFFFFFFFull) { fprintf(stderr, "mkartemis: the partition must start and end on a 1 KiB block (even LBA and sector count)\n"); return 1; @@ -150,13 +201,8 @@ int main(int argc, char **argv) if (blkio_open(&dev, &g_range_vt, ¶ms) != BLKIO_OK) { fprintf(stderr, "mkartemis: cannot open the range\n"); return 1; } sf_time_init(); - if (blk_subsys_init(g_ram, sizeof(g_ram)) != BLK_OK || blk_subsys_attach_device(&dev) != BLK_OK || - blk_get_device_range(&dev, &start_lbn, &count) != BLK_OK) { - fprintf(stderr, "mkartemis: the block subsystem would not take the partition\n"); - return 1; - } - if (format) { + if (attach(&dev, &start_lbn, &count) != 0) return 1; if (artemis_sig_check(&dev, &sig) != ARTEMIS_SIG_BLANK) { fprintf(stderr, "mkartemis: the partition is not blank -- not formatted\n"); return 1; @@ -164,20 +210,20 @@ int main(int argc, char **argv) if (blk_subsys_confirm_format(start_lbn) != BLK_OK) { fprintf(stderr, "mkartemis: format failed\n"); return 1; } blk_subsys_shutdown(); if (artemis_sig_genesis_stamp(&dev) != 0) { fprintf(stderr, "mkartemis: the signature stamp failed\n"); return 1; } - printf("mkartemis: formatted %u blocks, STFR v2, signature stamped\n", r.blocks); - } else { - blk_volume_meta_t meta; - artemis_sig_result_t src; - if (blk_get_volume_meta(&meta) != BLK_OK || meta.magic != 0x53544652u || meta.version != 2u) { - fprintf(stderr, "mkartemis: no STFR v2 volume header\n"); + /* blk_commit_format does not report a failed write: read the volume back, read-only */ + close(r.fd); + r.fd = open(img, O_RDONLY); + r.read_only = 1; + if (r.fd < 0 || check_volume(&dev, &count, &sig) != 0) { + fprintf(stderr, "mkartemis: the format did not read back -- the partition is not usable\n"); return 1; } - src = artemis_sig_check(&dev, &sig); - if (src != ARTEMIS_SIG_OK) { fprintf(stderr, "mkartemis: the Artemis signature does not check out (%d)\n", (int)src); return 1; } + printf("mkartemis: formatted %u blocks, STFR v2, signature stamped, read back ok\n", r.blocks); + } else { + if (check_volume(&dev, &count, &sig) != 0) return 1; printf("mkartemis: STFR v2, %u user blocks, signature ok, disk_uuid ", count); for (i = 0; i < 16; i++) printf("%02x", sig.disk_uuid[i]); printf("\n"); - blk_subsys_shutdown(); } close(r.fd); return 0;