Makefile.src 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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=-machine q35 -drive id=disk,file=build/boot.img,format=raw,if=none \
  7. -device ahci,id=ahci -device ide-hd,drive=disk,bus=ahci.0 \
  8. -no-reboot -no-shutdown $(QEMU_ACCELERATION_FLAG) $(QEMU_DEBUG_FLAG)
  9. CROSS_COMPILE=##PLACEHOLDER_4##
  10. .PHONY: run
  11. run: build
  12. $(QEMU_BIN) $(QEMU_ARGS) -display curses -S -s
  13. .PHONY: srun
  14. srun: build
  15. $(QEMU_BIN) $(QEMU_ARGS) -display none -S -s -serial mon:stdio
  16. .PHONY: nativerun
  17. nativerun: build
  18. $(QEMU_BIN) $(QEMU_ARGS) -display none -serial mon:stdio
  19. .PHONY: prepare
  20. prepare:
  21. cmake -Bbuild -DCMAKE_BUILD_TYPE=Debug $(CROSS_COMPILE)
  22. cp build/compile_commands.json .
  23. .PHONY: reprepare
  24. reprepare: clean prepare
  25. true
  26. .PHONY: build
  27. build:
  28. cmake --build build -j 6 --target boot.img
  29. .PHONY: clean
  30. clean:
  31. -rm -rf build
  32. -rm compile_commands.json
  33. .PHONY: clean-all
  34. clean-all: clean
  35. -rm Makefile
  36. .PHONY: debug
  37. debug:
  38. $(GDB_BIN) --symbols=build/kernel.out --init-eval-command 'source pretty-print.py' --init-eval-command 'set pagination off' --init-eval-command 'target remote:1234' --eval-command 'hbr _kernel_init' --eval-command 'c'
  39. build/boot.vdi: build/boot.img
  40. -rm build/boot.vdi
  41. VBoxManage convertfromraw $< $@ --format VDI