Files
LithosAnanke/scripts/bleach_zuse_img.sh
T
Claude 3bd81097e1 chore(license): an SPDX header on every source file that had none (LicenseRef-Starship-1.0) [skip ci]
The header scan (Captain Bob, 2026-11-10): 788 source files -- 351 with the
SL-1.0 header, 12 with the old name (docs/working/experiments, kept by
ruling), 31 under someone else's licence (tools/kconfig, Linux's, GPL-2.0:
kept), and 394 with none. Ruled: the SPDX form; capsules (.4th, .f18) and
proofs (.thy) left for a ruling of their own (mkcapsule's 64x16 block format,
content-addressed capsules).

253 files now begin
    SPDX-License-Identifier: LicenseRef-Starship-1.0
    Copyright (c) 2023-2026 Robert A. James
as a /* */ block (C, headers, assembly, linker scripts) or # lines (scripts,
Makefiles, Kconfig; below a shebang or a coding line); tools/mkcapsule.c,
which had the copyright line, gets the SPDX line only.

Not touched: docs/working/ (archive and old campaign material, as the
ruling kept the experiments); v4/system/post_cases.c (generated by
v4/tools/mkpost.py, "do not edit" -- the generator has the header).

Comments only: the kernel builds on amd64, aarch64, riscv64; make -C v4
test-32: 39 programs, 0 failures; every changed script parses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
2026-11-10 04:12:49 +00:00

58 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: LicenseRef-Starship-1.0
# Copyright (c) 2023-2026 Robert A. James
# bleach_zuse_img.sh - Reset disk/zuse.img (or any home-blocks test image)
# back to pristine/unminted state.
#
# disk/zuse.img simulates the physical Zuse superuser thumbdrive for QEMU
# testing (FABRIC-2.md, Phase 8 kickoff). "Bleaching" it means restoring the
# all-zero blank state homeblocks_sig_check() reads as HOMEBLOCKS_SIG_BLANK
# -- i.e. simulating a genuine first boot, so the one-time mint-Zuse flow can
# be exercised repeatedly during development without hand-regenerating the
# whole image each time.
#
# 64MB is only this script's default -- an arbitrary QEMU-test convenience
# size (matching the existing usb-thumbdrive-test.img precedent for BOT
# driver testing scale), not a constraint on real home-blocks thumbdrives.
# The design is not bound to any particular drive size: homeblocks_sig_t's
# own metadata_devblocks field records whatever size is actually observed,
# nothing in the format or this repo hardcodes one. Override with --size-mb
# for a different test size.
#
# Deliberately a flat/raw image, not GPT-partitioned, matching the same
# simplifying assumption homeblocks_sig_check()'s current call site in
# repl.c uses (sig_start_fblock=0) -- both will need to move to a real
# GPT-partition-relative offset together, once a GPT parser exists. Not
# invented ahead of that work here.
#
# Usage: scripts/bleach_zuse_img.sh [path] [--size-mb N]
# path Optional override; defaults to disk/zuse.img relative to repo root.
# --size-mb N Optional override; defaults to 64 (arbitrary test convenience, see above).
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
IMG="$REPO_ROOT/disk/zuse.img"
SIZE_MB=64
while [ $# -gt 0 ]; do
case "$1" in
--size-mb)
SIZE_MB="$2"
shift 2
;;
*)
IMG="$1"
shift
;;
esac
done
if [ -e "$IMG" ] && [ ! -f "$IMG" ]; then
echo "bleach_zuse_img: refusing to overwrite non-regular-file '$IMG'" >&2
exit 1
fi
dd if=/dev/zero of="$IMG" bs=1M count="$SIZE_MB" status=none
echo "bleach_zuse_img: $IMG reset to ${SIZE_MB}MB blank (pristine/unminted)"