forked from syswonder/hvisor
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
59 lines (48 loc) · 1.17 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
ARCH ?= aarch64
LOG ?=info
STATS ?= off
PORT ?= 2333
# default debug mode
MODE ?=debug
export MODE
export LOG
export ARCH
export STATS
OBJCOPY ?= rust-objcopy --binary-architecture=$(ARCH)
build_path := target/$(ARCH)/$(MODE)
target_elf := $(build_path)/rvmarm
target_bin := $(build_path)/rvmarm.bin
guest_obj := demo/helloworld_aarch64-qemu-virt.elf
features :=
ifeq ($(STATS), on)
features += --features stats
endif
build_args := --features "$(features)" --target $(ARCH).json -Z build-std=core,alloc -Z build-std-features=compiler-builtins-mem
ifeq ($(MODE), release)
build_args += --release
endif
# .PHONY: qemu-aarch64
# qemu-aarch64:
# cargo clean
# cargo build $(build_args)
.PHONY: all
all: $(target_bin)
.PHONY: elf
elf:
cargo build $(build_args)
.PHONY: scp
scp: $(target_bin)
scp -P $(PORT) -r $(target_bin) qemu-test/guest/* scp root@localhost:~/
.PHONY: disa
disa:
rust-objdump --disassemble $(target_elf) > rvm.S
$(target_bin): elf
$(OBJCOPY) $(target_elf) --strip-all -O binary $@
run: all
cd qemu-test/host && ./test.sh
monitor:
gdb-multiarch \
-ex 'target remote:1234' \
-ex 'file $(target_elf)' \
-ex 'add-symbol-file $(guest_obj)' \
-ex 'continue'