-
Notifications
You must be signed in to change notification settings - Fork 88
/
Dockerfile.ci
177 lines (156 loc) · 8.04 KB
/
Dockerfile.ci
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# CI Image (ci)
ARG BASE_IMAGE
FROM ${BASE_IMAGE:-zephyrprojectrtos/ci-base:latest}
ARG ZSDK_VERSION=0.17.0
ENV ZSDK_VERSION=$ZSDK_VERSION
ARG KITWARE_NINJA_VERSION=1.11.1.g95dee.kitware.jobserver-1
ENV KITWARE_NINJA_VERSION=$KITWARE_NINJA_VERSION
ARG CCACHE_VERSION=4.9.1
ENV CCACHE_VERSION=$CCACHE_VERSION
ARG DOXYGEN_VERSION=1.9.4
ENV DOXYGEN_VERSION=$DOXYGEN_VERSION
ARG RENODE_VERSION=1.15.3
ENV RENODE_VERSION=$RENODE_VERSION
ARG LLVM_VERSION=16
ENV LLVM_VERSION=$LLVM_VERSION
ARG BSIM_VERSION=v2.4
ENV BSIM_VERSION=$BSIM_VERSION
ARG SPARSE_VERSION=9212270048c3bd23f56c20a83d4f89b870b2b26e
ENV SPARSE_VERSION=$SPARSE_VERSION
ARG PROTOC_VERSION=21.7
ENV PROTOC_VERSION=$PROTOC_VERSION
ARG FVP_BASE_REVC_VERSION=11.24_11
ENV FVP_BASE_REVC_VERSION=$FVP_BASE_REVC_VERSION
ARG FVP_BASE_AEMV8R_VERSION=11.24_11
ENV FVP_BASE_AEMV8R_VERSION=$FVP_BASE_AEMV8R_VERSION
ARG FVP_CORSTONE300_VERSION=11.24_13
ENV FVP_CORSTONE300_VERSION=$FVP_CORSTONE300_VERSION
ARG FVP_CORSTONE310_VERSION=11.24_13
ENV FVP_CORSTONE310_VERSION=$FVP_CORSTONE310_VERSION
ARG WGET_ARGS="-q --show-progress --progress=bar:force:noscroll"
# Install Kitware ninja
# NOTE: Pre-built Kitware ninja binaries are only available for x86_64 host.
RUN if [ "${HOSTTYPE}" = "x86_64" ]; then \
wget ${WGET_ARGS} https://github.com/Kitware/ninja/releases/download/v${KITWARE_NINJA_VERSION}/ninja-${KITWARE_NINJA_VERSION}_x86_64-linux-gnu.tar.gz && \
tar xf ninja-${KITWARE_NINJA_VERSION}_x86_64-linux-gnu.tar.gz -C /opt && \
ln -s /opt/ninja-${KITWARE_NINJA_VERSION}_x86_64-linux-gnu/ninja /usr/local/bin && \
rm ninja-${KITWARE_NINJA_VERSION}_x86_64-linux-gnu.tar.gz \
; fi
# Install ccache
# NOTE: Pre-built ccache binaries are only available for x86_64 host.
RUN if [ "${HOSTTYPE}" = "x86_64" ]; then \
wget ${WGET_ARGS} https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz && \
tar xf ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz -C /opt && \
ln -s /opt/ccache-${CCACHE_VERSION}-linux-x86_64/ccache /usr/local/bin && \
rm ccache-${CCACHE_VERSION}-linux-x86_64.tar.xz \
; fi
# Install Doxygen (x86 only)
# NOTE: Pre-built Doxygen binaries are only available for x86_64 host.
RUN if [ "${HOSTTYPE}" = "x86_64" ]; then \
wget ${WGET_ARGS} https://downloads.sourceforge.net/project/doxygen/rel-${DOXYGEN_VERSION}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz && \
tar xf doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz -C /opt && \
ln -s /opt/doxygen-${DOXYGEN_VERSION}/bin/doxygen /usr/local/bin && \
rm doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz \
; fi
# Install renode (x86 only)
# NOTE: Renode is currently only available for x86_64 host.
RUN if [ "${HOSTTYPE}" = "x86_64" ]; then \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \
apt-get -y update && \
wget ${WGET_ARGS} https://github.com/renode/renode/releases/download/v${RENODE_VERSION}/renode_${RENODE_VERSION}_amd64.deb && \
apt-get install -y ./renode_${RENODE_VERSION}_amd64.deb && \
rm renode_${RENODE_VERSION}_amd64.deb && \
pip3 install -r /opt/renode/tests/requirements.txt --no-cache-dir \
; fi
# Install BSIM
# Note: west needs an extra folder level, so we create a link to the old location to be backwards compatible
RUN mkdir -p /opt/bsim_west && \
cd /opt/ && \
west init -m https://github.com/zephyrproject-rtos/babblesim-manifest.git --mr ${BSIM_VERSION} bsim_west && \
cd bsim_west/bsim && \
west update && \
make everything -j 8 && \
echo ${BSIM_VERSION} > ./version && \
chmod ag+w . -R && \
ln -s /opt/bsim_west/bsim /opt/bsim
# Install cargo environment
RUN wget -q -O- "https://sh.rustup.rs" | sh -s -- -y
# Install uefi-run utility
RUN ~/.cargo/bin/cargo install uefi-run --root /usr
# Install target support for Rust. This is the list as of the current
# time.
RUN \
~/.cargo/bin/rustup target install riscv32i-unknown-none-elf && \
~/.cargo/bin/rustup target install riscv64imac-unknown-none-elf && \
~/.cargo/bin/rustup target install thumbv6m-none-eabi && \
~/.cargo/bin/rustup target install thumbv7em-none-eabi && \
~/.cargo/bin/rustup target install thumbv7m-none-eabi && \
~/.cargo/bin/rustup target install thumbv8m.main-none-eabi && \
~/.cargo/bin/rustup target install x86_64-unknown-none
# Install LLVM and Clang
RUN wget ${WGET_ARGS} https://apt.llvm.org/llvm.sh && \
chmod +x llvm.sh && \
./llvm.sh ${LLVM_VERSION} all && \
rm -f llvm.sh
# Install sparse package for static analysis
RUN mkdir -p /opt/sparse && \
cd /opt/sparse && \
git clone https://git.kernel.org/pub/scm/devel/sparse/sparse.git && \
cd sparse && git checkout ${SPARSE_VERSION} && \
make -j8 && \
PREFIX=/opt/sparse make install && \
rm -rf /opt/sparse/sparse
# Install protobuf-compiler
RUN mkdir -p /opt/protoc && \
cd /opt/protoc && \
PROTOC_HOSTTYPE=$(case $HOSTTYPE in x86_64) echo "x86_64";; aarch64) echo "aarch_64";; esac) && \
wget ${WGET_ARGS} https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-${PROTOC_HOSTTYPE}.zip && \
unzip protoc-${PROTOC_VERSION}-linux-${PROTOC_HOSTTYPE}.zip && \
ln -s /opt/protoc/bin/protoc /usr/local/bin && \
rm -f protoc-${PROTOC_VERSION}-linux-${PROTOC_HOSTTYPE}.zip
# Install Zephyr SDK
RUN mkdir -p /opt/toolchains && \
cd /opt/toolchains && \
wget ${WGET_ARGS} https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-sdk-${ZSDK_VERSION}_linux-${HOSTTYPE}.tar.xz && \
tar xf zephyr-sdk-${ZSDK_VERSION}_linux-${HOSTTYPE}.tar.xz && \
zephyr-sdk-${ZSDK_VERSION}/setup.sh -t all -h -c && \
rm zephyr-sdk-${ZSDK_VERSION}_linux-${HOSTTYPE}.tar.xz
# Install FVP
#
# Ecosystem FVP License permits redistribution (refer to the relevant license available in the container).
RUN if [ "${HOSTTYPE}" = "x86_64" ]; then \
mkdir -p /opt/fvps && \
cd /opt/fvps && \
wget ${WGET_ARGS} -O- https://developer.arm.com/-/media/Files/downloads/ecosystem-models/FVP_Base_RevC-2xAEMvA_${FVP_BASE_REVC_VERSION}_Linux64.tgz | tar xz && \
wget ${WGET_ARGS} -O- https://developer.arm.com/-/media/Files/downloads/ecosystem-models/FVP_Base_AEMv8R_${FVP_BASE_AEMV8R_VERSION}_Linux64.tgz | tar xz && \
wget ${WGET_ARGS} -O- https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/Corstone-300/FVP_Corstone_SSE-300_${FVP_CORSTONE300_VERSION}_Linux64.tgz | tar xz && \
wget ${WGET_ARGS} -O- https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/Corstone-310/FVP_Corstone_SSE-310_${FVP_CORSTONE310_VERSION}_Linux64.tgz | tar xz && \
./FVP_Corstone_SSE-300.sh --no-interactive --i-agree-to-the-contained-eula && \
./FVP_Corstone_SSE-310.sh --no-interactive --i-agree-to-the-contained-eula && \
ln -s /opt/fvps/Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3/FVP_Base_RevC-2xAEMvA /usr/local/bin && \
ln -s /opt/fvps/AEMv8R_base_pkg/models/Linux64_GCC-9.3/FVP_BaseR_AEMv8R /usr/local/bin && \
ln -s /usr/local/FVP_Corstone_SSE-300/models/Linux64_GCC-9.3/FVP_Corstone_SSE-300_Ethos-U55 /usr/local/bin && \
ln -s /usr/local/FVP_Corstone_SSE-300/models/Linux64_GCC-9.3/FVP_Corstone_SSE-300_Ethos-U65 /usr/local/bin && \
ln -s /usr/local/FVP_Corstone_SSE-310/models/Linux64_GCC-9.3/FVP_Corstone_SSE-310 /usr/local/bin && \
ln -s /usr/local/FVP_Corstone_SSE-310/models/Linux64_GCC-9.3/FVP_Corstone_SSE-310_Ethos-U65 /usr/local/bin && \
rm FVP_Corstone_SSE-300.sh FVP_Corstone_SSE-310.sh \
; fi
# Clean up stale packages
RUN apt-get clean -y && \
apt-get autoremove --purge -y && \
rm -rf /var/lib/apt/lists/*
# Run the Zephyr SDK setup script as 'user' in order to ensure that the
# `Zephyr-sdk` CMake package is located in the package registry under the
# user's home directory.
USER user
RUN sudo -E -- bash -c ' \
/opt/toolchains/zephyr-sdk-${ZSDK_VERSION}/setup.sh -c && \
chown -R user:user /home/user/.cmake \
'
USER root
# Set the locale
ENV ZEPHYR_TOOLCHAIN_VARIANT=zephyr
ENV PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
ENV OVMF_FD_PATH=/usr/share/ovmf/OVMF.fd
ENV ARMFVP_BIN_PATH=/usr/local/bin