Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@

# Files
GEMINI.md
nul
null
esp/NvVars
43 changes: 34 additions & 9 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,49 @@
#!/bin/bash
set -e
#!/usr/bin/env bash
set -euo pipefail

echo "[build] Compiling kernel..."
cargo build --target x86_64-unknown-uefi
KERNEL_TARGET="x86_64-unknown-uefi"
USERLAND_TARGET="x86_64-unknown-none"
TARGETS=(
"$KERNEL_TARGET"
"$USERLAND_TARGET"
)
EFI_NAME="mana_os.efi"

echo "[build] Setting up ESP..."
if ! command -v rustup >/dev/null 2>&1; then
echo "[ERROR] rustup is required for reproducible target setup!!"
exit 1
fi

for TARGET in "${TARGETS[@]}"; do
if ! rustup target list --installed | grep -qx "$TARGET"; then
echo "[SETUP] Installing RUST target: $TARGET"
rustup target add "$TARGET"
fi
done

echo "[BUILD] Compiling the KERNEL..."
cargo build --target "$KERNEL_TARGET"

echo "[BUILD] Setting up ESP..."
mkdir -p esp/EFI/BOOT
cp target/x86_64-unknown-uefi/debug/mana_os.efi esp/EFI/BOOT/BOOTX64.EFI
cp "target/$KERNEL_TARGET/debug/$EFI_NAME" esp/EFI/BOOT/BOOTX64.EFI

if [ ! -f disk.img ]; then
echo "[build] Creating disk.img..."
echo "[BUILD] Creating disk.img..."
dd if=/dev/zero of=disk.img bs=1M count=64
fi

echo "[run] Starting QEMU..."
if [ ! -f OVMF.fd ]; then
echo "[ERROR] Missing OVMF.fd. Install/copy OVMF firmware into the repo root."
exit 1
fi

echo "[RUN] Starting QEMU..."
qemu-system-x86_64 \
-display gtk,zoom-to-fit=on \
-drive if=pflash,format=raw,readonly=on,file=OVMF.fd \
-drive format=raw,file=fat:rw:esp \
-drive file=disk.img,if=none,id=drive0,format=raw \
-device ahci,id=ahci0 \
-device ide-hd,drive=drive0,bus=ahci0.0 \
-serial stdio
-serial stdio
7 changes: 7 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[toolchain]
channel = "nightly"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question/nit: since channel = "nightly" isn't date-pinned, this toolchain could
silently shift over time — today's unused_unsafe situation with __cpuid is
actually a good example of how a nightly-only safety-contract change can flip a
build from passing to failing between two people's local runs (or between CI runs
on different days).

Would it make sense to pin this to a dated nightly (e.g. nightly-2026-06-15) for
reproducibility? Not blocking this PR, just flagging for discussion.

targets = [
"x86_64-unknown-uefi",
"x86_64-unknown-none",
]
components = ["rust-src"]