add docker so you can start at home, and capstone isn't needed today

This commit is contained in:
George Hotz 2019-03-22 20:55:50 -07:00
parent 1dc5f51cbc
commit 60e51a4b7f
4 changed files with 22 additions and 19 deletions

15
docker/Dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM ubuntu:16.04
# prepare packages in env
RUN apt-get update && apt-get -y install build-essential debootstrap debian-archive-keyring libjpeg-dev zlib1g-dev unzip wget graphviz curl python-dev python-pip python-virtualenv git wget flex bison libtool automake autoconf autotools-dev pkg-config libglib2.0-dev
RUN pip install --upgrade pip
# fetch qira
RUN git clone https://github.com/geohot/qira.git
WORKDIR /qira
# install python, build qemu, and link qira
RUN pip install --upgrade -r requirements.txt
RUN cd tracers && ./qemu_build.sh
RUN ln -sf /qira/middleware/qira.py /usr/local/bin/qira

2
docker/build.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
docker build -t qira -f Dockerfile .

5
docker/test.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
# simple loop test
docker run -p 3002:3002 --rm qira qira qira_tests/bin/loop

View File

@ -7,9 +7,6 @@ else
PIP="pip"
fi
LIBCAPSTONE64_SHA256="a7bf1cb814c6e712a314659b074bc4c00d2e0006cac67d055d3130d4ecdd525d"
LIBCAPSTONE32_SHA256="4ffb4630829b9b4e8c713ae8336a8259b180194233f248170bfe0d1577257fb2"
unamestr=$(uname)
arch=$(uname -p)
@ -23,22 +20,6 @@ if [[ "$unamestr" == 'Linux' ]]; then
sudo apt-get -qq -y install build-essential debootstrap debian-archive-keyring libjpeg-dev zlib1g-dev unzip wget graphviz curl
echo "install python packages"
sudo apt-get -qq -y install python-dev python-pip python-virtualenv
# install capstone
if [ "$arch" == 'i686' ]; then
curl -o /tmp/libcapstone3.deb http://www.capstone-engine.org/download/3.0.4/ubuntu-14.04/libcapstone3_3.0.4-0.1ubuntu1_i386.deb
else
curl -o /tmp/libcapstone3.deb http://www.capstone-engine.org/download/3.0.4/ubuntu-14.04/libcapstone3_3.0.4-0.1ubuntu1_amd64.deb
fi
HASH=`sha256sum /tmp/libcapstone3.deb 2>/dev/null | cut -d' ' -f1`
if [ "$HASH" != "$LIBCAPSTONE64_SHA256" ] && [ "$HASH" != "$LIBCAPSTONE32_SHA256" ]; then
echo "Error: libcapstone3.deb has an invalid checksum."
exit 1
fi
sudo dpkg -i /tmp/libcapstone3.deb
echo "installing pip"
elif [ $(which pacman) ]; then
sudo pacman -S --needed --noconfirm base-devel python2-pip python2-virtualenv
PIP="pip2"