1FROM debian:testing
2
3ENV DEBIAN_FRONTEND=noninteractive
4
5RUN echo 'path-exclude=/usr/share/doc/*' > /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
6RUN echo 'path-exclude=/usr/share/man/*' >> /etc/dpkg/dpkg.cfg.d/99-exclude-cruft
7RUN echo '#!/bin/sh' > /usr/sbin/policy-rc.d
8RUN echo 'exit 101' >> /usr/sbin/policy-rc.d
9RUN chmod +x /usr/sbin/policy-rc.d
10
11RUN dpkg --add-architecture arm64
12RUN echo deb-src http://deb.debian.org/debian testing main >> /etc/apt/sources.list
13RUN apt-get update && \
14    apt-get -y install ca-certificates && \
15    apt-get -y install --no-install-recommends \
16      crossbuild-essential-arm64 \
17      meson \
18      g++ \
19      git \
20      ccache \
21      pkg-config \
22      python3-mako \
23      python-numpy \
24      python-six \
25      python-mako \
26      python3-pip \
27      python3-setuptools \
28      python3-six \
29      python3-wheel \
30      python3-jinja2 \
31      bison \
32      flex \
33      libwayland-dev \
34      gettext \
35      cmake \
36      bc \
37      libssl-dev \
38      lavacli \
39      csvkit \
40      curl \
41      unzip \
42      wget \
43      debootstrap \
44      procps \
45      qemu-user-static \
46      cpio \
47      \
48      libdrm-dev:arm64 \
49      libx11-dev:arm64 \
50      libxxf86vm-dev:arm64 \
51      libexpat1-dev:arm64 \
52      libsensors-dev:arm64 \
53      libxfixes-dev:arm64 \
54      libxdamage-dev:arm64 \
55      libxext-dev:arm64 \
56      x11proto-dev:arm64 \
57      libx11-xcb-dev:arm64 \
58      libxcb-dri2-0-dev:arm64 \
59      libxcb-glx0-dev:arm64 \
60      libxcb-xfixes0-dev:arm64 \
61      libxcb-dri3-dev:arm64 \
62      libxcb-present-dev:arm64 \
63      libxcb-randr0-dev:arm64 \
64      libxcb-sync-dev:arm64 \
65      libxrandr-dev:arm64 \
66      libxshmfence-dev:arm64 \
67      libelf-dev:arm64 \
68      libwayland-dev:arm64 \
69      libwayland-egl-backend-dev:arm64 \
70      libclang-7-dev:arm64 \
71      zlib1g-dev:arm64 \
72      libglvnd-core-dev:arm64 \
73      wayland-protocols:arm64 \
74      libpng-dev:arm64 && \
75    rm -rf /var/lib/apt/lists
76
77RUN mkdir -p /artifacts/rootfs/deqp                                             && \
78  wget https://github.com/KhronosGroup/VK-GL-CTS/archive/opengl-es-cts-3.2.5.0.zip && \
79  unzip opengl-es-cts-3.2.5.0.zip -d /                                          && \
80  rm opengl-es-cts-3.2.5.0.zip                                                  && \
81  cd /VK-GL-CTS-opengl-es-cts-3.2.5.0                                           && \
82  python3 external/fetch_sources.py                                             && \
83  cd /artifacts/rootfs/deqp                                                     && \
84  cmake -DDEQP_TARGET=wayland                                                      \
85    -DCMAKE_BUILD_TYPE=Release                                                     \
86    -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc                                       \
87    -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++                                     \
88    /VK-GL-CTS-opengl-es-cts-3.2.5.0                                            && \
89  make -j$(nproc)                                                               && \
90  rm -rf /artifacts/rootfs/deqp/external                                        && \
91  rm -rf /artifacts/rootfs/deqp/modules/gles3                                   && \
92  rm -rf /artifacts/rootfs/deqp/modules/gles31                                  && \
93  rm -rf /artifacts/rootfs/deqp/modules/internal                                && \
94  rm -rf /artifacts/rootfs/deqp/executor                                        && \
95  rm -rf /artifacts/rootfs/deqp/execserver                                      && \
96  rm -rf /artifacts/rootfs/deqp/modules/egl                                     && \
97  rm -rf /artifacts/rootfs/deqp/framework                                       && \
98  find . -name CMakeFiles | xargs rm -rf                                        && \
99  find . -name lib\*.a | xargs rm -rf                                           && \
100  du -sh *                                                                      && \
101  rm -rf /VK-GL-CTS-opengl-es-cts-3.2.5.0
102
103# TODO: Switch to 5.2-rc* when the time comes
104COPY arm64.config /panfrost-ci/
105RUN mkdir -p /kernel                                                                   && \
106  wget https://github.com/freedesktop/drm-misc/archive/drm-misc-next-2019-04-18.tar.gz && \
107  tar xvfz drm-misc-next-2019-04-18.tar.gz -C /kernel --strip-components=1             && \
108  rm drm-misc-next-2019-04-18.tar.gz                                                   && \
109  cd /kernel                                                                           && \
110  ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" ./scripts/kconfig/merge_config.sh arch/arm64/configs/defconfig /panfrost-ci/arm64.config && \
111  ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" make -j12 Image dtbs                   && \
112  cp arch/arm64/boot/Image /artifacts/.                                                && \
113  cp arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dtb /artifacts/.                    && \
114  rm -rf /kernel
115
116COPY create-rootfs.sh /artifacts/rootfs/
117RUN debootstrap --variant=minbase --arch=arm64 testing /artifacts/rootfs/ http://deb.debian.org/debian && \
118    chroot /artifacts/rootfs sh /create-rootfs.sh                                                      && \
119    rm /artifacts/rootfs/create-rootfs.sh
120
121ENTRYPOINT [""]