Build PYNQ-2.4 SD card Image for Zedboard v2018.3

While following the provided tutorial from the official website of pynq, I have met a lot of errors and failed to build pynq image for zedboard. So, I would like to write down this for others as a reference for newbie. To download those mentioned files, checkout the download links below.

Requirements

I’m using WSL2 (Ubuntu 16.04.7 LTS) as the environment, petalinux-2018.3 and SDx-2018.3 from Xilinx to build the image. The petalinux and SDx are installed in the following path of my WSL:

/tools/Xilinx/
~/petalinux/2018.3

After you have installed petalinux and SDx, you need to source it:

source /tools/Xilinx/SDK/2018.3/settings64.sh
source /tools/Xilinx/SDx/2018.3/settings64.sh
source /tools/Xilinx/Vivado/2018.3/settings64.sh
source ~/petalinux/2018.3/settings.sh
petalinux-util --webtalk off

Download PYNQ-2.4 and prebuild image

I’m using an older release of PYNQ to build the image, because I don’t want to download other version of Xilinx software (SDx file is really big and it takes a lot of time to install it). The following commands are to download the pynq-2.4 repository and the prebuild image Pynq-Z1 v2.4 from github and extract it.

cd ~/Documents
wget https://github.com/Xilinx/PYNQ/archive/refs/tags/v2.4.tar.gz
wget https://www.xilinx.com/member/forms/download/xef.html?filename=pynq_z1_v2.4.zip
tar -xf v2.4.tar.gz
unzip pynq_z1_v2.4.zip
cd ./PYNQ-2.4

Since line 57 in ~/PYNQ-2.4/sdbuild/Makefile will use git command and PYNQ-2.4 is extracted from a tar file, currently it is not a git repository. So, we need to initialize it as a local git repository. Otherwise, the error would occur during the runtimen.

cd ~/Documents/PYNQ-2.4
git init
git add .
git commit -m "init"

Build Image

Before that, I was following the tutorial of official website to build pynq sd card for other board, and I get into a lot of error and trouble, then here comes to this tutorial in the forum of building the image for custom board from prebuilt image. However, I still get into the errors, and I think its because I’m using WSL2.

Install the dependencies for pynq:

cd ~/Documents/PYNQ-2.4/sdbuild/script
sudo ./setup_host.sh

Then, create your board specification:

mkdir ~/Documents/boards
mkdir ~/Documents/boards/zedboard
touch ~/Documents/boards/zedboard/zedboard.spec

Copy and paste the following zedboard specification into the file “~/Documents/boards/zedboard/zedboard.spec”. Then, save and close it.

ARCH_zedboard = arm
BSP_zedboard = avnet-digilent-zedboard-v2018.3-final.bsp
STAGE4_PACKAGES_zedboard = boot_leds ethernet pynq jupyter pandas

Download zedboard bsp v2018.3 and put it into the folder “~/Documents/boards/zedboard/”. Which the path of the bsp file would look like this:

~/Documents/boards/zedboard/avnet-digilent-zedboard-v2018.3-final.bsp

Start to build your image:

cd ~/Documents/PYNQ-2.4/sdbuild
make BOARDDIR=~/Documents/boards PREBUILD=~/Documents/pynq_z1_v2.4.img

Wait and you might get this kind of error then I ignore it :stuck_out_tongue: I didn’t research into /dev/mapper stuff.

+ sudo chroot / mkfs -t fat /dev/mapper/loop5p1
mkfs.fat 3.0.28 (2015-05-16)
/dev/mapper/loop5p1: No such file or directory
Makefile:299: recipe for target '/home/yang/Documents/PYNQ-2.4/sdbuild/build/bionic.arm.stage1.img' failed
make: *** [/home/yang/Documents/PYNQ-2.4/sdbuild/build/bionic.arm.stage1.img] Error 1

You might get this error as well :smiley: (This is caused by the pynq makefile script doesn’t make the folder “proc”). Ignore it too :stuck_out_tongue:

