Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/sovereign-intelligence/blob/main/seed/rung0/load0.sh # sovereign-intelligence Front door to Drake Stapleton's sovereign stack. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `sovereign-intelligence / seed / rung0 / load0.sh` 24 lines ยท 1048 bytes Raw Blame History 1 #!/bin/sh 2 # load0.sh -- the one outside tool of the seed chain (named in seed/README.md). 3 # Used once, to turn the hand-written seed0.hex into seed0.bin before any seed program exists. 4 # POSIX shell and its printf only (no gcc, as, ld, xxd). Strict: after the comment ('#' to end of line) 5 # is cut, a line is empty or holds exactly one word of 8 hex digits; anything else stops the load. 6 # Each word goes out lowest byte first (little-endian), as seed0 itself writes it. 7 set -eu 8 [ $# -eq 2 ] || { echo "usage: load0.sh " >&2; exit 2; } 9 n=0 10 : > "$2" 11 while IFS= read -r line || [ -n "$line" ]; do 12 n=$((n + 1)) 13 w=${line%%#*} 14 w=$(printf '%s' "$w" | tr -d ' \t\r') 15 [ -z "$w" ] && continue 16 case $w in 17 [0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) ;; 18 *) echo "load0: line $n: not one 8-digit hex word: '$w'" >&2; exit 1 ;; 19 esac 20 v=$((0x$w)) 21 for s in 0 8 16 24; do 22 printf "\\$(printf '%03o' $(( (v >> s) & 255 )))" 23 done >> "$2" 24 done < "$1"