diff --git a/Dockerfile b/Dockerfile index 035487a3..4bc498d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,14 @@ ARG BASE_IMAGE ENV DEBIAN_FRONTEND=noninteractive ENV LLVM_DIR=/usr/lib/llvm-11 ENV PATH="/scripts:${PATH}" +ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python # Copy dependencies lists into container. We copy them all and then do a mv because # we need to transform base_image into a windows compatible filename which we can't # do in a COPY command. COPY ./dependencies/* /tmp +COPY ./requirements.txt /tmp + RUN mv /tmp/$(echo "$BASE_IMAGE" | sed 's/:/_/g')_build.txt /tmp/build_dep.txt && \ mv /tmp/$(echo "$BASE_IMAGE" | sed 's/:/_/g')_base.txt /tmp/base_dep.txt @@ -22,9 +25,9 @@ RUN [ -e /tmp/base_dep.txt ] && \ apt-get clean # Finally: Install panda debian package, you need a version that has the Dwarf2 Plugin -RUN wget https://github.com/panda-re/panda/releases/download/v1.8.23/pandare_20.04.deb -RUN command apt install -qq -y ./pandare_20.04.deb -RUN pip install pandare +RUN curl -LJO https://github.com/panda-re/panda/releases/download/v1.8.23/pandare_22.04.deb +RUN apt install -qq -y ./pandare_22.04.deb +RUN pip install -r /tmp/requirements.txt ### BUILD IMAGE - STAGE 2 FROM base AS builder @@ -40,6 +43,15 @@ FROM builder as developer COPY ./tools/ /tools COPY ./scripts /scripts -COPY setup_container.py /setup_container.py -RUN python3 setup_container.py +# Essentially same as setup_container.sh +RUN cd /tools/btrace && ./compile.sh + +RUN rm -rf /tools/build +RUN mkdir -p /tools/build +RUN mkdir -p /tools/install + +RUN cmake -B"/tools/build" -H"/tools" -DCMAKE_INSTALL_PREFIX="/tools/install" +RUN make --no-print-directory -j4 install -C "/tools/build/lavaTool" + +RUN make --no-print-directory -j4 install -C "/tools/build/fbi" diff --git a/docs/setup.md b/docs/setup.md new file mode 100644 index 00000000..c86c43c8 --- /dev/null +++ b/docs/setup.md @@ -0,0 +1,24 @@ +# Setup LAVA + +## Ubuntu 64-bit 16.04.4 +The following install steps worked on 6/29/2019 with LAVA commit [c55bf1826ef9855a621f2652b30f16ac75b19cb6](https://github.com/panda-re/lava/commit/c55bf1826ef9855a621f2652b30f16ac75b19cb6). + +- Download and install [Ubuntu 64-bit 16.04.6](http://releases.ubuntu.com/16.04/ubuntu-16.04.6-desktop-amd64.iso) (SHA1 A09607901183AB25C675626024AA402663FA2558, MD5: 5416371CC0E990871746DDAAC89F1A5E). +- `sudo add-apt-repository ppa:phulin/panda` +- `sudo cp /etc/apt/sources.list /etc/apt/sources.list~` +- `sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list` +- `sudo apt-get update` +- `sudo apt-get install python-pip git protobuf-compiler protobuf-c-compiler libprotobuf-c0-dev libprotoc-dev python-protobuf libelf-dev libcapstone-dev libdwarf-dev python-pycparser llvm-3.3 clang-3.3 libc++-dev libwiretap-dev libwireshark-dev odb` +- `sudo apt-get build-dep qemu` +- `pip install colorama` +- `cd ~/Desktop` +- `git clone https://github.com/panda-re/lava.git` +- `cd ~/Desktop/lava` +- `python2 setup.py` + +## Updated + +- build Docker container with `docker/Dockerfile` +- use `scripts/docker-shell.sh` to enter docker container +- inside Docker container, run `python setup_container.py` to build lavaTools +- exit Docker container, and run `python setup_postgres.py` and `init-host.py` diff --git a/install.sh b/install.sh index 3dd89dca..ce99bb82 100755 --- a/install.sh +++ b/install.sh @@ -13,15 +13,6 @@ progress() { echo -e "\e[32m[lava_install]\e[0m \e[1m$1\e[0m" } -# Step 1: Install panda debian package -wget https://github.com/panda-re/panda/releases/download/v1.8.23/pandare_22.04.deb -$SUDO apt install ./pandare_22.04.deb - -# Remove the comment to update all debian stuff from sources.list -$SUDO cp /etc/apt/sources.list /etc/apt/sources.list~ -$SUDO sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list -$SUDO apt-get update - progress "Updates complete" # This was originally in the docs/setup.md, I removed things starting with 'python-' as that should be installed via pip @@ -53,12 +44,10 @@ $SUDO apt install ./pandare_22.04.deb progress "Installed build dependencies" -$SUDO pip3 install --upgrade pip - -# This seems to be the better replacement to have all python packages -$SUDO pip3 install -r requirements.txt +pip3 install --upgrade pip +pip3 install -r requirements.txt progress "Installed Python requirements" -./setup_container.sh +$SUDO bash ./setup_container.sh progress "Installed LAVA"