Add disk image option to makefile
This commit is contained in:
parent
a47783ed9c
commit
1ce5874b0a
7
Makefile
7
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
|
CXXFLAGS += -m32 -Wall -Wextra -Werror -ffreestanding -fno-exceptions -fno-rtti -fno-pie
|
||||||
DEBUG_FLAGS += -g -Og -DDEBUG -fno-omit-frame-pointer -fno-inline
|
DEBUG_FLAGS += -g -Og -DDEBUG -fno-omit-frame-pointer -fno-inline
|
||||||
|
|
||||||
|
QEMU_OPT += -hda disk.img
|
||||||
ARCH?=x86
|
ARCH?=x86
|
||||||
SUBDIRS := core drivers tests arch/$(ARCH)
|
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
|
@printf "menuentry \"myos\" {\n\tmultiboot /boot/kernel\n}" > isodir/boot/grub/grub.cfg
|
||||||
grub-mkrescue -o $@ isodir
|
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
|
#https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html#x86-Function-Attributes
|
||||||
arch/$(ARCH)/exception_handler.o:arch/$(ARCH)/exception_handler.c
|
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: CFLAGS += -DRUN_TEST
|
||||||
test: clean kernel
|
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
|
run:kernel
|
||||||
qemu-system-x86_64 -kernel $<
|
qemu-system-x86_64 -kernel $< $(QEMU_OPT)
|
||||||
|
|
||||||
|
|
||||||
debug: CFLAGS += $(DEBUG_FLAGS) -DRUN_TEST
|
debug: CFLAGS += $(DEBUG_FLAGS) -DRUN_TEST
|
||||||
|
Loading…
Reference in New Issue
Block a user