-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile.build
189 lines (165 loc) · 6.37 KB
/
Dockerfile.build
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
178
179
180
181
182
183
184
185
186
187
188
189
# CI Image (ci)
ARG BASE_IMAGE
FROM ${BASE_IMAGE:-swedishembedded/base:latest}
ARG ZSDK_VERSION=0.16.3
ARG DOXYGEN_VERSION=1.9.4
ARG RENODE_VERSION=1.13.3
ARG LLVM_VERSION=16
ARG BSIM_VERSION=v2.1
ARG SPARSE_VERSION=9212270048c3bd23f56c20a83d4f89b870b2b26e
ARG PROTOC_VERSION=21.7
ARG OSS_CAD_SUITE_VERSION=20240211
ARG WGET_ARGS="-q --show-progress --progress=bar:force:noscroll --no-check-certificate"
# 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 \
echo "deb [trusted=yes] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list && \
sudo apt-get 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 && \
pip3 cache purge \
; 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
RUN apt-get update && \
apt-get install -qy curl && \
echo "Installing extra dependencies for documentation generation" && \
apt-get -qy install --no-install-recommends \
doxygen-latex dot2tex \
librsvg2-bin \
texlive-latex-base \
texlive-latex-extra \
latexmk \
texlive-fonts-recommended \
ruby \
rubygems \
ruby-dev \
bundler && \
echo "Installing dependencies for asciidoc pdf generation" && \
apt-get -qy install --no-install-recommends \
curl aspell aspell-en pandoc && \
echo "Installing dependencies for code checking" && \
apt-get -qy install --no-install-recommends \
clang-format \
libclang-12-dev \
libgtest-dev \
cscope && \
echo "Installing C++ libraries" && \
apt-get -qy install --no-install-recommends \
build-essential cmake doxygen \
libboost-system-dev libboost-dev python3-dev gettext git \
libboost-date-time-dev libboost-filesystem-dev \
libboost-iostreams-dev libboost-python-dev libboost-regex-dev \
libboost-test-dev libedit-dev libgmp3-dev libmpfr-dev texinfo tzdata && \
echo "Installing kicad toolbox" && \
apt-get -qy install --no-install-recommends \
kicad && \
pip3 install --no-compile kibot && \
pip3 cache purge && \
echo "Installing other dependencies" && \
apt-get -qy install --no-install-recommends \
octave \
imagemagick && \
echo "Cleaning up.." && \
apt-get clean -y && \
apt-get autoremove --purge -y && \
rm -rf /var/lib/apt/lists/*
# Install rustup
ENV RUSTUP_HOME=/opt/rust
ENV CARGO_HOME=/opt/rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path
ENV PATH=$PATH:/opt/rust/bin
# Install uefi-run utility
RUN cargo install uefi-run --root /usr
# 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
ARG LEDGER_VERSION=3.3.2
# install additional requirements
COPY requirements.txt /tmp/
COPY requirements-doc.txt /tmp/
COPY requirements-ci.txt /tmp/
RUN pip3 install -r /tmp/requirements.txt && \
rm /tmp/requirements*.txt && \
pip3 cache purge
RUN gem install \
asciidoctor-pdf \
asciidoctor-epub3 \
asciidoctor-html5s
# Ruby dependencies for CMock
RUN gem install \
bundler \
rake \
manifest \
require_all \
constructor \
diy
# Ledger
RUN wget https://github.com/ledger/ledger/archive/refs/tags/v${LEDGER_VERSION}.tar.gz && \
tar -xzf v${LEDGER_VERSION}.tar.gz && \
pushd ledger-${LEDGER_VERSION} && \
mkdir build && (cd build; cmake ..) && \
make -C build && \
sudo make -C build install && \
popd && \
rm -rf ledger-*
# OSS CAD Suite (full suite for building verilog stuff)
RUN wget ${WGET_ARGS} https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-02-11/oss-cad-suite-linux-x64-${OSS_CAD_SUITE_VERSION}.tgz && \
tar xf oss-cad-suite-linux-x64-${OSS_CAD_SUITE_VERSION}.tgz -C /opt
# 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