forked from syswonder/hvisor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (69 loc) · 1.65 KB
/
Makefile
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Basic settings
ARCH ?= aarch64
LOG ?= info
STATS ?= off
PORT ?= 2333
MODE ?= debug
OBJCOPY ?= rust-objcopy --binary-architecture=$(ARCH)
KDIR ?= ../../linux
FEATURES ?= platform_imx8mp
ifeq ($(ARCH),aarch64)
RUSTC_TARGET := aarch64-unknown-none
GDB_ARCH := aarch64
else
ifeq ($(ARCH),riscv64)
RUSTC_TARGET := riscv64gc-unknown-none-elf
GDB_ARCH := riscv:rv64
else
$(error Unsupported ARCH value: $(ARCH))
endif
endif
export MODE
export LOG
export ARCH
export KDIR
# Build paths
build_path := target/$(RUSTC_TARGET)/$(MODE)
hvisor_elf := $(build_path)/hvisor
hvisor_bin := $(build_path)/hvisor.bin
image_dir := images/$(ARCH)
# Build arguments
build_args :=
build_args += --features "$(FEATURES)"
build_args += --target $(RUSTC_TARGET)
build_args += -Z build-std=core,alloc
build_args += -Z build-std-features=compiler-builtins-mem
ifeq ($(MODE), release)
build_args += --release
endif
# Targets
.PHONY: all elf disa run gdb monitor clean tools rootfs
all: $(hvisor_bin)
elf:
cargo build $(build_args)
disa:
aarch64-none-elf-readelf -a $(hvisor_elf) > hvisor-elf.txt
rust-objdump --disassemble $(hvisor_elf) > hvisor.S
tools:
make -C tools && \
make -C driver
run: all
$(QEMU) $(QEMU_ARGS)
gdb: all
$(QEMU) $(QEMU_ARGS) -s -S
show-features:
rustc --print=target-features --target=$(RUSTC_TARGET)
monitor:
gdb-multiarch \
-ex 'file $(hvisor_elf)' \
-ex 'set arch $(GDB_ARCH)' \
-ex 'target remote:1234'
jlink-server:
JLinkGDBServer -select USB -if JTAG -device Cortex-A53 -port 1234
cp: all
cp $(hvisor_bin) ~/tftp
clean:
cargo clean
make -C tools clean
make -C driver clean
include scripts/qemu-$(ARCH).mk