40 lines
1.6 KiB
Makefile
40 lines
1.6 KiB
Makefile
QEMU := qemu-system-x86_64
|
|
QEMU_FLAGS := -m 64M -smp 4 -cpu qemu64,pdpe1gb
|
|
|
|
ARCH_TEMP_FILES := $(BUILD_DIR)/$(KERNEL_EXEC).elf32
|
|
|
|
# qemu refuses to boot ELF64 binaries. this creates a patched version of the kernel
|
|
# binary to trick qemu into thinking its an ELF32.
|
|
# this has no effect on the kernel itself; the x86_64 kernel's
|
|
# entry point is 32-bit machine code.
|
|
$(BUILD_DIR)/$(KERNEL_EXEC).elf32: $(BUILD_DIR)/$(KERNEL_EXEC)
|
|
@cp $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).elf32
|
|
$(BUILD_DIR)/tools/e64patch/e64patch $(BUILD_DIR)/$(KERNEL_EXEC).elf32
|
|
|
|
run: $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).elf32
|
|
@printf " \033[1;93mQEMU\033[0m $<\n"
|
|
|
|
@$(QEMU) -kernel $(BUILD_DIR)/$(KERNEL_EXEC).elf32 -monitor stdio $(QEMU_FLAGS)
|
|
|
|
run-curses: $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).elf32
|
|
@printf " \033[1;93mQEMU\033[0m $<\n"
|
|
|
|
@$(QEMU) -kernel $(BUILD_DIR)/$(KERNEL_EXEC).elf32 -monitor stdio $(QEMU_FLAGS) -display curses
|
|
|
|
debug: $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).elf32
|
|
@./tools/kernel-debug/debug_session.sh \
|
|
tools/kernel-debug/gdb_session_init \
|
|
tools/kernel-debug/lldb_session_init \
|
|
$(QEMU) \
|
|
-kernel $(BUILD_DIR)/$(KERNEL_EXEC).elf32 -S -s \
|
|
-monitor stdio -serial file:$(BUILD_DIR)/socks.log $(QEMU_FLAGS)
|
|
|
|
|
|
debug-curses: $(BUILD_DIR)/$(KERNEL_EXEC) $(BUILD_DIR)/$(KERNEL_EXEC).elf32
|
|
@./tools/kernel-debug/debug_session.sh \
|
|
tools/kernel-debug/gdb_session_init \
|
|
tools/kernel-debug/lldb_session_init \
|
|
$(QEMU) \
|
|
-kernel $(BUILD_DIR)/$(KERNEL_EXEC).elf32 -S -s \
|
|
-display curses -serial file:$(BUILD_DIR)/socks.log $(QEMU_FLAGS) > build/qemu.log
|