A somehow generic Xilinx PetaLinux 2020+ docker file, using Ubuntu (though some tweaks might be possible for Windows).
It was successfully tested with version 2022.2
.
Inspired by docker-xilinx-petalinux-desktop (and some of petalinux-docker).
Download PetaLinux installer from Xilinx/AMD website.
N.B. Petalinux 2022.2 installer is named
petalinux-v2022.2-10141622-installer.run
so you want to either rename it topetalinux-v2022.2-final-installer.run
or create a link.
Building the image requires a local HTTP server to serve big resources instead of pushing them to the Docker daemon so make sure the firewall is configured appropriately to allow incoming connections on docker network link tcp:172.17.0.1:8000, e.g.:
sudo ufw allow from 172.17.0.0/16 to 172.17.0.1
Run:
./docker_build.sh <VERSION>
<VERSION>
can be2022.2
, ... Corresponding petalinux and SDK files are expected to be found inresources
directory.
The docker_build.sh
will automatically spawn a simple HTTP server to serve the installers instead of copying them to the docker images (especially pushing them to the Docker daemon. Big space/time saver).
The image takes a some time to build, but should succeed.
It weighs around 12 GB.
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 to2022.2
. -
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 installer.
Defaults tohttp://172.17.0.1:8000/resources
.
You can fully customize the installation by manually running e.g.:
docker build . -t petalinux:2022.2 \
--build-arg XILVER=2022.2 \
--build-arg PETALINUX_INSTALLER=petalinux/petalinux-v2022.2-10141622-installer.run \
--build-arg HTTP_SERV=https://local.company.com/dockers/petalinux/2022.2/resources
Petalinux at https://local.company.com/dockers/petalinux/2022.2/resources/petalinux/petalinux-v2022.2-10141622-patched.run
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 and SDK settings.sh
already sourced, so you can directly execute petalinux-*
commands.
user@host:/path/to/petalinux_project$ /path/to/petalin.sh
petalinux@a3ce6f8c:/path/to/petalinux_project$ petalinux-create -t project --template zynq -n <project name>
petalinux@a3ce6f8c:/path/to/petalinux_project$ petalinux-config --get-hw-description <...>
petalinux@a3ce6f8c:/path/to/petalinux_project$ petalinux-build
Otherwise, the arguments will be executed as a command.
N.B. the SDK and PetaLinux
settings.sh
will not be sourced when running commands:
user@host:/path/to/petalinux_project$ /path/to/petalin.sh petalinux-build
will fail because petalinux-build
is not part of the path. But you can create your own script and start it instead:
# mbuild.sh
. /opt/petalinux-v2018.2-final/settings.sh
petalinux-build
then:
user@host:/path/to/petalinux_project$ /path/to/petalin.sh ./mbuild.sh