-
Notifications
You must be signed in to change notification settings - Fork 23
/
github_ci_prepare.sh
executable file
·70 lines (50 loc) · 2.23 KB
/
github_ci_prepare.sh
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
#!/bin/sh
set -e
sudo apt update
sudo apt install -y autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison ninja-build
sudo apt install -y flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev git cmake cmake unzip device-tree-compiler
sudo apt install -y libpixman-1-dev libglib2.0-dev pkg-config libpython3.10-dev xxd
ROOT_DIR=${PWD}
############################# QEMU #############################
git clone --depth=1 --branch v6.2.0 https://github.com/qemu/qemu
cd qemu
./configure --target-list=riscv64-softmmu,riscv32-softmmu --disable-werror
make -j $(nproc)
sudo make install
TOOLCHAIN_BASE_DIR=/opt/local
############################# RV32 #############################
TOOLCHAIN_DIR32=${TOOLCHAIN_BASE_DIR}/cross-tool-riscv32-baremetal-gcc13/
mkdir -p ${TOOLCHAIN_BASE_DIR} && cd ${TOOLCHAIN_BASE_DIR}
wget -q https://nightly.link/franzflasch/gcc-build-tools/workflows/riscv32-baremetal/main/toolchain_built_from_tar.zip
unzip -q toolchain_built_from_tar.zip && rm toolchain_built_from_tar.zip
tar xf *.tar.xz && rm -rf *.tar.xz
cd ${TOOLCHAIN_DIR32}/bin && export PATH=${PWD}:${PATH}
riscv32-none-elf-gcc --version
# Build device trees
cd ${ROOT_DIR}/dts
./build_dtb.sh
cd ${ROOT_DIR}
mkdir build32 && cd build32
# build with debug define on, so we get all register states
cmake -DRV_ARCH=32 -DRISCV_EM_DEBUG=1 ..
make
############################# RV64 #############################
TOOLCHAIN_DIR64=${TOOLCHAIN_BASE_DIR}/cross-tool-riscv64-baremetal-gcc13/
mkdir -p ${TOOLCHAIN_BASE_DIR} && cd ${TOOLCHAIN_BASE_DIR}
wget -q https://nightly.link/franzflasch/gcc-build-tools/workflows/riscv64-baremetal/main/toolchain_built_from_tar.zip
unzip -q toolchain_built_from_tar.zip && rm toolchain_built_from_tar.zip
tar xf *.tar.xz && rm -rf *.tar.xz
cd ${TOOLCHAIN_DIR64}/bin && export PATH=${PWD}:${PATH}
riscv64-none-elf-gcc --version
cd ${ROOT_DIR}
mkdir build64 && cd build64
# build with debug define on, so we get all register states
cmake -DRV_ARCH=64 -DRISCV_EM_DEBUG=1 ..
make
### Prepare qemu register states
cd ${ROOT_DIR}
git clone --recursive https://github.com/franzflasch/riscv-test-scripts.git
cd riscv-test-scripts
./apply_patches.sh
./build_qemu_tests.sh 32
./build_qemu_tests.sh 64