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)
|
2019-06-24 18:47:31 +02:00
|
|
|
QEMU_ARGS = -serial stdio
|
2019-04-21 12:14:06 +02:00
|
|
|
|
|
|
|
ifdef KVM
|
|
|
|
QEMU_ARGS += --enable-kvm
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef DEBUG
|
|
|
|
QEMU_ARGS += -chardev file,path=debugcon.log,id=seabios
|
2019-05-02 22:11:54 +02:00
|
|
|
QEMU_ARGS += -device isa-debugcon,iobase=0x402,chardev=seabios
|
2019-04-21 12:14:06 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
.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-08-31 00:24:40 +02:00
|
|
|
kernel.rom: kernel/*.asm lib/*.inc
|
2019-04-29 00:01:30 +02:00
|
|
|
nasm -s -o $@ -I lib -I kernel kernel/main.asm && scripts/fix-rom.sh $@
|
2019-03-25 09:51:37 +01:00
|
|
|
|
2019-05-02 22:25:35 +02:00
|
|
|
boot/%.bin: boot/%.asm lib/*.inc
|
2019-05-19 22:07:08 +02:00
|
|
|
nasm -s -o $@ -I boot -I lib $<
|
2019-03-25 09:51:37 +01:00
|
|
|
|
2019-04-20 23:02:35 +02:00
|
|
|
fdimage.img: boot/floppy.bin kernel.rom
|
2019-03-31 15:22:24 +02:00
|
|
|
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 boot/floppy.bin ::
|
2019-04-20 23:02:35 +02:00
|
|
|
mcopy -i $@ kernel.rom ::kernel.rom
|
2019-05-19 22:07:08 +02:00
|
|
|
mattrib -i $@ +s ::kernel.rom
|
2019-03-24 19:30:49 +01:00
|
|
|
|
|
|
|
clean:
|
2019-04-21 12:14:06 +02:00
|
|
|
rm -f *.com *.bin *.rom *.img *.log boot/*.bin
|
|
|
|
|
|
|
|
qemu-rom: kernel.rom
|
|
|
|
$(QEMU) $(QEMU_ARGS) -option-rom kernel.rom
|
|
|
|
|
|
|
|
qemu-floppy: fdimage.img
|
2019-06-24 18:47:31 +02:00
|
|
|
$(QEMU) $(QEMU_ARGS) -boot c -hda fdimage.img
|
|
|
|
|
|
|
|
qemu-serial: boot/serial.bin
|
2019-08-31 00:24:40 +02:00
|
|
|
$(QEMU) $(QEMU_ARGS) -hda boot/serial.bin
|