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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | # Foundry OS -- the single entry point. `make help` lists the targets.
#
# Everything generated goes to out/ (git-ignored); `make clean` removes it.
# Downloads (musl source etc.) go to cache/ (git-ignored, SHA256-checked).
include config.mk
OUT := $(CURDIR)/out
IMAGE_V2 := $(OUT)/$(IMAGE_NAME)
IMAGE_V1 := $(OUT)/$(IMAGE_V1_NAME)
IMAGE := )
STAGING_V1 := $(OUT)/staging-v1
STAGING_V2 := $(OUT)/staging-v2
RUST_OUT := $(OUT)/rust-target/x86_64-unknown-none/release
FIXTURES := $(OUT)/fixtures
KSRC := $(OUT)/kernel-src
KTARGET := $(OUT)/kernel-target
KBOOT := $(OUT)/kernel/bootimage.bin
KBOOT_HL := $(OUT)/kernel/bootimage-headless.bin
SYSROOT := $(OUT)/sysroot
FCC := $(CURDIR)/toolchain/foundry-cc
C_OUT := $(OUT)/c
# Everything in /bin, in order: the kernel's list, then Foundry OS's own.
ALL_BIN := $(BIN_ORDER) $(FOUNDRY_C) $(FOUNDRY_PORTS)
PORTS_OUT := $(OUT)/ports
SBASE_OUT := $(PORTS_OUT)/sbase
# Contract v2: the kernel's ABI test programs live on B: (/mnt/disk0/bin),
# in the kernel's order; everything else is in A:/bin.
DATA_BIN := )
.DEFAULT_GOAL := image
:
:
# ---- the pinned kernel -------------------------------------------------------
:
:
# ---- programs ---------------------------------------------------------------
:
: # Our own C programs: gcc + our musl, static-PIE (docs/porting.md).
: # Ports: each one is fetched into cache/ (SHA256-checked) and built once;
# delete out/ports/bin/NAME to rebuild it.
:
: # sbase (M4): ~100 small tools, built once into out/ports/sbase/bin/. They
# go to /usr/lib/sbase on the v2 root, off the default PATH (ports/README.md).
:
: # ---- the image ---------------------------------------------------------------
:
# Contract v1: rootfs/ goes to the top of the FAT32 volume, all programs to
# /bin, rbsh as /bin/sh (the kernel runs /mnt/disk0/bin/sh).
: : # Contract v2 (docs/boot-contract.md): three trees, one per partition.
# root/ -> A: (ext2 root): /sbin/init, our programs in /bin, /etc, /scripts
# data/ -> B: (FAT32, /mnt/disk0): rootfs/ minus scripts/, + the ABI fixtures in bin/
# share/ -> C: (exFAT, /mnt/share): share/
: : # ---- booting ----------------------------------------------------------------
: # What the expected-line checks need to know about the pinned kernel.
TEST_ENV := KERNEL_BANNER="$(KERNEL_BANNER)" KERNEL_VERSION=$(KERNEL_VERSION)
:
# v2: boots a writable copy (out/test-v2.img) so the host can check what
# the run left behind: fsck of all three file systems, and the file the
# self-test wrote to the share (scripts/check-v2-image.sh).
: : # The baseline: the kernel's own disk.img through the very same v1 checks
# (without Foundry OS's own programs and expected lines, which it lacks).
: : # Host unit tests (`cargo test` on the build machine, no QEMU): rbsh's
# parser is pure Rust, so rust/rbsh/host-tests compiles it for the host.
# Run from the repository root so rust/.cargo/config.toml (which picks the
# Rustbelt target) does not apply.
:
# The old name for `make unit` (the parser test is now one of its cargo tests).
:
# K1 (kernel 0.21.0+): the kernel's own build takes our image as disk 0.
# Uses its own target dir, so out/kernel-target (the reference) is untouched.
: # ---- toolchain ---------------------------------------------------------------
# musl is built once; delete out/sysroot (or run `make musl`) to rebuild it.
:
: :
: |