Makefile.src 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # disable kvm to debug triple faults
  2. QEMU_BIN=##PLACEHOLDER_1##
  3. GDB_BIN=##PLACEHOLDER_2##
  4. QEMU_ACCELERATION_FLAG=##PLACEHOLDER_3##
  5. QEMU_DEBUG_FLAG=#-d cpu_reset,int
  6. QEMU_ARGS=-cpu SandyBridge,check -drive file=build/boot.img,format=raw -no-reboot -no-shutdown $(QEMU_ACCELERATION_FLAG) $(QEMU_DEBUG_FLAG)
  7. CROSS_COMPILE=##PLACEHOLDER_4##
  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: prepare
  18. prepare:
  19. cmake -Bbuild -DCMAKE_BUILD_TYPE=Debug $(CROSS_COMPILE)
  20. cp build/compile_commands.json .
  21. .PHONY: reprepare
  22. reprepare: clean prepare
  23. true
  24. .PHONY: build
  25. build:
  26. cmake --build build -j 6 --target boot.img
  27. .PHONY: clean
  28. clean:
  29. -rm -rf build
  30. -rm compile_commands.json
  31. .PHONY: clean-all
  32. clean-all: clean
  33. -rm Makefile
  34. .PHONY: debug
  35. debug:
  36. $(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'
  37. build/boot.vdi: build/boot.img
  38. -rm build/boot.vdi
  39. VBoxManage convertfromraw $< $@ --format VDI