-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.bak
More file actions
65 lines (54 loc) · 1.57 KB
/
Makefile.bak
File metadata and controls
65 lines (54 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.PHONY: all build run debug clean
# Target binary name
TARGET := hypervisor
BUILD_DIR := target/aarch64-unknown-none/debug
BINARY := $(BUILD_DIR)/$(TARGET)
BINARY_BIN := $(BUILD_DIR)/$(TARGET).bin
# QEMU configuration
QEMU := qemu-system-aarch64
QEMU_FLAGS := -machine virt,virtualization=on \
-cpu cortex-a72 \
-smp 1 \
-m 1G \
-nographic \
-kernel $(BINARY)
# Build in debug mode
all: build
build:
@echo "Building hypervisor..."
cargo build --target aarch64-unknown-none
@echo "Creating raw binary..."
aarch64-linux-gnu-objcopy -O binary $(BINARY) $(BINARY_BIN)
# Run in QEMU
run: build
@echo "Starting QEMU..."
@echo "Press Ctrl+A then X to exit QEMU"
$(QEMU) $(QEMU_FLAGS)
# Run with GDB server (for debugging)
debug: build
@echo "Starting QEMU with GDB server on port 1234..."
@echo "In another terminal, run: gdb-multiarch -ex 'target remote :1234' $(BINARY)"
$(QEMU) $(QEMU_FLAGS) -s -S
# Clean build artifacts
clean:
cargo clean
# Check code without building
check:
cargo check --target aarch64-unknown-none
# Run clippy linter
clippy:
cargo clippy --target aarch64-unknown-none
# Format code
fmt:
cargo fmt
# Help
help:
@echo "Available targets:"
@echo " all - Build the hypervisor (default)"
@echo " build - Build the hypervisor"
@echo " run - Build and run in QEMU"
@echo " debug - Build and run in QEMU with GDB server"
@echo " clean - Clean build artifacts"
@echo " check - Check code without building"
@echo " clippy - Run clippy linter"
@echo " fmt - Format code"