summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-01 01:56:12 +0200
committersalmonik <salmonik@tuta.io>2026-08-01 01:56:12 +0200
commit4ea992c71dd0cdcffe0f74216e748256bd700a31 (patch)
tree2992b0063f08fbf79586d35ad481539fd7ee9af4 /Makefile
parentahci: skip ATAPI ports and fast-fail on device abort (diff)
downloadrs-dos-4ea992c71dd0cdcffe0f74216e748256bd700a31.tar.gz
rs-dos-4ea992c71dd0cdcffe0f74216e748256bd700a31.zip
scripts: automate the data-disk workflow (mkdisk / sendkeys / test-disk)
- scripts/mkdisk.sh: create the FAT32 disk with mkfs.fat -C (the flag that actually creates the file — plain mkfs.fat fails on a missing path), accept M/G/K sizes, seed seed/ files via mtools; --fresh re-formats, --no-seed skips seeding - scripts/sendkeys.py: type lines into the guest via the QEMU monitor (US layout). Punctuation must use QEMU's named keys (minus, slash, dot, ...) — bare '-', '.', '/' are not valid sendkey names, and '-' is the modifier separator, so they were silently dropped before - scripts/test-disk.sh: full automated round trip — build, deploy, ensure image, boot headless QEMU, drive the shell (ls /disk, mkdir, echo >, cat, poweroff), then verify with fsck.fat (must be clean) and mtype (file content must have survived poweroff) - Makefile: make disk / disk-fresh / inspect / test-disk; run, run-gui and debug now auto-create a missing DISK_IMG; fix the stale comment (mkfs.fat without -C) - scripts/boot.sh: auto-create a missing DISK_IMG via mkdisk.sh - seed/: motd.txt + lines.txt seeded onto fresh images - Verified end to end: ./scripts/test-disk.sh --fresh passes
Diffstat (limited to '')
-rw-r--r--Makefile38
1 files changed, 33 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 7701d9d..01e265a 100644
--- a/Makefile
+++ b/Makefile
@@ -11,10 +11,10 @@ export BOOTLOADER=rsboot/rsboot.efi
11export OVMF=/usr/share/edk2/x64/OVMF.4m.fd 11export OVMF=/usr/share/edk2/x64/OVMF.4m.fd
12export BOOT_EFI=$(ESP_DIR)/EFI/BOOT/BOOTX64.EFI 12export BOOT_EFI=$(ESP_DIR)/EFI/BOOT/BOOTX64.EFI
13# Attach a raw disk image as the SATA drive (disk.img -> ide.0, ESP -> ide.1). 13# Attach a raw disk image as the SATA drive (disk.img -> ide.0, ESP -> ide.1).
14# Create one with: mkfs.fat -F 32 -n RSDOS disk.img && mcopy -i disk.img files :: 14# Create one with: make disk (or: ./scripts/mkdisk.sh)
15export DISK_IMG ?= /tmp/disk.img 15export DISK_IMG ?= /tmp/disk.img
16 16
17.PHONY: all run run-gui clean image debug release fmt bootloader boot-image 17.PHONY: all run run-gui clean image debug release fmt bootloader boot-image disk disk-fresh inspect test-disk
18 18
19# ---- Build --------------------------------------------------------------- 19# ---- Build ---------------------------------------------------------------
20 20
@@ -43,7 +43,7 @@ $(INITRD): | $(ESP_DIR)
43 43
44# ---- QEMU runners -------------------------------------------------------- 44# ---- QEMU runners --------------------------------------------------------
45 45
46run: all 46run: all disk
47 qemu-system-x86_64 \ 47 qemu-system-x86_64 \
48 -bios $(OVMF) \ 48 -bios $(OVMF) \
49 -drive file=$(DISK_IMG),format=raw,if=none,id=disk \ 49 -drive file=$(DISK_IMG),format=raw,if=none,id=disk \
@@ -57,7 +57,7 @@ run: all
57 -no-reboot \ 57 -no-reboot \
58 -display none 58 -display none
59 59
60run-gui: all 60run-gui: all disk
61 qemu-system-x86_64 \ 61 qemu-system-x86_64 \
62 -bios $(OVMF) \ 62 -bios $(OVMF) \
63 -drive file=$(DISK_IMG),format=raw,if=none,id=disk \ 63 -drive file=$(DISK_IMG),format=raw,if=none,id=disk \
@@ -72,7 +72,7 @@ run-gui: all
72 -vga std 72 -vga std
73 73
74# GDB stub on :1234 74# GDB stub on :1234
75debug: all 75debug: all disk
76 qemu-system-x86_64 \ 76 qemu-system-x86_64 \
77 -bios $(OVMF) \ 77 -bios $(OVMF) \
78 -drive file=$(DISK_IMG),format=raw,if=none,id=disk \ 78 -drive file=$(DISK_IMG),format=raw,if=none,id=disk \
@@ -92,6 +92,27 @@ debug: all
92run-image: all 92run-image: all
93 ./scripts/boot-image.sh rs-dos.img 93 ./scripts/boot-image.sh rs-dos.img
94 94
95# ---- Data disk -----------------------------------------------------------
96
97# Create the FAT32 data disk if it doesn't exist. Uses mkfs.fat -C (the
98# flag that actually creates the file) and seeds it from seed/.
99disk:
100 ./scripts/mkdisk.sh "$(DISK_IMG)"
101
102# Re-format the data disk from scratch (wipes it, then re-seeds).
103disk-fresh:
104 ./scripts/mkdisk.sh --fresh "$(DISK_IMG)"
105
106# List the data disk contents with mtools (requires mtools).
107inspect:
108 @command -v mdir >/dev/null 2>&1 || (echo "inspect needs mtools: sudo apt install mtools"; exit 1)
109 @mdir -i "$(DISK_IMG)"
110
111# Full automated round trip: build -> boot -> shell commands -> poweroff
112# -> fsck + mtools verification.
113test-disk:
114 ./scripts/test-disk.sh
115
95# ---- Full boot chain ----------------------------------------------------- 116# ---- Full boot chain -----------------------------------------------------
96 117
97# Build bootloader only (rsboot submodule) 118# Build bootloader only (rsboot submodule)
@@ -126,11 +147,18 @@ help:
126 @echo " make run QEMU serial console (direct boot, no bootloader)" 147 @echo " make run QEMU serial console (direct boot, no bootloader)"
127 @echo " make run-gui QEMU with graphical window (GOP/PS2)" 148 @echo " make run-gui QEMU with graphical window (GOP/PS2)"
128 @echo " make debug QEMU + GDB stub on :1234" 149 @echo " make debug QEMU + GDB stub on :1234"
150 @echo " make disk create the data disk if missing (default /tmp/disk.img)"
151 @echo " make disk-fresh re-format the data disk (wipes it)"
152 @echo " make inspect list data disk contents (mtools)"
153 @echo " make test-disk automated disk round trip (build->boot->fsck)"
129 @echo " make clean remove build artifacts" 154 @echo " make clean remove build artifacts"
130 @echo " make fmt format Rust source" 155 @echo " make fmt format Rust source"
131 @echo "" 156 @echo ""
132 @echo "Scripts:" 157 @echo "Scripts:"
133 @echo " ./scripts/boot.sh quick direct boot (dev loop)" 158 @echo " ./scripts/boot.sh quick direct boot (dev loop)"
159 @echo " ./scripts/mkdisk.sh create/re-format the data disk"
160 @echo " ./scripts/test-disk.sh automated disk round trip"
161 @echo " ./scripts/sendkeys.py type into QEMU via the monitor"
134 @echo " ./scripts/boot-image.sh boot full chain (builds if needed)" 162 @echo " ./scripts/boot-image.sh boot full chain (builds if needed)"
135 @echo " ./scripts/build-image.sh build full chain disk image" 163 @echo " ./scripts/build-image.sh build full chain disk image"
136 @echo " ./scripts/build-bootloader.sh build rsboot from source" 164 @echo " ./scripts/build-bootloader.sh build rsboot from source"