PYNQ: PYTHON PRODUCTIVITY

Building PYNQ 2.6 for ZCU104

Hi,

I’m trying to build PYNQ 2.6.0 for the ZCU104 .

What I did is:

  • cloned github.com/Xilinx/PYNQ, and changed the branch to image_v2.6.0
  • build bit-stream using build.sh
  • and now I’m trying to build the PYNQ:
[../Pynq/sdbuild] $ export BOARD_REPO=/home/bluetiger/Dev/Xilinx/Pynq/sdbuild/boards/
[../Pynq/sdbuild] $ export BOARD=ZCU104
[../Pynq/sdbuild] $ make BOARDDIR=${BOARD_REPO} BOARDS=${BOARD}
vivado -version | fgrep 2020.1
Vivado v2020.1.1 (64-bit)
vitis -version | fgrep 2020.1
****** Vitis v2020.1.1 (64-bit)
which petalinux-config
...
...
...
bash /home/bluetiger/Dev/Xilinx/Pynq/sdbuild/scripts/check_mounts.sh
make: *** No rule to make target '/home/bluetiger/Dev/Xilinx/Pynq/sdbuild/boot/image_.its', needed by '/home/bluetiger/Dev/Xilinx/Pynq/sdbuild/build/ZCU104/image.its'.  Stop.

But, I’m getting the above error, and I have a feeling I may have missed something. :confused:

Can somebody help me figure this out? Maybe some build steps? :slight_smile:

Note:
Vivado, Vitis and PetaLinux are all version 2020.1.x.

Debug log:
pynq-debug.txt (205.0 KB)

Thanks,
Attila

The image_v2.6.0 branch is under active development and highly unstable at the moment. This error should be fixed in the most recent commit but I recommend waiting until the release is announced.

Peter

On a second look is would appear that your boards directory is wrong. Are you using a custom version of the ZCU104? If not you shouldn’t need to specify anything at all.

Peter

I wanted to use 2.6.0 because that is the only one supporting Vitis. 2.5.x is still using SDx.

I was using what was on the image_v2.6.0 branch on Sunday, with a couple of small adjustments needed for Ubuntu 20.04 LTS. Now, I did an update to latest changes.

The board repo directory BOARD_REPO indeed was wrong.

After correcting it I get this:

