-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile
75 lines (60 loc) · 2.49 KB
/
Dockerfile
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
# Build stage for qemu-system-arm
FROM ubuntu AS qemu-system-arm-builder
ARG QEMU_VERSION=4.2.0
ENV QEMU_TARBALL="qemu-${QEMU_VERSION}.tar.xz"
WORKDIR /qemu
RUN apt-get update && \
apt-get -y install \
wget \
gpg \
pkg-config \
python \
build-essential \
libglib2.0-dev \
libpixman-1-dev \
libfdt-dev \
zlib1g-dev \
flex \
bison
RUN # Download source...
RUN wget "https://download.qemu.org/${QEMU_TARBALL}"
RUN # Verify signatures...
RUN wget "https://download.qemu.org/${QEMU_TARBALL}.sig"
RUN gpg --keyserver keyserver.ubuntu.com --recv-keys CEACC9E15534EBABB82D3FA03353C9CEF108B584
RUN gpg --verify "${QEMU_TARBALL}.sig" "${QEMU_TARBALL}"
RUN # Extract tarball...
RUN tar xvf "${QEMU_TARBALL}"
RUN # Build source...
RUN "qemu-${QEMU_VERSION}/configure" --static --target-list=arm-softmmu
RUN make -j$(nproc)
RUN # Strip the binary, this gives a substantial size reduction!
RUN strip "arm-softmmu/qemu-system-arm"
# Build pidoc VM image
FROM ubuntu as pidoc-vm
LABEL maintainer="Mark Havens <mark.r.havens@gmail.com>"
ARG RPI_KERNEL_URL="https://github.com/dhruvvyas90/qemu-rpi-kernel/archive/afe411f2c9b04730bcc6b2168cdc9adca224227c.zip"
ARG RPI_KERNEL_CHECKSUM="295a22f1cd49ab51b9e7192103ee7c917624b063cc5ca2e11434164638aad5f4"
COPY --from=qemu-system-arm-builder /qemu/arm-softmmu/qemu-system-arm /usr/local/bin/qemu-system-arm
ADD $RPI_KERNEL_URL /tmp/qemu-rpi-kernel.zip
RUN apt-get update && \
apt-get -y install \
unzip \
expect
RUN cd /tmp && \
echo "$RPI_KERNEL_CHECKSUM qemu-rpi-kernel.zip" | sha256sum -c && \
unzip qemu-rpi-kernel.zip && \
mkdir -p /root/qemu-rpi-kernel && \
cp qemu-rpi-kernel-*/kernel-qemu-4.19.50-buster /root/qemu-rpi-kernel/ && \
cp qemu-rpi-kernel-*/versatile-pb.dtb /root/qemu-rpi-kernel/ && \
rm -rf /tmp/*
VOLUME /sdcard
ADD ./entrypoint.sh /entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
# Build the pidoc image
FROM pidoc-vm as pidoc
LABEL maintainer="Mark Havens <mark.r.havens@gmail.com>"
ARG FILESYSTEM_IMAGE_URL="http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip"
ARG FILESYSTEM_IMAGE_CHECKSUM="a50237c2f718bd8d806b96df5b9d2174ce8b789eda1f03434ed2213bbca6c6ff"
ADD $FILESYSTEM_IMAGE_URL /filesystem.zip
ADD pi_ssh_enable.exp /pi_ssh_enable.exp
RUN echo "$FILESYSTEM_IMAGE_CHECKSUM /filesystem.zip" | sha256sum -c