docker-petalinux
A somehow generic Xilinx PetaLinux & Vivado docker file, using Ubuntu (though some tweaks might be possible for Windows).
It was successfully tested with version 2018.3
and 2019.1
, which is the last version handled by this release. For more recent versions, please check docker-petalinux2.
Inspired by docker-petalinux, docker-xilinx-petalinux-desktop, and petalinux-docker.
Prepare installers
Petalinux installer
The PetaLinux installer needs to be downloaded from the Xilinx's Embedded Design Tools website. It needs to be prepared for unattended installation.
Run the installer and save the petalinux-vXXX.X-final-installer.run
file in ./resources/
We need to patch the Petalinux installer so it does not ask to accept licenses.
N.B. I'm not sure it's completely legal; but I haven't been able to script an
expect
to automatically accept them (which might not be legal as well anyway). So we'll consider your download means you accept those licenses (which are available in the petalinux install directory)
Run:
cd resources
./patch_petalinux_installer.sh ./petalinux-vXXX.X-final-installer.run
(that will patch the installer in place).
Vivado installer
The Vivado installer needs to be downloaded from the Xilinx's Vivado Design Tools website. Go there and choose the All OS installer Single-File Download (TAR/GZIP).
The file is called something like Xilinx_Vivado_SDK_2018.3_XXXX_XXXX.tar.gz
. The default value for XXXX_XXXX
is 1207_2324
, if the numbers differ you can change them in the Dockerfile or passing an argument in the docker_build.sh
script.
Please place this file in the ./resources/
folder.
Build the image
Run:
./docker_build.sh <VERSION>
<VERSION>
can be2018.3
or2019.1
, ... Corresponding petalinux installer is expected to be found in a./resources
directory. The default for<VERSION>
, if not specified, is2018.3
.
The docker_build.sh
will automatically spawn a simple HTTP server to serve the installer instead of copying it to the docker images (especially pushing them to the Docker daemon. Big space/time saver).
The image takes a long time to build (on the order of hours, depending on disk space and system use) but should succeed.
It weighs around 45 GB.
Parameters
Several arguments can be provided to customize the build, with --build-arg
:
-
XILVER
for the Xilinx version to install. TheDockerfile
expects to find${HTTP_SERVER}/petalinux-v${XILVER}-final-installer.run
for the PetaLinux installer (unlessPETALINUX_INSTALLER
is given).
Defaults to2018.3
. -
PETALINUX_BASE
is the name of the PetaLinux base. Petalinux will be installed in/opt/${PETALINUX_BASE}
and the installer is expected to be sourced fromresources/${PETALINUX_BASE}-installer.run
.
Defaults topetalinux-v${XILVER}-final
. -
PETALINUX_INSTALLER
is the PetaLinux installer file.
Defaults to${PETALINUX_BASE}-installer.run
-
HTTP_SERV
is the HTTP server serving both SDK and PetaLinux installers.
Defaults tohttp://172.17.0.1:8000/resources
. -
XXXX_XXXX
is the identifier of the Vivado Installer (which name isXilinx_Vivado_SDK_${XILVER}_${XXXX_XXXX}.tar.gz
).
Defaults to1207_2324
.
You can fully customize the installation by manually running e.g.:
docker build . -t petalinux:2018.3 \
--build-arg XILVER=2018.3 \
--build-arg PETALINUX_INSTALLER=petalinux/petalinux-v2018.3-final-patched.run \
--build-arg HTTP_SERV=https://local.company.com/installers
Petalinux will be retrieved at https://local.company.com/installers/petalinux/petalinux-v2018.3-final-patched.run
Work with a PetaLinux project
A helper script petalin.sh
is provided that should be run inside a petalinux project directory. It basically is a shortcut to:
docker run -ti -v "$PWD":"$PWD" -w "$PWD" --rm -u petalinux petalinux:<latest version> $@
When run without arguments, a shell will spawn, with PetaLinux settings.sh
and Vivado settings64.sh
already sourced, so you can directly execute petalinux-*
commands and Vivado.
user@host:/path/to/petalinux_project$ /path/to/petalin.sh
petalinux@host:/path/to/petalinux_project# petalinux-build
petalinux@host:/path/to/petalinux_project# vivado
Otherwise, the arguments will be executed as a command. Example:
user@host:/path/to/petalinux_project$ /path/to/petalin.sh \
"petalinux-create -t project --template zynq --name myproject"
For Vivado, you might need some tweaking to get the graphical interface working. See section down below.
If you want to use repo
, you will need to switch to Python 3.6, and then switch back to Python2.7 after using it:
# sudo update-alternatives --config python
Select Python 3.6 (option number 2), and then use repo
(repo init ...
, repo sync
). When finished, switch back to Python 2.7 in order to use the petalinux-*
commands:
# sudo update-alternatives --auto python
Using Vivado graphical interface
There are some steps on your side if you want to make use of Vivado's graphical interface before running the Docker container.
-
If your local machine is running Linux, adjust the permission of the X server host:
$ sudo apt-get install x11-xserver-utils $ xhost +local:root
-
If your local machine is running macOS:
-
Do this once:
- Install the latest XQuartz version and run it.
- Activate the option "Allow connections from network clients" in XQuartz settings.
- Quit and restart XQuartz to activate the setting.
-
Then, in the host machine:
$ xhost + 127.0.0.1
-
-
If you are accessing remotely to the machine running the Docker container via ssh, you need to enable trusted X11 forwarding with the
-Y
flag:$ ssh user@host -Y
Now you can try it:
user@host:/path/to/petalinux_project$ /path/to/petalin.sh
petalinux@host:/path/to/petalinux_project# vivado
Enjoy!
Copyright and License
Copyright: © 2020 Carles Fernández-Prades, CTTC. All rights reserved.
The content of this repository is published under the MIT license.
Acknowledgements
This work was partially supported by the Spanish Ministry of Science, Innovation, and Universities through the Statistical Learning and Inference for Large Dimensional Communication Systems (ARISTIDES, RTI2018-099722-B-I00) project.