-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathDockerfile
209 lines (181 loc) · 5.75 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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# SPDX-FileCopyrightText: 2021-2023, Carles Fernandez-Prades <carles.fernandez@cttc.es>
# SPDX-License-Identifier: MIT
FROM ubuntu:18.04
LABEL version="3.0" description="Geniux builder" maintainer="carles.fernandez@cttc.es"
# build with "docker build --build-arg PETA_VERSION=2021.2 --build-arg PETA_RUN_FILE=petalinux-v2021.2-final-installer.run -t docker_petalinux2:2021.2 ."
# or "docker build --build-arg PETA_VERSION=2021.2 --build-arg PETA_RUN_FILE=petalinux-v2021.2-final-installer.run --build-arg VIVADO_INSTALLER=Xilinx_Unified_2021.2_1021_0703.tar.gz -t docker_petalinux2:2021.2 ."
# Install dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
autoconf \
bc \
bison \
build-essential \
ca-certificates \
chrpath \
cpio \
curl \
dbus \
dbus-x11 \
debianutils \
diffstat \
expect \
flex \
fonts-droid-fallback \
fonts-ubuntu-font-family-console \
gawk \
gcc-multilib \
git \
gnupg \
gtk2-engines \
gzip \
iproute2 \
iputils-ping \
kmod \
lib32z1-dev \
libbz2-dev \
libcanberra-gtk-module \
libegl1-mesa \
libffi-dev \
libgdbm-dev \
libglib2.0-dev \
libgtk2.0-0 \
libjpeg62-dev \
libpython3.8-dev \
libncurses5-dev \
libnss3-dev \
libreadline-dev \
libsdl1.2-dev \
libselinux1 \
libsqlite3-dev \
libssl-dev \
libswt-gtk-4-jni \
libtool \
libtool-bin \
locales \
lsb-release \
lxappearance \
nano \
net-tools \
pax \
pkg-config \
pylint3 \
python \
python3 \
python3-pexpect \
python3-pip \
python3-git \
python3-jinja2 \
rsync \
screen \
socat \
sudo \
texinfo \
tftpd \
tofrodos \
ttf-ubuntu-font-family \
u-boot-tools \
ubuntu-gnome-default-settings \
unzip \
update-inetd \
wget \
xorg \
xterm \
xvfb \
xxd \
zlib1g-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN dpkg --add-architecture i386 && apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y -q \
zlib1g:i386 libc6-dev:i386 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8 && update-locale
# Build and install Python 3.11, required by repo
RUN wget https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz \
&& tar -xf Python-3.11.*.tgz && cd Python-3.11.*/ \
&& ./configure --enable-optimizations && make && make altinstall \
&& cd .. && rm Python-3.11.*.tgz && rm -rf Python-3.11.*/
# make a petalinux user
ARG UID
ARG GID
RUN groupadd --gid ${GID} petalinux_docker
RUN adduser --uid ${UID} --gid ${GID} --disabled-password --gecos '' petalinux && \
usermod -aG sudo petalinux && \
echo "petalinux ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Install the repo tool to handle git submodules (meta layers) comfortably.
ADD https://storage.googleapis.com/git-repo-downloads/repo /usr/local/bin/
RUN chmod 777 /usr/local/bin/repo
ARG PETA_VERSION
ARG PETA_RUN_FILE
# The HTTP server to retrieve the files from.
ARG HTTP_SERV=http://172.17.0.1:8000/installers
COPY accept-eula.sh /
COPY y2k22_patch-1.2.zip /
# run the Petalinux installer
RUN cd / && wget -q ${HTTP_SERV}/${PETA_RUN_FILE} && \
chmod a+rx /${PETA_RUN_FILE} && \
chmod a+rx /accept-eula.sh && \
mkdir -p /opt/Xilinx && \
chmod 777 /tmp /opt/Xilinx && \
cd /tmp && \
sudo -u petalinux -i /accept-eula.sh /${PETA_RUN_FILE} /opt/Xilinx/petalinux && \
rm -f /${PETA_RUN_FILE} /accept-eula.sh
ARG VIVADO_INSTALLER
ARG VIVADO_AGREE="XilinxEULA,3rdPartyEULA"
ARG VIVADO_UPDATE
COPY install_config.txt /vivado-config/
RUN \
if [ "$VIVADO_INSTALLER" ] ; then \
mkdir -p /vivado-installer && cd /vivado-installer/ && wget -q ${HTTP_SERV}/${VIVADO_INSTALLER} && cd .. && \
cat /vivado-installer/${VIVADO_INSTALLER} | tar zx --strip-components=1 -C /vivado-installer && \
cp /vivado-config/install_config.txt /vivado-installer/ && \
/vivado-installer/xsetup \
--agree ${VIVADO_AGREE} \
--batch Install \
--config /vivado-installer/install_config.txt && \
rm -rf /vivado-installer ; \
fi
# apply 2021.2.1 Update
RUN \
if [ "$VIVADO_UPDATE" ] ; then \
mkdir -p /vivado-installer && cd /vivado-installer/ && wget -q ${HTTP_SERV}/${VIVADO_UPDATE} && cd .. && \
cat /vivado-installer/${VIVADO_UPDATE} | tar zx --strip-components=1 -C /vivado-installer && \
cp /vivado-config/install_config.txt /vivado-installer/ && \
/vivado-installer/xsetup \
--agree ${VIVADO_AGREE} \
--batch Update \
--config /vivado-installer/install_config.txt && \
rm -rf /vivado-installer ; \
fi
# apply Vitis patch
RUN \
if [ "$VIVADO_UPDATE" ] ; then \
mv /y2k22_patch-1.2.zip /tools/Xilinx/ && cd /tools/Xilinx/ && unzip y2k22_patch-1.2.zip && \
export LD_LIBRARY_PATH=$PWD/Vivado/2021.2/tps/lnx64/python-3.8.3/lib/ && \
./Vivado/2021.2/tps/lnx64/python-3.8.3/bin/python3 y2k22_patch/patch.py && \
rm y2k22_patch-1.2.zip && rm -rf y2k22_patch ; \
fi
# make /bin/sh symlink to bash instead of dash:
RUN echo "dash dash/sh boolean false" | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
# not really necessary, just to make it easier to install packages on the run...
RUN echo "root:petalinux" | chpasswd
USER petalinux
ENV HOME /home/petalinux
ENV LANG en_US.UTF-8
RUN mkdir /home/petalinux/project
WORKDIR /home/petalinux/project
ENV SHELL /bin/bash
# Source settings at login
USER root
RUN echo "/usr/sbin/in.tftpd --foreground --listen --address [::]:69 --secure /tftpboot" >> /etc/profile && \
echo ". /opt/Xilinx/petalinux/settings.sh" >> /etc/profile && \
if [ "$VIVADO_INSTALLER" ] ; then \
echo ". /tools/Xilinx/Vivado/${PETA_VERSION}/settings64.sh" >> /etc/profile ; \
fi && \
echo ". /etc/profile" >> /root/.profile
EXPOSE 69/udp
USER petalinux
RUN git config --global user.email "geniux@example.com" && git config --global user.name "Geniux"
ENTRYPOINT ["/bin/bash", "-l"]