diff --git a/Makefile b/Makefile index 88a6116..63769e0 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ CFLAGS += -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-pie -fn CXXFLAGS += -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-rtti -fno-pie DEBUG_FLAGS += -g -Og -DDEBUG -fno-omit-frame-pointer -fno-inline +QEMU_OPT += -hda disk.img ARCH?=x86 SUBDIRS := core drivers tests arch/$(ARCH) @@ -30,6 +31,8 @@ fd.iso: kernel @printf "menuentry \"myos\" {\n\tmultiboot /boot/kernel\n}" > isodir/boot/grub/grub.cfg grub-mkrescue -o $@ isodir +disk.img: + qemu-img create -f qcow2 disk2.img 32M #https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html#x86-Function-Attributes arch/$(ARCH)/exception_handler.o:arch/$(ARCH)/exception_handler.c @@ -46,10 +49,10 @@ arch/$(ARCH)/irq_handler.o:arch/$(ARCH)/irq_handler.c test: CFLAGS += -DRUN_TEST test: clean kernel - qemu-system-x86_64 -kernel kernel -serial stdio -m 32M + qemu-system-x86_64 -kernel kernel -serial stdio -m 32M $(QEMU_OPT) run:kernel - qemu-system-x86_64 -kernel $< + qemu-system-x86_64 -kernel $< $(QEMU_OPT) debug: CFLAGS += $(DEBUG_FLAGS) -DRUN_TEST