forked from panda-re/panda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_ubuntu.sh
executable file
·101 lines (89 loc) · 2.59 KB
/
install_ubuntu.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
#!/bin/bash
# This is just everything in compile.md
# turned into a script
# you should be able to run it, type in
# sudo passwd and have it install all of panda.
# Verified that this script works
# from a clean install of deb7.
#
#
# This script installs all of PANDA after first taking care of current dependencies.
# Known to work on debian 7 install.
progress() {
echo
echo -e "\e[32m[panda_install]\e[0m \e[1m$1\e[0m"
}
# Exit on error.
set -e
progress "Installing qemu dependencies..."
sudo apt-get update
sudo apt-get -y build-dep qemu
progress "Installing PANDA dependencies..."
sudo apt-get -y install python-pip git protobuf-compiler protobuf-c-compiler \
libprotobuf-c0-dev libprotoc-dev libelf-dev libc++-dev
pushd /tmp
if lsb_release -d | grep -E 'Ubuntu (14\.04|16\.04)'
then
sudo apt-get -y install software-properties-common
sudo add-apt-repository -y ppa:phulin/panda
sudo apt-get update
sudo apt-get -y install libcapstone-dev libdwarf-dev python-pycparser
else
if [ ! \( -e "/usr/local/lib/libdwarf.so" -o -e "/usr/lib/libdwarf.so" \) ]
then
git clone git://git.code.sf.net/p/libdwarf/code libdwarf-code
pushd libdwarf-code
progress "Installing libdwarf..."
./configure --enable-shared
make -j$(nproc)
sudo mkdir -p /usr/local/include/libdwarf
sudo cp libdwarf/libdwarf.h /usr/local/include/libdwarf/
sudo cp libdwarf/dwarf.h /usr/local/include/libdwarf/
sudo cp libdwarf/libdwarf.so /usr/local/lib/
popd
else
progress "Skipping libdwarf..."
fi
if python -c 'import pycparser' 2>/dev/null
then
if python <<EOF
import sys
import pycparser
version = [int(x) for x in pycparser.__version__.split(".")]
if version[0] < 2 or (version[0] == 2 and version[1] < 10):
print "pycparser too old. Please upgrade it!"
sys.exit(1)
else:
print "pycparser version good."
sys.exit(0)
EOF
then
progress "Skipping pycparser..."
else
progress "Your pycparser is too old. Please upgrade using your method of choice."
exit 1
fi
else
progress "Installing pycparser..."
sudo -H pip install pycparser
fi
fi
progress "Trying to install LLVM 3.3..."
if ! sudo apt-get -y install llvm-3.3-dev clang-3.3
then
progress "Couldn't find OS package for LLVM 3.3. Proceeding without..."
fi
popd
if [ ! -e "build.sh" ]
then
progress "Cloning PANDA into $cwd ..."
git clone https://github.com/panda-re/panda.git
cd panda
else
progress "Already in PANDA directory."
fi
progress "Building PANDA..."
mkdir build
cd build
../build.sh
progress "PANDA is built and ready to use in panda/build/[arch]-softmmu/qemu-system-[arch]."