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 | #!/usr/bin/env bash
# K1 check (kernel 0.21.0+): the kernel's own build can take our image as
# its disk 0. With RUSTBELT_DISK0=out/foundry.img, the kernel's build.rs
# copies our image to $CARGO_TARGET_DIR/disk.img instead of making its own,
# and skips the programs that moved to Foundry OS. This builds the pinned
# kernel that way, in its OWN target dir (out/kernel-k1-target, so the
# normal out/kernel-target with the kernel's reference disk.img is left
# alone), and checks:
# 1. the disk.img it ends up with is byte-identical to our image;
# 2. none of the moved programs (sh, ls, cat, ...) was built.
# After that, the kernel's own tooling (`cargo run`, `cargo test`, its
# scripts/run-headless.sh) boots Foundry OS: run it in out/kernel-src with
# the same two variables, e.g.
# cd out/kernel-src && RUSTBELT_DISK0=../foundry.img \
# CARGO_TARGET_DIR=../kernel-k1-target cargo run
#
# Usage: scripts/k1-check.sh IMAGE KERNEL_SRC TARGET_DIR "MOVED PROGRAMS"
IMAGE= SRC= T= MOVED=
&& ( && RUSTBELT_DISK0="" CARGO_TARGET_DIR="" )
ok=1
if ; then
else
; ok=0
fi
# build.rs puts the user programs it builds in its OUT_DIR
# ($T/x86_64-rust_kernel/debug/build/rustbelt/HASH/out/).
# Only the files directly in out/ (out/rootfs-tree/bin/sh is the kernel's
# boot-v2 test init, not a moved program).
built=
[ || { ; ok=0; }
for; do
if | ; then ; ok=0; fi
done
[ &&
[
|