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
# M1 check: compare our image with the kernel's own disk.img, file by file.
# Both are GPT + FAT32; mtools reads the partition at byte offset 1 MiB
# (`-i image@@1M`), so nothing is mounted.
#
# Prints: the /bin program lists side by side (must be equal), the other
# files (must be equal, byte for byte), and for each program whether the
# bytes are identical. Rust programs built by Cargo are expected to differ
# in bytes from the kernel's single-file rustc builds (Cargo adds crate
# metadata), so only list equality and non-program files fail the check.
#
# Since M2 our image has more than the kernel's: Foundry OS's own programs
# (env FOUNDRY_BIN, left out of the list comparison), files of its own
# outside /bin (env FOUNDRY_FILES, paths relative to the image root, left
# out) and a "Foundry OS" block in scripts/selftest.sh (cut out before
# comparing that file).
#
# Usage: [FOUNDRY_BIN="prog ..."] [FOUNDRY_FILES="path ..."] scripts/compare-image.sh OURS KERNELS OUT_DIR
fail=0
OURS= THEIRS= OUT=/compare
&&
( && | LC_ALL=C )
||
for; do [ || { ; fail=1; }; done
for; do
if [; then ;
else ; fail=1; fi
done
# Our selftest.sh = the kernel's + a "Foundry OS" block; compare without it.
( && | LC_ALL=C )
if ; then
else
; fail=1
fi
( && | LC_ALL=C )
( && | LC_ALL=C )
if ! ; then fail=1; fi
while ; do
if [ && ; then
else ; fail=1; fi
done
same=0 diff=0
while ; do
[ || continue
a= b=
if ; then
; same=
else
; diff=
fi
done
[ && || { ; ; }
|