forked from uCore-RV-64/uCore-RV-64-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
232 lines (199 loc) · 8 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# Makefile
SHELL := /bin/bash
DOCKER_NAME ?= uCore-RV-64-Base
DIR := workplace
run: test
test: test1 test2
lab1: test3
lab2: test4
lab3: test5
lab4: test6 test7
lab5: test8
test1:
git fetch
git checkout ch1
make run
test2:
git fetch
git checkout ch2
make test BASE=1
test3:
git fetch
git checkout ch3
make test BASE=1
test4:
git fetch
git checkout ch4
make test BASE=1
test5:
git fetch
git checkout ch5
make test BASE=1
test6:
git fetch
git checkout ch6
make test BASE=1
test7:
git fetch
git checkout ch7
make test BASE=1
test8:
git fetch
git checkout ch8
make test BASE=1
clean:
rm -rf ${DIR}
docker:
docker pull nzpznk/oslab-c-env
docker run -it --name ${DOCKER_NAME} ${DOCKER_IMAGE_NAME} /bin/bash
setclassroom: setclassroom1 setclassroom2 setclassroom3 setclassroom4 setclassroom5 setclassroom6 setclassroom7 setclassroom8
setclassroom1:
git checkout ch1
git clone https://github.com/uCore-RV-64/uCore-RV-64-conf.git cr-scripts
#git checkout master -- scripts/classroom.yml
#git checkout master -- scripts/autograding0.json
mkdir -p .github/workflows
mkdir -p .github/classroom
touch .github/.keep
cp cr-scripts/classroom.yml .github/workflows/classroom.yml
cp cr-scripts/autograding0.json .github/classroom/autograding.json
git add .github/.keep
git add .github/classroom/autograding.json
git add .github/workflows/classroom.yml
#git commit -m"update classroom.yml .keep for classroom CI test"
#git push
setclassroom2:
git checkout ch2
git clone https://github.com/uCore-RV-64/uCore-RV-64-conf.git cr-scripts
mkdir -p .github/workflows
mkdir -p .github/classroom
touch .github/.keep
cp cr-scripts/classroom.yml .github/workflows/classroom.yml
cp cr-scripts/autograding1.json .github/classroom/autograding.json
git add .github/.keep
git add .github/classroom/autograding.json
git add .github/workflows/classroom.yml
setclassroom3:
git checkout ch3
git clone https://github.com/uCore-RV-64/uCore-RV-64-conf.git cr-scripts
mkdir -p .github/workflows
mkdir -p .github/classroom
touch .github/.keep
cp cr-scripts/classroom.yml .github/workflows/classroom.yml
cp cr-scripts/autograding1.json .github/classroom/autograding.json
git add .github/.keep
git add .github/classroom/autograding.json
git add .github/workflows/classroom.yml
setclassroom4:
git checkout ch4
git clone https://github.com/uCore-RV-64/uCore-RV-64-conf.git cr-scripts
mkdir -p .github/workflows
mkdir -p .github/classroom
touch .github/.keep
cp cr-scripts/classroom.yml .github/workflows/classroom.yml
cp cr-scripts/autograding1.json .github/classroom/autograding.json
git add .github/.keep
git add .github/classroom/autograding.json
git add .github/workflows/classroom.yml
setclassroom5:
git checkout ch5
git clone https://github.com/uCore-RV-64/uCore-RV-64-conf.git cr-scripts
mkdir -p .github/workflows
mkdir -p .github/classroom
touch .github/.keep
cp cr-scripts/classroom.yml .github/workflows/classroom.yml
cp cr-scripts/autograding1.json .github/classroom/autograding.json
git add .github/.keep
git add .github/classroom/autograding.json
git add .github/workflows/classroom.yml
setclassroom6:
git checkout ch6
git clone https://github.com/uCore-RV-64/uCore-RV-64-conf.git cr-scripts
mkdir -p .github/workflows
mkdir -p .github/classroom
touch .github/.keep
cp cr-scripts/classroom.yml .github/workflows/classroom.yml
cp cr-scripts/autograding1.json .github/classroom/autograding.json
git add .github/.keep
git add .github/classroom/autograding.json
git add .github/workflows/classroom.yml
setclassroom7:
git checkout ch7
git clone https://github.com/uCore-RV-64/uCore-RV-64-conf.git cr-scripts
mkdir -p .github/workflows
mkdir -p .github/classroom
touch .github/.keep
cp cr-scripts/classroom.yml .github/workflows/classroom.yml
cp cr-scripts/autograding1.json .github/classroom/autograding.json
git add .github/.keep
git add .github/classroom/autograding.json
git add .github/workflows/classroom.yml
setclassroom8:
git checkout ch8
git clone https://github.com/uCore-RV-64/uCore-RV-64-conf.git cr-scripts
mkdir -p .github/workflows
mkdir -p .github/classroom
touch .github/.keep
cp cr-scripts/classroom.yml .github/workflows/classroom.yml
cp cr-scripts/autograding1.json .github/classroom/autograding.json
git add .github/.keep
git add .github/classroom/autograding.json
git add .github/workflows/classroom.yml
# for local ubuntu with zsh shell SHELL, need root for sudo
ubuntu_setenv:
cd ${HOME} && sudo wget https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.08/riscv64-unknown-elf-gcc-10.1.0-2020.08.2-x86_64-linux-ubuntu14.tar.gz
cd ${HOME} && sudo tar xzf riscv64-unknown-elf-gcc-10.1.0-2020.08.2-x86_64-linux-ubuntu14.tar.gz
cd ${HOME} && sudo mv riscv64-unknown-elf-gcc-10.1.0-2020.08.2-x86_64-linux-ubuntu14 riscv64-unknown-elf-gcc
cd ${HOME} && sudo wget -O riscv64-linux-musl-cross.tgz https://cloud.tsinghua.edu.cn/f/b07bac9bcfa14f1dae66/?dl=1
cd ${HOME} && sudo tar xzf riscv64-linux-musl-cross.tgz
#sudo echo export PATH=\"\$$HOME/riscv64-unknown-elf-gcc/bin:\$$PATH\" >> ~/.bashrc
#sudo echo export PATH=\"\$$HOME/riscv64-linux-musl-cross/bin:\$$PATH\" >> ~/.bashrc
#source ~/.bashrc
sudo ln -s $$HOME/riscv64-unknown-elf-gcc/bin/* /usr/bin/
sudo ln -s $$HOME/riscv64-linux-musl-cross/bin/* /usr/bin/
sudo apt install -y cmake
sudo apt update -y
sudo apt upgrade -y
sudo apt install -y autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
gawk build-essential bison flex texinfo gperf libtool patchutils bc \
zlib1g-dev libexpat-dev pkg-config libglib2.0-dev libpixman-1-dev git tmux python3
cd ${HOME} && sudo wget https://download.qemu.org/qemu-5.0.0.tar.xz
cd ${HOME} && sudo tar xJf qemu-5.0.0.tar.xz
cd ${HOME}/qemu-5.0.0 && sudo ./configure --target-list=riscv64-softmmu,riscv64-linux-user
cd ${HOME}/qemu-5.0.0 && sudo make -j$$(nproc)
cd ${HOME}/qemu-5.0.0 && sudo make install
sudo echo export PATH=\"\$${HOME}/qemu-5.0.0:\$$PATH\" >> ~/.bashrc
sudo echo export PATH=\"\$${HOME}/qemu-5.0.0/riscv64-softmmu:\$$PATH\" >> ~/.bashrc
sudo echo export PATH=\"\$${HOME}/qemu-5.0.0/riscv64-linux-user:\$$PATH\" >> ~/.bashrc
source ~/.bashrc
qemu-system-riscv64 --version
qemu-riscv64 --version
# for github codespaces ubuntu with zsh SHELL, need root for sudo
codespaces_setenv:
cd ${HOME} && sudo wget https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.08/riscv64-unknown-elf-gcc-10.1.0-2020.08.2-x86_64-linux-ubuntu14.tar.gz
cd ${HOME} && sudo tar xzf riscv64-unknown-elf-gcc-10.1.0-2020.08.2-x86_64-linux-ubuntu14.tar.gz
cd ${HOME} && sudo mv riscv64-unknown-elf-gcc-10.1.0-2020.08.2-x86_64-linux-ubuntu14 riscv64-unknown-elf-gcc
cd ${HOME} && sudo wget -O riscv64-linux-musl-cross.tgz https://cloud.tsinghua.edu.cn/f/b07bac9bcfa14f1dae66/?dl=1
cd ${HOME} && sudo tar xzf riscv64-linux-musl-cross.tgz
#sudo echo export PATH=\"\$$HOME/riscv64-unknown-elf-gcc/bin:\$$PATH\" >> ~/.bashrc
#sudo echo export PATH=\"\$$HOME/riscv64-linux-musl-cross/bin:\$$PATH\" >> ~/.bashrc
#source ~/.bashrc
sudo ln -s $$HOME/riscv64-unknown-elf-gcc/bin/* /usr/bin/
sudo ln -s $$HOME/riscv64-linux-musl-cross/bin/* /usr/bin/
sudo apt install -y cmake
sudo apt update -y
sudo apt upgrade -y
sudo apt install -y autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
gawk build-essential bison flex texinfo gperf libtool patchutils bc \
zlib1g-dev libexpat-dev pkg-config libglib2.0-dev libpixman-1-dev git tmux python3
cd ${HOME} && sudo wget https://download.qemu.org/qemu-5.0.0.tar.xz
cd ${HOME} && sudo tar xJf qemu-5.0.0.tar.xz
cd ${HOME}/qemu-5.0.0 && sudo ./configure --target-list=riscv64-softmmu,riscv64-linux-user
cd ${HOME}/qemu-5.0.0 && sudo make -j$$(nproc)
cd ${HOME}/qemu-5.0.0 && sudo make install
sudo echo export PATH=\"\$${HOME}/qemu-5.0.0:\$$PATH\" >> ~/.bashrc
sudo echo export PATH=\"\$${HOME}/qemu-5.0.0/riscv64-softmmu:\$$PATH\" >> ~/.bashrc
sudo echo export PATH=\"\$${HOME}/qemu-5.0.0/riscv64-linux-user:\$$PATH\" >> ~/.bashrc
source ~/.bashrc
qemu-system-riscv64 --version
qemu-riscv64 --version