-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
70 lines (59 loc) · 2.05 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
run:
make -C ethanol
qemu-system-riscv64 \
-M virt \
-m 512M \
-nographic \
-bios misc/opensbi-0.9/build/platform/generic/firmware/fw_jump.bin \
-kernel ethanol/goto/goto.bin \
-append "ethanol arg1 arg2 GODEBUG=schedtrace=0,scheddetail=0 env2=abc" \
-device loader,file=ethanol/ethanol,addr=0x80201000,force-raw=on $(EXTRA_FLAGS)
.PHONY: env run qemu clean allclean debug
debug:
$(shell misc/mkgdbrc.sh > /tmp/gdbrc)
riscv64-linux-gnu-gdb -x /tmp/gdbrc -ex 'source go/src/runtime/runtime-gdb.py'
patch: stamps/patch
stamps/patch: ./go
./misc/go.sh patch
touch $@
apply: stamps/apply
stamps/apply: patch/*
./misc/go.sh apply
touch $@
stamps/go-env: stamps/apply ./go
cd ./go/src && \
GOOS=linux GOARCH=amd64 ./make.bash
touch $@
qemu: stamps/qemu-env
stamps/qemu-env: toolchain
cd ./misc && \
wget https://download.qemu.org/qemu-6.1.0.tar.xz && \
tar xvJf qemu-6.1.0.tar.xz
cd ./misc/qemu-6.1.0 && \
./configure --audio-drv-list= --target-list=riscv64-softmmu --disable-sdl --disable-vnc --disable-gtk --disable-vte --disable-brlapi --disable-opengl --disable-virglrenderer --prefix=$(shell pwd)/toolchain && \
make -j8 && \
make install
touch $@
toolchain: stamps/toolchain-env
stamps/toolchain-env:
cd ./misc && \
wget https://toolchains.bootlin.com/downloads/releases/toolchains/riscv64/tarballs/riscv64--musl--bleeding-edge-2020.08-1.tar.bz2 && \
tar xvjf riscv64--musl--bleeding-edge-2020.08-1.tar.bz2 && \
rm -fr ../toolchain* && \
mv riscv64--musl--bleeding-edge-2020.08-1 ../toolchain && \
rm -fr riscv64--musl--bleeding-edge-2020.08-1.tar.bz2
touch $@
opensbi: stamps/opensbi-env
stamps/opensbi-env:
cd ./misc && \
wget https://github.com/riscv-software-src/opensbi/archive/refs/tags/v0.9.tar.gz -O opensbi-0.9.tar.gz && \
tar xvzf opensbi-0.9.tar.gz
cd ./misc/opensbi-0.9 && \
CROSS_COMPILE=riscv64-buildroot-linux-musl- make PLATFORM=generic
touch $@
env: stamps/go-env stamps/toolchain-env stamps/qemu-env
clean:
make -C ethanol clean
rm -fr stamps/*
allclean: clean
rm -fr toolchain go misc/qemu* misc/opensbi* stamps/*