2019-03-31 15:22:24 +02:00
|
|
|
FD_CYLINDERS = 40
|
|
|
|
FD_HEADS = 2
|
|
|
|
FD_SECTORS = 9
|
|
|
|
|
2019-04-21 12:14:06 +02:00
|
|
|
QEMU_ARCH = $(shell uname -m)
|
|
|
|
QEMU = qemu-system-$(QEMU_ARCH)
|
|
|
|
|
|
|
|
ifdef KVM
|
|
|
|
QEMU_ARGS += --enable-kvm
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef DEBUG
|
2019-09-07 01:42:39 +02:00
|
|
|
QEMU_ARGS += -option-rom debug.rom
|
|
|
|
DEBUGROM = debug.rom
|
2019-04-21 12:14:06 +02:00
|
|
|
endif
|
|
|
|
|
2019-09-04 15:38:32 +02:00
|
|
|
ifndef DISPLAY
|
2019-09-11 21:32:40 +02:00
|
|
|
QEMU_ARGS += --display curses
|
2019-09-04 15:38:32 +02:00
|
|
|
endif
|
|
|
|
|
2019-04-21 12:14:06 +02:00
|
|
|
.PHONY: default clean qemu-rom qemu-floppy
|
|
|
|
|
2019-04-20 23:02:35 +02:00
|
|
|
default: kernel.rom
|
2019-03-24 19:30:49 +01:00
|
|
|
|
2019-09-08 03:04:01 +02:00
|
|
|
kernel.com: kernel/*.asm lib/*.inc
|
2019-09-08 17:18:37 +02:00
|
|
|
nasm -s -o $@ -l kernel.lst -I lib -I kernel kernel/main.asm
|
2019-03-25 09:51:37 +01:00
|
|
|
|
2019-09-07 01:42:39 +02:00
|
|
|
debug.rom: debug/*.asm lib/*.inc
|
|
|
|
nasm -s -o $@ -I lib -I debug debug/main.asm && scripts/fix-rom.sh $@
|
|
|
|
|
2019-09-15 19:33:01 +02:00
|
|
|
floppy.bs: boot/fatvbr.asm
|
2019-09-15 20:01:48 +02:00
|
|
|
nasm -s -DCMDLINE='"KERNEL.COM"' -o $@ $<
|
2019-03-25 09:51:37 +01:00
|
|
|
|
2019-09-15 19:33:01 +02:00
|
|
|
fdimage.img: floppy.bs kernel.com
|
2019-03-31 15:22:24 +02:00
|
|
|
dd if=/dev/zero bs=512 count=$$(( $(FD_CYLINDERS) * $(FD_HEADS) * $(FD_SECTORS) )) of=$@
|
2019-09-15 19:33:01 +02:00
|
|
|
mformat -i $@ -t $(FD_CYLINDERS) -h $(FD_HEADS) -n $(FD_SECTORS) -B floppy.bs ::
|
2019-09-08 03:04:01 +02:00
|
|
|
mcopy -i $@ kernel.com ::kernel.com
|
|
|
|
mattrib -i $@ +s ::kernel.com
|
2019-03-24 19:30:49 +01:00
|
|
|
|
|
|
|
clean:
|
2019-09-15 19:33:01 +02:00
|
|
|
rm -f *.com *.bin *.rom *.img *.log *.bs *.lst
|
2019-04-21 12:14:06 +02:00
|
|
|
|
2019-09-07 01:42:39 +02:00
|
|
|
qemu-floppy: fdimage.img $(DEBUGROM)
|
2019-09-08 03:04:01 +02:00
|
|
|
$(QEMU) $(QEMU_ARGS) -boot c -fda fdimage.img
|