This is a quick post showing how to use the pre-built images we ship with each PYNQ release to quickly get PYNQ up and running on a new board. The starting point for porting PYNQ is to have a working Petalinux BSP for the board - for details on creating a BSP for a custom board please refer to the Petalinux documentation. For this example we’ll use the ZC706 BSP.
Quickstart
To begin with we need the following requirements
- Ubuntu instance (preferable a virutal machine)
- Correct version of Petalinux installed and on the PATH (See the documentation - for 2.5 use Petalinux 2019.1)
-
kpartx
andzerofree
packages installed - Most recent board agnostic image from pynq.io listed under Other boards
- Clone of PYNQ repository at the release version corresponding to the pre-built - v2.5 at the time of writing
- BSP file for the correct version of Petalinux. Xilinx BSPs are available from downloads section of Xilinx.com
- Optionally sudo set up for passwordless operation
With the prerequistes in place we can go to the PYNQ/sdbuild
folder and run the scripts/image_from_prebuilt.sh
script using bash. Running it with no arguments shows what’s expected
$ bash scripts/image_from_prebuilt.sh
scripts/image_from_prebuilt.sh board bsp_file arch prebuilt
Script for generating a board-specific image from a board agnostic prebuilt image
board : The name of the board
bsp_file : The BSP file to use
arch : The architecture of the system - either arm or aarch64
prebuilt : The image to use as a base
Most of the arguments are self-explanatory except possibly for the board
arguments. This is the name of the resulting image and will also appear in the BOARD
environment variable once the image is booted.
Placing the BSP and prebuilt image in the sdbuild
folder means that the full command for generating the ZC706 image is
$ bash scripts/image_from_prebuilt.sh ZC706 xilinx-zc706-v2019.1-final.bsp arm bionic.arm.2.5.img
Once the script has finished the image will be in the outputs
folder ready to be burned to an SD card.
Customising the image
As our pre-built images are designed to be completely generic they do not configure Ethernet. The drivers will still be present but the Ethernet port will need to be configured manually. To create an image with Ethernet preconfigured we need to create a board repository for the board in question where we can add the ethernet
package that is provided by the sdbuild flow to set up the Ethernet port. For full details on creating a board repository see the PYNQ documentation.
For the purposes of this example we are going to create a ZC706.spec file containing the following:
ARCH_ZC706 = arm
BSP_ZC706 = xilinx-zc706-v2019.1-final.bsp
STAGE4_PACKAGES_ZC706 = ethernet
This file is going to live in a folder structure of test_repo/ZC706
along with the BSP file.
To build our more customised SD card image while still using the pre-built we can run
$ make BOARDDIR=test_repo PREBUILT=bionic.arm.2.5.img
To avoid checking all of the dependencies that are not required for building from a prebuilt we can instead use the nocheck_images
target
$ make BOARDDIR=test_repo PREBUILT=bionic.arm.2.5.img nocheck_images
Again the resulting image will appear in the output
folder.