foundry
Foundry OS: the operating system built on the Rustbelt kernel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | #!/usr/bin/env bash
# Build the boot-contract-v2 disk image (docs/boot-contract.md): ONE disk,
# GPT, three partitions, each file system made as its own file first and
# then copied into place (no root, no loop mounts):
#
# p1 ROOT_MIB Linux root (x86-64) ext2 mke2fs -d A: /
# p2 DATA_MIB Microsoft basic data FAT32 mkfs.vfat+mtools B: /mnt/disk0
# p3 SHARE_MIB Microsoft basic data exFAT mkfs.exfat + scripts/exfat.py
# C: /mnt/share
#
# Rustbelt 0.21 mounts the first Linux-root partition holding ext2 at /,
# the first basic-data exFAT partition at /mnt/share, and numbers the
# others /mnt/disk0, /mnt/disk1, ... -- so the FAT32 one is /mnt/disk0.
#
# Usage: scripts/mkimage-v2.sh STAGING IMAGE "B:/bin order..."
# STAGING/root, STAGING/data, STAGING/share: the three trees.
STAGING= IMAGE= ORDER=
ROOT_MIB= DATA_MIB= SHARE_MIB=
PATH=:/usr/sbin:/sbin
# 2026-01-01, for repeatable ext2 times
HERE=
MIB=2048 # sectors per MiB
P1= P2= P3=
END= # then 1 MiB for the backup GPT
# p1: ext2. -b 1024 like the kernel's own test root; -m 0: no blocks
# reserved for root; root_owner: files owned by root, not by whoever builds.
# p2: FAT32, filled with mtools: the top level, then bin/ in ORDER.
for; do
[ && continue
done
for; do
[ || { ; ; }
done
# p3: exFAT, one FAT (two would be TexFAT, which Rustbelt mounts read-only).
|| { ; ; }
# The disk: zeros + GPT, then the three file systems.
for; do
done
|