diff options
| author | salmonik <salmonik@tuta.io> | 2026-07-31 19:53:53 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-07-31 19:53:53 +0200 |
| commit | dc23d2f22cafeb6b97ba460789a834a6c586314d (patch) | |
| tree | 987bec11922073923c4c42bda84c0f670884dbca /Makefile | |
| parent | vt: defer scrolls and batch framebuffer pushes (diff) | |
| download | rs-dos-dc23d2f22cafeb6b97ba460789a834a6c586314d.tar.gz rs-dos-dc23d2f22cafeb6b97ba460789a834a6c586314d.zip | |
ahci: SATA driver + FAT32 persistent disk mounted at /disk
- ahci.rs: polling AHCI on PCI class 1/6/1, bus mastering + ABAR map,
port 0 up, IDENTIFY + READ/WRITE DMA EXT through one 4KiB DMA buffer
- fat.rs: BPB parse, whole-FAT RAM cache with write-back to both copies,
LFN read/write, dirs, multi-cluster files, FSInfo free-count sync,
space-padded dot entries ('..' = cluster 0 under root), fsck-clean
- fs.rs: /disk mount node + 24-slot ephemeral node pool; ls/cat/hexdump/
echo/mkdir/touch/rm/edit all work on disk paths unchanged
- QEMU: explicit bus assignment (disk=ide.0, ESP=ide.1); the implicit
fat:rw:esp drive was stealing AHCI port 0
- Debugged against QEMU source: header DW0 is CFL in bits 4:0 / PRDTL in
bits 31:16 (Linux libahci layout), FIS count at bytes 12-13, device at
byte 7; QEMU rejects H2D FIS flags bits 6:4, so direction is the
header W bit only
- Verified: full shell round-trip on /disk, reboot persistence (poweroff
then mdir/mtype and a fresh boot), fsck.fat clean
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 18 |
1 files changed, 15 insertions, 3 deletions
| @@ -10,6 +10,9 @@ export INITRD=$(ESP_DIR)/initramfs.cpio.gz | |||
| 10 | export BOOTLOADER=rsboot/rsboot.efi | 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). | ||
| 14 | # Create one with: mkfs.fat -F 32 -n RSDOS disk.img && mcopy -i disk.img files :: | ||
| 15 | export DISK_IMG ?= /tmp/disk.img | ||
| 13 | 16 | ||
| 14 | .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 |
| 15 | 18 | ||
| @@ -43,7 +46,10 @@ $(INITRD): | $(ESP_DIR) | |||
| 43 | run: all | 46 | run: all |
| 44 | qemu-system-x86_64 \ | 47 | qemu-system-x86_64 \ |
| 45 | -bios $(OVMF) \ | 48 | -bios $(OVMF) \ |
| 46 | -drive file=fat:rw:$(ESP_DIR),format=raw \ | 49 | -drive file=$(DISK_IMG),format=raw,if=none,id=disk \ |
| 50 | -device ide-hd,drive=disk,bus=ide.0 \ | ||
| 51 | -drive file=fat:rw:$(ESP_DIR),format=raw,if=none,id=esp \ | ||
| 52 | -device ide-hd,drive=esp,bus=ide.1 \ | ||
| 47 | -serial stdio \ | 53 | -serial stdio \ |
| 48 | -m 256M \ | 54 | -m 256M \ |
| 49 | -machine q35 \ | 55 | -machine q35 \ |
| @@ -54,7 +60,10 @@ run: all | |||
| 54 | run-gui: all | 60 | run-gui: all |
| 55 | qemu-system-x86_64 \ | 61 | qemu-system-x86_64 \ |
| 56 | -bios $(OVMF) \ | 62 | -bios $(OVMF) \ |
| 57 | -drive file=fat:rw:$(ESP_DIR),format=raw \ | 63 | -drive file=$(DISK_IMG),format=raw,if=none,id=disk \ |
| 64 | -device ide-hd,drive=disk,bus=ide.0 \ | ||
| 65 | -drive file=fat:rw:$(ESP_DIR),format=raw,if=none,id=esp \ | ||
| 66 | -device ide-hd,drive=esp,bus=ide.1 \ | ||
| 58 | -serial stdio \ | 67 | -serial stdio \ |
| 59 | -m 256M \ | 68 | -m 256M \ |
| 60 | -machine q35 \ | 69 | -machine q35 \ |
| @@ -66,7 +75,10 @@ run-gui: all | |||
| 66 | debug: all | 75 | debug: all |
| 67 | qemu-system-x86_64 \ | 76 | qemu-system-x86_64 \ |
| 68 | -bios $(OVMF) \ | 77 | -bios $(OVMF) \ |
| 69 | -drive file=fat:rw:$(ESP_DIR),format=raw \ | 78 | -drive file=$(DISK_IMG),format=raw,if=none,id=disk \ |
| 79 | -device ide-hd,drive=disk,bus=ide.0 \ | ||
| 80 | -drive file=fat:rw:$(ESP_DIR),format=raw,if=none,id=esp \ | ||
| 81 | -device ide-hd,drive=esp,bus=ide.1 \ | ||
| 70 | -serial stdio \ | 82 | -serial stdio \ |
| 71 | -m 256M \ | 83 | -m 256M \ |
| 72 | -machine q35 \ | 84 | -machine q35 \ |
