rdos/Makefile

45 lines
1.0 KiB
Makefile

FD_CYLINDERS = 40
FD_HEADS = 2
FD_SECTORS = 9
QEMU_ARCH = $(shell uname -m)
QEMU = qemu-system-$(QEMU_ARCH)
ifdef KVM
QEMU_ARGS += --enable-kvm
endif
ifdef DEBUG
QEMU_ARGS += -option-rom debug.rom
DEBUGROM = debug.rom
endif
ifndef DISPLAY
QEMU_ARGS += --display curses
endif
.PHONY: default clean qemu-rom qemu-floppy
default: kernel.rom
kernel.com: kernel/*.asm lib/*.inc
nasm -s -o $@ -l kernel.lst -I lib -I kernel kernel/main.asm
debug.rom: debug/*.asm lib/*.inc
nasm -s -o $@ -I lib -I debug debug/main.asm && scripts/fix-rom.sh $@
floppy.bs: boot/fatvbr.asm
nasm -s -DCMDLINE='"KERNEL.COM"' -o $@ $<
fdimage.img: floppy.bs kernel.com
dd if=/dev/zero bs=512 count=$$(( $(FD_CYLINDERS) * $(FD_HEADS) * $(FD_SECTORS) )) of=$@
mformat -i $@ -t $(FD_CYLINDERS) -h $(FD_HEADS) -n $(FD_SECTORS) -B floppy.bs ::
mcopy -i $@ kernel.com ::kernel.com
mattrib -i $@ +s ::kernel.com
clean:
rm -f *.com *.bin *.rom *.img *.log *.bs *.lst
qemu-floppy: fdimage.img $(DEBUGROM)
$(QEMU) $(QEMU_ARGS) -boot c -fda fdimage.img