-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.sh
executable file
·120 lines (102 loc) · 3.42 KB
/
build.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
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
#!/bin/bash
set -Eeuo pipefail
build_dir="build/debug"
install_qemu_packages() {
echo "Install QEMU dependencies"
echo "Try to find out distro"
echo "Running on ${PRETTY_NAME:-Linux}"
if [ "${ID:-linux}" = "debian" ] || [ "${ID_LIKE#*debian*}" != "${ID_LIKE}" ]
then
echo "Looks like Debian!"
sudo apt-get install git build-essential ninja-build libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev libprotobuf-c-dev protobuf-compiler protobuf-c-compiler
else
echo "Distro Version not supported by script. Please install dependencies of QEMU by looking in the QEMU wiki"
fi
}
install_python3_pip3() {
echo "Running on ${PRETTY_NAME:-Linux}"
if [ "${ID:-linux}" = "debian" ] || [ "${ID_LIKE#*debian*}" != "${ID_LIKE}" ]
then
echo "Looks like Debian!"
echo "Need to install libcap-dev for python-prctl"
sudo apt install libcap-dev
else
echo "You might need to install libcap-dev for python-prctl"
fi
echo "Install with pip3"
pip3 install -r requirements.txt
}
install_python3_distro() {
echo "Running on ${PRETTY_NAME:-Linux}"
if [ "${ID:-linux}" = "debian" ] || [ "${ID_LIKE#*debian*}" != "${ID_LIKE}" ]
then
echo "Looks like Debian!"
sudo apt-get install python3-tables python3-pandas python3-prctl python3-protobuf python3-tqdm
echo "Rebuild protobuf files to support the installed package versions"
cd protobuf
./generate_protobuf.sh
cd ..
else
echo "Distro package manager not yet supported"
fi
}
install_python3_packages() {
echo "Install python3 packages"
echo "Should this script use pip3 or the distro package manager?"
select answer in "pip3" "distro"; do
case $answer in
pip3 ) install_python3_pip3 ; break;;
distro ) install_python3_distro ; break;;
esac
done
}
#Begin of installation script
test -e /etc/os-release && os_release='/etc/os-release' || test -e /usr/lib/os-release && os_release='/usr/lib/os-release'
. "${os_release}"
echo "Should this script try to install the required QEMU libraries and tools?"
select yn in "YES" "NO"; do
case $yn in
YES ) install_qemu_packages ; break;;
NO ) echo "See Readme for required packages"; break;;
esac
echo "use 1 or 2 to answer yes or no"
done
echo Should this script try to install the required libraries for the Python3 part of ARCHIE?
select yn in "YES" "NO"; do
case $yn in
YES ) install_python3_packages ; break;;
NO ) echo "See Readme for required packages"; break;;
esac
echo "use 1 or 2 to answer yes or no"
done
if [[ ! -f "qemu/README.rst" ]]; then
echo "Checkout submodules"
git submodule update --init
fi
echo "Building QEMU for archie"
cd qemu
if [[ ! -e $build_dir ]]; then
mkdir -p $build_dir
fi
cd $build_dir
./../../configure --target-list=arm-softmmu,riscv64-softmmu --enable-debug --enable-plugins --disable-sdl --disable-gtk --disable-curses --disable-vnc
make -j $(nproc --all)
echo "Building faultplugin"
cd ../../../faultplugin/
make clean && make
cd ..
echo "Test ARCHIE"
cd examples/stm32
./run.sh
cd - && cd examples/riscv64
./run.sh
cd -
echo "Do you want to delete log files and HDF5 file inside the example directory?"
select yn in "YES" "NO"; do
case $yn in
YES ) rm examples/stm32/log_* && rm examples/stm32/output.hdf5 && rm examples/riscv64/log_* && rm examples/riscv64/output.hdf5 && echo "Deleted log and HDF5 files"; break;;
NO ) echo "cmd to delete: rm log_* && rm output.hdf5"; break;;
esac
echo "Please type the number corresponding to Yes or No"
done
echo "Archie was build and tested successfully"