-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
58 lines (48 loc) · 1.21 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
export TARGET := riscv64gc-unknown-none-elf
export MODE ?= release
export BOARD ?= qemu-virt
export ROOT := $(shell pwd)
export TARGET_DIR := $(ROOT)/target/$(TARGET)/$(MODE)
export DEBUG_DIR := $(ROOT)/debug
export ROOTFS ?= $(ROOT)/third-party/img/sdcard-comp2.img
export SBI ?= $(ROOT)/third-party/bin/opensbi-$(BOARD)
.PHONY: all build run debug test clean
all: build
build:
mkdir -p .cargo
cp -rf cargo-config/* .cargo
mkdir -p debug
cd mizu/kernel && make build
ifeq ($(BOARD), qemu-virt)
cp $(SBI) $(ROOT)/sbi-qemu
QEMU_ARGS := -monitor stdio \
-kernel kernel-qemu \
-nographic \
-serial file:debug/qemu.log \
-smp 2 -m 128M \
-drive file=$(ROOTFS),if=none,format=raw,id=x0 \
-device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0 \
-device virtio-net-device,netdev=net \
-netdev user,id=net \
-machine virt \
-bios $(SBI)
endif
run: build
ifeq ($(BOARD), qemu-virt)
qemu-system-riscv64 $(QEMU_ARGS)
endif
ifeq ($(BOARD), cv1811h)
cp -f os.bin /srv/tftp
endif
debug: build
ifeq ($(BOARD), qemu-virt)
qemu-system-riscv64 $(QEMU_ARGS) -s -S
endif
test:
ifeq ($(MODE),debug)
cargo test --all-targets --features test
else
cargo bench --all-targets --features test
endif
clean:
cargo clean