Add cross-platform docker images for armv7 and arm64

This commit is contained in:
Philippe Teuwen 2024-12-18 21:53:12 +01:00
commit 8e99b792b2
13 changed files with 159 additions and 1 deletions

View file

@ -1,5 +1,5 @@
#!/bin/bash
for os in archlinux debian-12-bookworm fedora-36 fedora-37 homebrew kali opensuse-leap opensuse-tumbleweed parrot-core-latest ubuntu-20.04 ubuntu-22.04; do
for os in archlinux debian-12-bookworm debian-12-bookworm-arm64 debian-12-bookworm-armhf debian-13-trixie fedora-36 fedora-37 homebrew kali opensuse-leap opensuse-tumbleweed parrot-core-latest ubuntu-20.04 ubuntu-22.04; do
( cd $os && ./docker_build.sh )
done

View file

@ -0,0 +1,25 @@
FROM arm64v8/debian:bookworm-slim
ENV LANG=C
ENV DEBIAN_FRONTEND=noninteractive
# qtbase5-dev skipped
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev libgd-dev sudo && \
apt-get clean
# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN if [ -n "${UART_GID}" ]; then \
groupadd -g ${UART_GID} mydialout || true; \
usermod -aG ${UART_GID} rrg; \
fi
RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers
#USER rrg
WORKDIR "/home/rrg"
CMD ["/bin/bash"]

View file

@ -0,0 +1,17 @@
# Notes to run tests
```
sudo apt update
sudo apt install -y python3-minimal
sudo apt install -y python3-pip
sudo apt install python3.11-venv
python3 -m venv /tmp/venv
source /tmp/venv/bin/activate
python3 -m pip install --use-pep517 pyaes
python3 -m pip install ansicolors sslcrypto
git config --global --add safe.directory /home/rrg/proxmark3
cd proxmark3
make clean
make -j
tools/pm3_tests.sh --long
```

View file

@ -0,0 +1,19 @@
#!/bin/bash
. docker_conf
# Make sure to connect a Proxmark3 when building if you want to be able to access it from within the Docker instance
UART_PORT="$(../../pm3 --list|grep /dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
UART_GID="$(stat -c '%g' $UART_PORT)"
BUILDARG="--build-arg UART_GID=$UART_GID"
else
BUILDARG=""
fi
# cf https://github.com/multiarch/qemu-user-static
#sudo apt install qemu-user-static
#docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
#docker buildx create --use
#docker buildx inspect --bootstrap
#docker buildx build $DOCKER_PLATFORM $BUILDARG -t "$DOCKER_IMAGE" --load .
docker build $DOCKER_PLATFORM $BUILDARG -t "$DOCKER_IMAGE" .

View file

@ -0,0 +1,3 @@
# sourceme
DOCKER_IMAGE=pm3-debian-bookworm-arm64:1.0
DOCKER_PLATFORM="--platform linux/arm64"

View file

@ -0,0 +1,5 @@
#!/bin/bash
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"

View file

@ -0,0 +1,10 @@
#!/bin/bash
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV $DOCKER_PLATFORM --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"

View file

@ -0,0 +1,25 @@
FROM arm32v7/debian:bookworm-slim
ENV LANG=C
ENV DEBIAN_FRONTEND=noninteractive
# qtbase5-dev skipped
RUN apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y --no-install-recommends git ca-certificates build-essential cmake pkg-config libreadline-dev gcc-arm-none-eabi libnewlib-dev libbz2-dev liblz4-dev libbluetooth-dev libpython3-dev libssl-dev libgd-dev sudo && \
apt-get clean
# Create rrg user
RUN useradd -ms /bin/bash rrg
RUN passwd -d rrg
ARG UART_GID
# dialout group may already exist on another numeric ID than on host
RUN if [ -n "${UART_GID}" ]; then \
groupadd -g ${UART_GID} mydialout || true; \
usermod -aG ${UART_GID} rrg; \
fi
RUN printf 'rrg ALL=(ALL) ALL\n' | tee -a /etc/sudoers
#USER rrg
WORKDIR "/home/rrg"
CMD ["/bin/bash"]

View file

@ -0,0 +1,17 @@
# Notes to run tests
```
sudo apt update
sudo apt install -y python3-minimal
sudo apt install -y python3-pip
sudo apt install python3.11-venv
python3 -m venv /tmp/venv
source /tmp/venv/bin/activate
python3 -m pip install --use-pep517 pyaes
python3 -m pip install ansicolors sslcrypto
git config --global --add safe.directory /home/rrg/proxmark3
cd proxmark3
make clean
make -j
tools/pm3_tests.sh --long
```

View file

@ -0,0 +1,19 @@
#!/bin/bash
. docker_conf
# Make sure to connect a Proxmark3 when building if you want to be able to access it from within the Docker instance
UART_PORT="$(../../pm3 --list|grep /dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
UART_GID="$(stat -c '%g' $UART_PORT)"
BUILDARG="--build-arg UART_GID=$UART_GID"
else
BUILDARG=""
fi
# cf https://github.com/multiarch/qemu-user-static
#sudo apt install qemu-user-static
#docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
#docker buildx create --use
#docker buildx inspect --bootstrap
#docker buildx build $DOCKER_PLATFORM $BUILDARG -t "$DOCKER_IMAGE" --load .
docker build $DOCKER_PLATFORM $BUILDARG -t "$DOCKER_IMAGE" .

View file

@ -0,0 +1,3 @@
# sourceme
DOCKER_IMAGE=pm3-debian-bookworm-armhf:1.0
DOCKER_PLATFORM="--platform linux/arm/v7"

View file

@ -0,0 +1,5 @@
#!/bin/bash
. docker_conf
docker rm $(docker ps -aq --filter ancestor="$DOCKER_IMAGE")
docker image rm "$DOCKER_IMAGE"

View file

@ -0,0 +1,10 @@
#!/bin/bash
. docker_conf
UART_PORT="$(../../pm3 --list|grep dev|head -n1|cut -d' ' -f2)"
if [ -n "$UART_PORT" ]; then
DEV="--device=/dev/tty0 --device=$UART_PORT"
else
DEV=""
fi
docker run $DEV $DOCKER_PLATFORM --volume="$(pwd)/../..:/home/rrg/proxmark3" -w /home/rrg/proxmark3 -it "$DOCKER_IMAGE"