Makefile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # disable kvm to debug triple faults
  2. GDB_BIN=gdb
  3. QEMU_BIN=qemu-system-i386
  4. QEMU_ACCELERATION_FLAG=-enable-kvm
  5. QEMU_DEBUG_FLAG=-d cpu_reset,int
  6. QEMU_ARGS=-drive file=build/boot.img,format=raw -no-reboot -no-shutdown $(QEMU_ACCELERATION_FLAG) #$(QEMU_DEBUG_FLAG)
  7. CROSS_COMPILE=#--toolchain cross-compile.cmake
  8. .PHONY: run
  9. run: build
  10. $(QEMU_BIN) $(QEMU_ARGS) -display curses -S -s
  11. .PHONY: srun
  12. srun: build
  13. $(QEMU_BIN) $(QEMU_ARGS) -display none -S -s -serial mon:stdio
  14. .PHONY: nativerun
  15. nativerun: build
  16. $(QEMU_BIN) $(QEMU_ARGS) -display none -serial mon:stdio
  17. .PHONY: configure
  18. configure:
  19. cmake -Bbuild -DCMAKE_BUILD_TYPE=Debug $(CROSS_COMPILE)
  20. cp build/compile_commands.json .
  21. .PHONY: build
  22. build:
  23. cmake --build build --target boot.img
  24. .PHONY: clean
  25. clean:
  26. -rm -rf build
  27. -rm compile_commands.json
  28. .PHONY: debug
  29. debug:
  30. $(GDB_BIN) --symbols=build/kernel.out --init-eval-command 'set pagination off' --init-eval-command 'target remote:1234' --eval-command 'hbr kernel_main' --eval-command 'c'
  31. build/boot.vdi: build/boot.img
  32. -rm build/boot.vdi
  33. VBoxManage convertfromraw $< $@ --format VDI