$ export BOARD_REPO=/home/bluetiger/Dev/Xilinx/Pynq/boards
$ make BOARDDIR=${BOARD_REPO} BOARDS=${BOARD}
...
bash /home/bluetiger/Dev/Xilinx/Pynq/sdbuild/scripts/check_mounts.sh
BSP=xilinx-zcu104-v2020.1-final.bsp BSP_BUILD=/home/bluetiger/Dev/Xilinx/Pynq/sdbuild/build/ZCU104/petalinux_bsp BSP_ABS=/home/bluetiger/Dev/Xilinx/Pynq/boards/ZCU104/xilinx-zcu104-v2020.1-final.bsp BSP_PROJECT=xilinx-zcu104-2020.1 /home/bluetiger/Dev/Xilinx/Pynq/sdbuild/scripts/create_bsp.sh /home/bluetiger/Dev/Xilinx/Pynq/boards/ZCU104 zynqMP
+ set -e
+ board=/home/bluetiger/Dev/Xilinx/Pynq/boards/ZCU104
+ template=zynqMP
+ '[' -n xilinx-zcu104-v2020.1-final.bsp ']'
+ [[ xilinx-zcu104-v2020.1-final.bsp == *\:\/\/* ]]
+ cp -f /home/bluetiger/Dev/Xilinx/Pynq/boards/ZCU104/xilinx-zcu104-v2020.1-final.bsp /home/bluetiger/Dev/Xilinx/Pynq/sdbuild/build/ZCU104/petalinux_bsp
cp: cannot stat '/home/bluetiger/Dev/Xilinx/Pynq/boards/ZCU104/xilinx-zcu104-v2020.1-final.bsp': No such file or directory
make: *** [Makefile:338: /home/bluetiger/Dev/Xilinx/Pynq/sdbuild/build/ZCU104/petalinux_bsp/xilinx-zcu104-2020.1.bsp] Error 1

Looks like the build script is looking for a BSP for the ZCU104 that was not built.

I used the build.sh script (Sunday version) to build the hardware files, and that was successful.

Btw, are there any instructions on how to build PYNQ from source? Did not found a full guide yet, so I’m trying to figure it out on my own. But apparently I’m missing something.

Hi @PeterOgden,

Got some progress from yesterday. :slight_smile:

The missing BSP file error from previous comment is caused by a possible bug in the Makefile. Namely the create_bsp.sh is called with the BSP=... parameter, even if there no BSP file present:

BSP_BUILD_$1 := $$(BUILD_ROOT_$1)/petalinux_bsp
BSP_ABS_$1 := $$(patsubst %,$$(BOARDDIR_$1)/%,$$(BSP_$1))
BSP_PROJECT_$1 := xilinx-$$(shell echo $1 | tr A-Z a-z | tr -cd '[:alnum:]')-$$(KERNEL_VERSION)
BSP_TARGET_$1 := $$(BSP_BUILD_$1)/$$(BSP_PROJECT_$1).bsp
# original:
# BSP_ENV_$1 := BSP=$$(BSP_$1) BSP_BUILD=$$(BSP_BUILD_$1) BSP_ABS=$$(BSP_ABS_$1) BSP_PROJECT=$$(BSP_PROJECT_$1)

# quick fix:
BSP_ENV_$1 := BSP_BUILD=$$(BSP_BUILD_$1) BSP_PROJECT=$$(BSP_PROJECT_$1)

$$(BSP_TARGET_$1): | $$(BSP_BUILD_$1)
	$$(BSP_ENV_$1) $$(SCRIPT_DIR)/create_bsp.sh $$(BOARDDIR_$1) $$(TEMPLATE_$1)

Then, in the create_bsp.sh script there looks to be some confusion with the directory paths. In order to get it working, I hardcoded the correct path:

+       #petalinux-config --get-hw-description=$BSP_BUILD/hardware_project --silentconfig
+       petalinux-config --get-hw-description=/home/bluetiger/Dev/Xilinx/Pynq/boards/ZCU104/base/ --silentconfig

Now, the project is building except the last step, the SD card image creation:

cp --sparse=always /home/bluetiger/Dev/Xilinx/Pynq/boards/ZCU104/ /home/bluetiger/Dev/Xilinx/Pynq/sdbuild/output/ZCU104-2.6.0.img
cp: -r not specified; omitting directory '/home/bluetiger/Dev/Xilinx/Pynq/boards/ZCU104/'
make: *** [Makefile:339: /home/bluetiger/Dev/Xilinx/Pynq/sdbuild/output/ZCU104-2.6.0.img] Error 1

From the Makefile, it looks like is trying to copy and mount an SD card image, which is missing. Then, the PetaLinux files built previously, would be copied to this:

$$(IMAGE_$1) : $$(BASE_PATH_$1) $$(STAGE4_DEPENDS_$1) $$(BOOT_FILES_$1) $$(MODULES_$1) $$(KERNEL_RPM_$1) | $$(CCACHEDIR)
	cp --sparse=always $$(BASE_PATH_$1) $$(IMAGE_$1)
	$$(SCRIPT_DIR)/mount_image.sh $$(IMAGE_$1) $$(STAGING_$1)
	$$(PACKAGE_ENV_$1) $$(SCRIPT_DIR)/install_packages.sh $$(STAGING_$1) $$(STAGE4_PACKAGES_$1)
	sudo cp $$(BOOT_FILES_$1) $$(STAGING_$1)/boot
	mkdir -p $$(BUILD_ROOT_$1)/modules
	cd $$(BUILD_ROOT_$1)/modules && tar -xf $$(MODULES_$1)
	sudo cp -r --no-preserve=ownership $$(BUILD_ROOT_$1)/modules/* $$(STAGING_$1)
	rm -rf $$(BUILD_ROOT_$1)/modules
	rpm2cpio $$(KERNEL_RPM_$1) | sudo chroot $$(STAGING_$1) cpio -id
	sudo chroot $$(STAGING_$1) depmod -a $$(LINUX_VERSION)
	$$(SCRIPT_DIR)/resize_umount.sh $$(IMAGE_$1) $$(STAGING_$1)

Do you have an idea what that initial ZCU104-2.6.0.img should be? Now the from path in the cp is a directory, and I did not found any .img files neither in the project, nor in the build directory.

Thanks,
Attila

Did you put the xilinx-zcu104-v2020.1-final.bsp in the ZCU104 folder? Maybe that is the confusion - you need to download the bsp from xilinx website and put it in. The current version of image_v2.6.0 should work fine.

Btw, image v2.6.0 is out. Check http://www.pynq.io/board.html

1 Like

Hi @rock,

I think, I understand now the BSP part. :slight_smile: The standard ZCU104 BSP (xilinx-zcu104-v2020.1-final.bsp) is used to build PetaLinux. Then, the ZCU104/base folder contains the Vivado design for the Base overlay, and should not use this to build PetaLinux.

I just saw the v2.6.0 was released. I tried it out today and it works. :slight_smile:

Btw, what are steps to you use to build the SD Card images from scratch?

It is still a little bit confusing this part for me. :confused: I tried to build the project yesterday, and got that error on a weird copy command:,

cp --sparse=always /home/bluetiger/Dev/Xilinx/Pynq/boards/ZCU104/ /home/bluetiger/Dev/Xilinx/Pynq/sdbuild/output/ZCU104-2.6.0.img
cp: -r not specified; omitting directory '/home/bluetiger/Dev/Xilinx/Pynq/boards/ZCU104/'
make: *** [Makefile:339: /home/bluetiger/Dev/Xilinx/Pynq/sdbuild/output/ZCU104-2.6.0.img] Error 1

(see the above comment for more details)

I tried to hack the Makefile to get rid of that error on the copy. I used your release .img-s as starting point, instead of that invalid path:

 $$(IMAGE_$1) : $$(BASE_PATH_$1) $$(STAGE4_DEPENDS_$1) $$(BOOT_FILES_$1) $$(MODULES_$1) $$(KERNEL_RPM_$1) | $$(CCACHEDIR)
       ...
       cp --sparse=always "/home/bluetiger/Downloads/zcu104_v2.6.0.img" $$(IMAGE_$1)

With this the build passes, but the output .img is the same as the starting point. The BOOT images does not seems to be overridden, with the ones from sdbuild/output/boot/ZCU104.

My plan is to build a customized PYNQ image, and for this first I would like to build a PYNQ v.2.6.0 image for myself.

Could you help me with this? :slight_smile:

Thanks,
Attila

The steps to make our images are really simple:

cd <pynq-git>/sdbuild
make

And that is it.

If you want to start from a known stage, check https://pynq.readthedocs.io/en/latest/pynq_sd_card.html#using-the-prebuilt-board-agnostic-image

Prebuilt board agnostic images are released under the same page where you find the zcu104 image.

You may also find other useful information on the readthedocs page.

Managed to build PYNQ 2.6.0 on Ubuntu 20.04 LST.

I used the command you gave me, but with only the ZCU104 board specified:

$ make BOARDS=ZCU104

Thanks! :slight_smile: