diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2064b23 --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +BUILD=./build + +# Default rule +.PHONY: default +default: all + +# Remove all build files +.PHONY: clean +clean: + rm -drf $(BUILD) + cd bootloader; make clean + +# Make everything +.PHONY: all +all: img + +# Make bios bootloader +# dd if=./bootloader/build/stage2.bin of=$@ conv=notrunc bs=512 seek=40 + +.PHONY: img +img: $(BUILD)/disk.img +$(BUILD)/disk.img: + mkdir -p $(BUILD) + cd bootloader; make + dd if=/dev/zero of=$@ bs=512 count=32 + dd if=./bootloader/build/512.bin of=$@ conv=notrunc bs=512 + dd if=./bootloader/build/stage2.bin of=$@ conv=notrunc seek=5 bs=512 + +qemu: $(BUILD)/disk.img + qemu-system-i386 \ + -d cpu_reset \ + -no-reboot \ + -smp 1 -m 2048 \ + -machine q35 \ + -net none \ + -fda "$<" +# -gdb tcp::26000 \ +# -S +# -enable-kvm \ +# -cpu host \ \ No newline at end of file