# Building PYNQ 2.6 for ZCU104

**URL:** <https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899>\
**Category:** Support\
**Created:** [October 20, 2020, 3:54pm UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899 "2020-10-20T15:54:32Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bluetiger9](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/bluetiger9/32/1728_2.png) [@bluetiger9](https://discuss.pynq.io/u/bluetiger9)\
**Post date:** [October 20, 2020, 3:54pm UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899/1 "2020-10-20T15:54:32Z")

</div>

Hi,

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

What I did is:

- cloned [github.com/Xilinx/PYNQ](https://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** :

```auto
[../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. 😕

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

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

**Debug log** :  
[pynq-debug.txt](https://discuss.pynq.io/uploads/short-url/sjPPc3nJ0awYQezbld2QylCPHWN.txt) (205.0 KB)

Thanks,  
Attila

---

<div class="post-metadata">

**Author:** ![PeterOgden](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/peterogden/32/55_2.png) [@PeterOgden](https://discuss.pynq.io/u/PeterOgden)\
**Post date:** [October 20, 2020, 4:10pm UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899/2 "2020-10-20T16:10:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PeterOgden](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/peterogden/32/55_2.png) [@PeterOgden](https://discuss.pynq.io/u/PeterOgden)\
**Post date:** [October 20, 2020, 4:14pm UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899/3 "2020-10-20T16:14:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bluetiger9](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/bluetiger9/32/1728_2.png) [@bluetiger9](https://discuss.pynq.io/u/bluetiger9)\
**Post date:** [October 20, 2020, 5:13pm UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899/4 "2020-10-20T17:13:17Z")

</div>

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:

```auto
$ 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.

---

<div class="post-metadata">

**Author:** ![bluetiger9](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/bluetiger9/32/1728_2.png) [@bluetiger9](https://discuss.pynq.io/u/bluetiger9)\
**Post date:** [October 21, 2020, 4:56pm UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899/5 "2020-10-21T16:56:20Z")

</div>

Hi @PeterOgden,

Got some progress from yesterday. 🙂

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:

```auto
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:

```auto
+ #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:

```auto
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:

```auto
$$(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

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [October 23, 2020, 3:22am UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899/6 "2020-10-23T03:22:16Z")

</div>

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 [PYNQ - Python productivity for Zynq - Board](http://www.pynq.io/board.html)

---

<div class="post-metadata">

**Author:** ![bluetiger9](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/bluetiger9/32/1728_2.png) [@bluetiger9](https://discuss.pynq.io/u/bluetiger9)\
**Post date:** [October 23, 2020, 6:22pm UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899/7 "2020-10-23T18:22:33Z")

</div>

Hi @rock,

I think, I understand now the BSP part. 🙂 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. 🙂

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. 😕 I tried to build the project yesterday, and got that error on a weird copy command:,

```auto
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:

```auto
 $$(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? 🙂

Thanks,  
Attila

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [October 23, 2020, 6:43pm UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899/8 "2020-10-23T18:43:02Z")

</div>

The steps to make our images are really simple:

```auto
cd <pynq-git>/sdbuild
make

```

And that is it.

If you want to start from a known stage, check [PYNQ SD Card image — Python productivity for Zynq (Pynq)](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.

---

<div class="post-metadata">

**Author:** ![bluetiger9](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/bluetiger9/32/1728_2.png) [@bluetiger9](https://discuss.pynq.io/u/bluetiger9)\
**Post date:** [October 24, 2020, 2:39pm UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899/9 "2020-10-24T14:39:06Z")

</div>

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:

```auto
$ make BOARDS=ZCU104

```

Thanks! 🙂

---

<div class="post-metadata">

**Author:** ![iurly](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/iurly/32/1822_2.png) [@iurly](https://discuss.pynq.io/u/iurly)\
**Post date:** [March 4, 2021, 11:59am UTC](https://discuss.pynq.io/t/building-pynq-2-6-for-zcu104/1899/10 "2021-03-04T11:59:33Z")

</div>

Hi @bluetiger9,

I’m also trying to build Pynq on Ubuntu 20.04.  
Would you be so kind to share the tweak you used?

Thank you!
