Skip to content

Commit

Permalink
Time to test capstone, it seems to work just fine, I confirmed with l…
Browse files Browse the repository at this point in the history
…dconfig, should have called it version 5.0.4, ugh, save it for when the official release is made with capstone
  • Loading branch information
AndrewQuijano committed Dec 10, 2024
1 parent cc88392 commit 721de19
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG BASE_IMAGE="ubuntu:20.04"
ARG TARGET_LIST="x86_64-softmmu,i386-softmmu,arm-softmmu,aarch64-softmmu,ppc-softmmu,mips-softmmu,mipsel-softmmu,mips64-softmmu,mips64el-softmmu"
ARG LIBOSI_VERSION="v0.1.7"
ARG CAPSTONE_VERSION="6.0.0-Alpha5"

### BASE IMAGE
FROM $BASE_IMAGE as base
Expand All @@ -24,6 +25,7 @@ FROM base AS builder
ARG BASE_IMAGE
ARG TARGET_LIST
ARG LIBOSI_VERSION
ARG CAPSTONE_VERSION

RUN [ -e /tmp/build_dep.txt ] && \
apt-get -qq update && \
Expand All @@ -34,16 +36,19 @@ RUN [ -e /tmp/build_dep.txt ] && \
python3 -m pip install --upgrade --no-cache-dir "capstone" && \
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal

# Then install capstone from source
# Then install capstone debian package
RUN cd /tmp && \
git clone https://github.com/capstone-engine/capstone/ -b v5 && \
cd capstone/ && ./make.sh && make install && cd /tmp && \
rm -rf /tmp/capstone && ldconfig
curl -LJO https://github.com/AndrewQuijano/capstone/releases/download/${CAPSTONE_VERSION}/libcapstone-dev_${CAPSTONE_VERSION}_amd64.deb && \
apt-get install /tmp/libcapstone-dev_${CAPSTONE_VERSION}_amd64.deb && \
rm -rf /tmp/libcapstone-dev_${CAPSTONE_VERSION}_amd64.deb

ENV PATH="/root/.cargo/bin:${PATH}"

# install libosi
RUN cd /tmp && curl -LJO https://github.com/panda-re/libosi/releases/download/${LIBOSI_VERSION}/libosi_$(echo "$BASE_IMAGE" | awk -F':' '{print $2}').deb && dpkg -i /tmp/libosi_$(echo "$BASE_IMAGE" | awk -F':' '{print $2}').deb
RUN cd /tmp && \
curl -LJO https://github.com/panda-re/libosi/releases/download/${LIBOSI_VERSION}/libosi_$(echo "$BASE_IMAGE" | awk -F':' '{print $2}').deb && \
dpkg -i /tmp/libosi_$(echo "$BASE_IMAGE" | awk -F':' '{print $2}').deb && \
rm -rf /tmp/libosi_$(echo "$BASE_IMAGE" | awk -F':' '{print $2}').deb

# Build and install panda
# Copy repo root directory to /panda, note we explicitly copy in .git directory
Expand Down Expand Up @@ -125,7 +130,7 @@ COPY --from=base /tmp/build_dep.txt /tmp

# Copy panda + libcapstone.so* + libosi libraries
COPY --from=cleanup /usr/local /usr/local
COPY --from=cleanup /usr/lib/libcapstone* /usr/lib/
COPY --from=cleanup /usr/lib/x86_64-linux-gnu/libcapstone.so* /usr/lib/
COPY --from=cleanup /lib/libosi.so /lib/libiohal.so /lib/liboffset.so /lib/

# Workaround issue #901 - ensure LD_LIBRARY_PATH contains the panda plugins directories
Expand Down
10 changes: 5 additions & 5 deletions panda/scripts/install_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ git --help &>/dev/null || $SUDO apt-get -qq update && $SUDO apt-get -qq install
# some globals
LIBOSI_VERSION="0.1.7"
UBUNTU_VERSION=$(lsb_release -r | awk '{print $2}')
CAPSTONE_VERSION="6.0.0-Alpha5"
PANDA_GIT="https://github.com/panda-re/panda.git"

# system information
Expand Down Expand Up @@ -109,11 +110,10 @@ fi
# Install libcapstone v5 release if it's not present
if [[ !$(ldconfig -p | grep -q libcapstone.so.5) ]]; then
echo "Installing libcapstone v5"
pushd /tmp && \
git clone https://github.com/capstone-engine/capstone/ -b v5 && \
cd capstone/ && MAKE_JOBS=$(nproc) ./make.sh && $SUDO make install && cd /tmp && \
rm -rf /tmp/capstone
$SUDO ldconfig
pushd /tmp
curl -LJO https://github.com/AndrewQuijano/capstone/releases/download/${CAPSTONE_VERSION}/libcapstone-dev_${CAPSTONE_VERSION}_amd64.deb
$SUDO apt-get install /tmp/libcapstone-dev_${CAPSTONE_VERSION}_amd64.deb
rm -rf /tmp/libcapstone-dev_${CAPSTONE_VERSION}_amd64.deb
popd
fi

Expand Down

0 comments on commit 721de19

Please sign in to comment.