diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 38 |
1 files changed, 33 insertions, 5 deletions
| @@ -11,10 +11,10 @@ export BOOTLOADER=rsboot/rsboot.efi | |||
| 11 | export OVMF=/usr/share/edk2/x64/OVMF.4m.fd | 11 | export OVMF=/usr/share/edk2/x64/OVMF.4m.fd |
| 12 | export BOOT_EFI=$(ESP_DIR)/EFI/BOOT/BOOTX64.EFI | 12 | export 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) |
| 15 | export DISK_IMG ?= /tmp/disk.img | 15 | export 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 | ||
| 46 | run: all | 46 | run: 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 | ||
| 60 | run-gui: all | 60 | run-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 |
| 75 | debug: all | 75 | debug: 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 | |||
| 92 | run-image: all | 92 | run-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/. | ||
| 99 | disk: | ||
| 100 | ./scripts/mkdisk.sh "$(DISK_IMG)" | ||
| 101 | |||
| 102 | # Re-format the data disk from scratch (wipes it, then re-seeds). | ||
| 103 | disk-fresh: | ||
| 104 | ./scripts/mkdisk.sh --fresh "$(DISK_IMG)" | ||
| 105 | |||
| 106 | # List the data disk contents with mtools (requires mtools). | ||
| 107 | inspect: | ||
| 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. | ||
| 113 | test-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" |
