diff --git a/Makefile b/Makefile index d62dad2..a374788 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,23 @@ -run: all - qemu-system-i386 -kernel arch/kernel -d guest_errors +run: run-iso -all: +all: all-kernel all-iso + +clean: clean-iso clean-kernel + +run-kernel: + make run -C arch I=$(shell pwd)/include + +all-kernel: make all -C arch I=$(shell pwd)/include -clean: +clean-kernel: make clean -C arch I=$(shell pwd)/include + +run-iso: all-kernel + make run -C iso K=$(shell pwd)/arch/kernel + +all-iso: all-kernel + make all -C iso K=$(shell pwd)/arch/kernel + +clean-iso: + make clean -C iso K=$(shell pwd)/arch/kernel diff --git a/arch/Makefile b/arch/Makefile index 5e9bf51..a3f953a 100644 --- a/arch/Makefile +++ b/arch/Makefile @@ -9,6 +9,9 @@ CC = $(CCPREFIX)gcc OBJS = boot.s.o main.c.o logger.c.o console.c.o gdt.c.o gdt.asm.o idt.c.o idt.asm.o isr.c.o isr.asm.o +run: kernel + qemu-system-i386 -kernel kernel -d guest_errors + all: kernel clean: diff --git a/iso/.gitignore b/iso/.gitignore new file mode 100644 index 0000000..5668cf1 --- /dev/null +++ b/iso/.gitignore @@ -0,0 +1,2 @@ +/image.iso +/rootfs/boot/kernelmq diff --git a/iso/Makefile b/iso/Makefile new file mode 100644 index 0000000..6cfda53 --- /dev/null +++ b/iso/Makefile @@ -0,0 +1,21 @@ +ifneq (ok, $(shell test -f '$(K)' && echo 'ok')) +$(error 'Kernel "$(K)" does not exist') +endif + +ifneq (ok, $(shell grub-file --is-x86-multiboot '$(K)' && echo 'ok')) +$(error 'Kernel "$(K)" is not compliant with Multiboot 1') +endif + +ifneq (ok, $(shell grub-file --is-x86-multiboot2 '$(K)' && echo 'ok')) +$(error 'Kernel "$(K)" is not compliant with Multiboot 2') +endif + +run: all + qemu-system-i386 -cdrom image.iso + +all: + cp "$(K)" rootfs/boot/kernelmq + grub-mkrescue rootfs -o image.iso + +clean: + rm -f image.iso rootfs/boot/kernelmq diff --git a/iso/rootfs/boot/grub/grub.cfg b/iso/rootfs/boot/grub/grub.cfg new file mode 100644 index 0000000..3507882 --- /dev/null +++ b/iso/rootfs/boot/grub/grub.cfg @@ -0,0 +1,7 @@ +menuentry "KernelMQ, multiboot 1" { + multiboot /boot/kernelmq +} + +menuentry "KernelMQ, multiboot 2" { + multiboot2 /boot/kernelmq +}