New bootloader concept: sys-like util to generate a boot sector

Right now only floppies are supported
This commit is contained in:
Nero 2021-02-03 00:27:44 +00:00
parent 19f598251d
commit 71c89387fc
4 changed files with 224 additions and 29 deletions

View file

@ -23,13 +23,16 @@ ifndef DISPLAY
QEMU_ARGS += --display curses
endif
SYS = host/sys.elf
FIXROM = host/fix-rom.elf
.PHONY: default clean qemu-floppy5 qemu-floppy3
.PRECIOUS: $(DISTFILES)
default: fd1440.img
# Host utils
utils/%: %.c
mkdir -p utils
host/%.elf: host/%.c
$(CC) -o $@ $<
# COM programs
@ -53,26 +56,20 @@ fat6.bs: boot/fat.asm
$(NASM) $(NASM_ARGS) -DFAT16 -DCHS -DLARGE -o $@ $<
# BIOS option roms
%.rom: rom/%.asm utils/fix-rom
$(NASM) $(NASM_ARGS) -o $@ $< && utils/fix-rom $@
%.rom: rom/%.asm $(FIXROM)
$(NASM) $(NASM_ARGS) -o $@ $< && $(FIXROM) $@
fd%.img: fat1.bs $(DISTFILES)
mformat -C -i $@ -f $* -v "$(LABEL)" -B fat1.bs ::
fd%.img: $(DISTFILES) $(SYS)
mformat -C -i $@ -f $* -c 2 -v "$(LABEL)" ::
mcopy -i $@ $(DISTFILES) ::
mattrib -i $@ +s ::kernel.bs
hdimage.img: mbr.bs fd1440.img
cat mbr.bs fd1440.img >$@
$(SYS) $@ hello.com
clean:
rm -f *.com *.bs *.0 *.lst *.img *.bin *.rom
rm -rf utils
rm -f host/*.elf
qemu-floppy3: fd1440.img $(ROMS)
$(QEMU) $(QEMU_ARGS) -boot a -fda fd1440.img
qemu-floppy5: fd360.img $(ROMS)
$(QEMU) $(QEMU_ARGS) -boot a -fda fd360.img
qemu-hdd: hdimage.img $(ROMS)
$(QEMU) $(QEMU_ARGS) -boot c -hda hdimage.img