QEMU_EXE=/opt/qemu/bin/qemu-arm-static PYNQ_BOARDDIR=/tmp/tmp.iC2pP0Gx9E/zedboard PYNQ_BOARD=zedboard ARCH= PACKAGE_PATH=/tmp/tmp.iC2pP0Gx9E/zedboard/packages /home/yang/Documents/PYNQ-2.4/sdbuild/scripts/install_packages.sh /home/yang/Documents/PYNQ-2.4/sdbuild/build/bionic.zedboard
+ target=/home/yang/Documents/PYNQ-2.4/sdbuild/build/bionic.zedboard
+ shift
+ fss='proc run dev'
+ for fs in '$fss'
+ sudo mount -o bind /proc /home/yang/Documents/PYNQ-2.4/sdbuild/build/bionic.zedboard/proc
mount: mount point /home/yang/Documents/PYNQ-2.4/sdbuild/build/bionic.zedboard/proc does not exist
Makefile:298: recipe for target '/home/yang/Documents/PYNQ-2.4/sdbuild/output/zedboard-2.4.img' failed
make: *** [/home/yang/Documents/PYNQ-2.4/sdbuild/output/zedboard-2.4.img] Error 32
Make failed

Makesure the following files are existed, they are important. If no, please go to forum to ask for help.

~/Documents/PYNQ-2.4/sdbuild/output/zedboard-2.4.img
~/Documents/PYNQ-2.4/sdbuild/output/boot/zedboard/BOOT.BIN
~/Documents/PYNQ-2.4/sdbuild/output/boot/zedboard/image.ub

Burnt image to SD card

I follow this tutorial to write the SD card:

After burning it, your SD card will become like this:
image

However, you still need to replace the BOOT.BIN and image.ub files in the F:\ drive with the following files:

~/Documents/PYNQ-2.4/sdbuild/output/boot/zedboard/BOOT.BIN
~/Documents/PYNQ-2.4/sdbuild/output/boot/zedboard/image.ub

Here you go! Your PYNQ SD card for Zedboard is done.

Download links

References

3 Likes

Hello world
Just to fast things up for who may got this error.

[INFO ]  Performing some trivial sanity checks
[INFO ]  Build started 20220216.160201
[INFO ]  Building environment variables
[INFO ]  =================================================================
[INFO ]  Retrieving needed toolchain components' tarballs
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Retrieving needed toolchain components' tarballs'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: do_isl_get[scripts/build/companion_libs/121-isl.sh@741]
[ERROR]  >>        called from: do_companion_libs_get[scripts/build/companion_libs.sh@15]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@591]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      '/opt/crosstool-ng/share/doc/crosstool-ng/crosstool-ng-1.22.0/B - Known issues.txt'
[ERROR]   
[ERROR]  (elapsed: 2:52.77)
[02:53] / /opt/crosstool-ng/bin/ct-ng:152: recipe for target 'build' failed
gmake[1]: *** [build] Error 1
gmake[1]: Leaving directory '/home/zuble/Documents/PYNQ-2.4/sdbuild/build/gcc-mb'
/home/zuble/Documents/PYNQ-2.4/sdbuild/packages/gcc-mb/Makefile:22: recipe for target '/home/zuble/Documents/PYNQ-2.4/sdbuild/build/gcc-mb/arm/microblazeel-xilinx-elf/bin/mb-gcc' failed
make: *** [/home/zuble/Documents/PYNQ-2.4/sdbuild/build/gcc-mb/arm/microblazeel-xilinx-elf/bin/mb-gcc] Error 2

Solved it by downloading isl-0.14.tar.xz from here http://mirror.sobukus.de/files/src/isl/ and placing it under PYNQ-2.4/sdbuild/build/gcc-mb/.build.

Got the info here Error During Creation of PYNQ SD Related to gcc-mb build

Hope this helps

1 Like

Hello,

Thank you for this very interesting information!

Is it possible to share the final image please? I need it urgently and I don’t really have time to go back into the creation of this image, especially since the versions of vivado, petalinux and ubuntu that I have are not the right ones, I have to re-download and re-install everything.

Thanks a lot

Damien

1 Like

Hello…
can anyone please share the latest build of the PYNQ SD Card Image for Zedboard.
I was looking for the latest version i.e. with Petalinux 2023.1 and with the latest PYNQ OS Version.

1 Like