-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (27 loc) · 696 Bytes
/
Copy pathMakefile
File metadata and controls
37 lines (27 loc) · 696 Bytes
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
target := riscv64imac-unknown-none-elf
mode := debug
kernel := target/$(target)/$(mode)/os
bin := target/$(target)/$(mode)/kernel.bin
objdump := rust-objdump --arch-name=riscv64
objcopy := rust-objcopy --binary-architecture=riscv64
.PHONY: kernel build clean qemu run env
env:
cargo install cargo-binutils
rustup component add llvm-tools-preview rustfmt
rustup target add $(target)
kernel:
cargo build
$(bin): kernel
$(objcopy) $(kernel) --strip-all -O binary $@
asm:
$(objdump) -d $(kernel) | less
build: $(bin)
clean:
cargo clean
qemu: build
qemu-system-riscv64 \
-machine virt \
-nographic \
-bios default \
-device loader,file=$(bin),addr=0x80200000
run: build qemu