Add disk image option to makefile

This commit is contained in:
Mathieu Maret 2021-10-05 22:01:13 +02:00
parent a47783ed9c
commit 1ce5874b0a
1 changed files with 5 additions and 2 deletions

View File

@ -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