forked from sdt/docker-raspberry-pi-cross-compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
65 lines (54 loc) · 2.03 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
FROM debian:stretch
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils \
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure apt-utils \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
automake \
cmake \
curl \
fakeroot \
g++ \
git \
make \
runit \
sudo \
xz-utils \
bsdtar
# Here is where we hardcode the toolchain decision.
ENV HOST=arm-linux-gnueabihf \
TOOLCHAIN=arm-rpi-4.9.3-linux-gnueabihf \
RPXC_ROOT=/rpxc
# TOOLCHAIN=arm-rpi-4.9.3-linux-gnueabihf \
# TOOLCHAIN=gcc-linaro-arm-linux-gnueabihf-raspbian-x64 \
WORKDIR $RPXC_ROOT
RUN curl -L https://github.com/raspberrypi/tools/tarball/master \
| tar --wildcards --strip-components 3 -xzf - "*/arm-bcm2708/$TOOLCHAIN/"
ENV ARCH=arm \
CROSS_COMPILE=$RPXC_ROOT/bin/$HOST- \
PATH=$RPXC_ROOT/bin:$PATH \
QEMU_PATH=/usr/bin/qemu-arm-static \
QEMU_EXECVE=1 \
SYSROOT=$RPXC_ROOT/sysroot
WORKDIR $SYSROOT
RUN curl -Ls https://downloads.raspberrypi.org/raspbian_lite/archive/2018-04-19-15:24/root.tar.xz \
| bsdtar -xJf -
ADD https://github.com/resin-io-projects/armv7hf-debian-qemu/raw/master/bin/qemu-arm-static $SYSROOT/$QEMU_PATH
RUN chmod +x $SYSROOT/$QEMU_PATH \
&& mkdir -p $SYSROOT/build
RUN chroot $SYSROOT $QEMU_PATH /bin/sh -c '\
echo "deb http://archive.raspbian.org/raspbian stretch firmware" \
>> /etc/apt/sources.list \
&& apt-get update \
&& sudo apt-mark hold \
raspberrypi-bootloader raspberrypi-kernel raspberrypi-sys-mods raspi-config \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils \
&& DEBIAN_FRONTEND=noninteractive dpkg-reconfigure apt-utils \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
libc6-dev \
symlinks \
&& symlinks -cors /'
COPY image/ /
WORKDIR /build
ENTRYPOINT [ "/rpxc/entrypoint.sh" ]
RUN install-debian libc6-armhf-cross