Problems getting build system up and running

Hello,

I worked on this unsuccessfully a while back and put on the back burner. I thought I would start from scratch this time and see if I can get a working build system. My goal is to produce v2.5 images for the ZC706 and a custom Zynq board, but for right now, I’m just trying to get the build environment working with the supported boards. I am following the instructions here.

This is basically what I’ve done:

  1. Created an Ubuntu 16.04 VM (4 cores, 8GB RAM, 150GB disk)
  2. Cloned out the PYNQ repo (latest master)
  3. Ran the setup_host.sh script
  4. Installed Vivado 2019.1
  5. Installed PetaLinux 2019.1
  6. Ran “make” with no arguments in the sdbuild directory.

When I did this, it ran for a while and died when it couldn’t find “xilinx-zcu104-v2019.1-final.bsp”. I downloaded this file from Xilinx, put it in the boards/ZCU104 directory, and tried “make” again (after cleaning up from the first attempt.). This time, it ran for several hours, then died with this error:

error copying "./base/base.runs/impl_1/base_wrapper.bit": no such file or directory
    while executing
"file copy -force ./${overlay_name}/${overlay_name}.runs/impl_1/${design_name}_wrapper.bit ${overlay_name}.bit"
    (file "build_bitstream.tcl" line 25)
INFO: [Common 17-206] Exiting Vivado at Fri Nov 15 04:18:13 2019...
makefile:16: recipe for target 'bitstream' failed
make[1]: *** [bitstream] Error 1
make[1]: Leaving directory '/home/john/work/PYNQ/sdbuild/build/PYNQ/boards/ZCU104/base'
+ unmount_special
+ for fs in '$fss'
+ sudo umount -l /home/john/work/PYNQ/sdbuild/build/bionic.arm/proc
+ for fs in '$fss'
+ sudo umount -l /home/john/work/PYNQ/sdbuild/build/bionic.arm/run
+ for fs in '$fss'
+ sudo umount -l /home/john/work/PYNQ/sdbuild/build/bionic.arm/dev
+ sudo umount -l /home/john/work/PYNQ/sdbuild/build/bionic.arm/ccache
+ rmdir /home/john/work/PYNQ/sdbuild/build/bionic.arm/ccache
Makefile:324: recipe for target '/home/john/work/PYNQ/sdbuild/output/bionic.arm.2.5.img' failed
make: *** [/home/john/work/PYNQ/sdbuild/output/bionic.arm.2.5.img] Error 2

Does this look familiar? I’m digging through log files now looking for clues. Any help would be greatly appreciated.

Hi @JTC

I’ve gone through your route a couple of weeks ago with the same frustrating results. Basically, before v2.5 Pynq supplied ready-built versions for all supported boards (bitfiles & bsps) and that was taking too much room in the git repo, so they decided to remove them. After v2.5, the build system tries to generate these files and for the most part it succeeds. The build breaks though when the ZCU104 needs a HDMI license which is paid, so it fails to generate the bitfile for it, as your error shows. The solution for me was to request an evaluation license from Xilinx for the HDMI IP. Once I had that, the build finished generating all 3 supported boards. I’ve raised this issue and the team responded they’ll look at it. It is indeed a serious limitation to not be able to skip boards we’re not interested in building.

Thanks,
-Pat

1 Like

Pat,

Thanks for the input! I got an eval license for the HDMI core and re-ran it. It ran for much longer this time (around 9 hours?), then died with a different build error:

synth_1: /home/john/work/PYNQ/sdbuild/build/PYNQ/boards/ZCU104/base/base/base.runs/synth_1/runme.log
[Sat Nov 16 06:14:22 2019] Launched impl_1...
Run output will be captured here: /home/john/work/PYNQ/sdbuild/build/PYNQ/boards/ZCU104/base/base/base.runs/impl_1/runme.log
launch_runs: Time (s): cpu = 00:01:14 ; elapsed = 00:01:28 . Memory (MB): peak = 3369.895 ; gain = 1588.465 ; free physical = 1587 ; free virtual = 5910
[Sat Nov 16 06:14:22 2019] Waiting for impl_1 to finish...
/tools/Xilinx/Vivado/2019.1/bin/loader: line 267: 114697 Killed                  "$RDI_PROG" "$@"
makefile:16: recipe for target 'bitstream' failed
make[1]: *** [bitstream] Error 137
make[1]: Leaving directory '/home/john/work/PYNQ/sdbuild/build/PYNQ/boards/ZCU104/base'
+ unmount_special
+ for fs in '$fss'
+ sudo umount -l /home/john/work/PYNQ/sdbuild/build/bionic.arm/proc
+ for fs in '$fss'
+ sudo umount -l /home/john/work/PYNQ/sdbuild/build/bionic.arm/run
+ for fs in '$fss'
+ sudo umount -l /home/john/work/PYNQ/sdbuild/build/bionic.arm/dev
+ sudo umount -l /home/john/work/PYNQ/sdbuild/build/bionic.arm/ccache
+ rmdir /home/john/work/PYNQ/sdbuild/build/bionic.arm/ccache
Makefile:324: recipe for target '/home/john/work/PYNQ/sdbuild/output/bionic.arm.2.5.img' failed
make: *** [/home/john/work/PYNQ/sdbuild/output/bionic.arm.2.5.img] Error 2

The “runme.log file” mentioned on the 3rd line didn’t get created. Not sure what’s going on here. Did you come across this?

I’m going to try again with a change I made to the Makefile to get the PREBUILT option to work properly…

Thanks again,
John

Maybe it’s worth going back to 2.4 if the build worked back then?

@JTC

I can’t comment on going back to 2.4, but from the log it seems the build ran out of memory? You’d need probably 8GB or more to build ZCU104. 9 hours is a lot… make sure you have enough RAM and processors in the VM. My build took about 3-4 hours.

Hope that helps,
-Pat

My VM is using 4 cores and 8G of memory. How is yours configured?

Thanks,
John

Also, before I forget: Did you need any other Xilinx IP licenses besides the HDMI?

@JTC

I didn’t need other licenses other than HDMI; however I have a paid full Vivado license, but if you got a ZCU104, it may have come with one. My VM has 16GB RAM and 4 CPUs.

BTW, I also did run with the PREBUILT option.

Thanks,
-Pat

Pat,

Thanks for the info. My VM is probably slow because it is running on a 2016 laptop, and it is on an external SSD as I don’t have room for the VM on the laptop. So file I/O is probably killing the build time.

I ran the build last night with the Ubuntu System Monitor running, and I discovered that it was maxing out the RAM and swap. I guessed that’s why Vivado was getting killed, so I increased the RAM to 12G and added more swap space. This time (and for the first time ever), it did actually produce 3 .img files in the “output” directory that appear to match the size of the prebuilt images for those boards that I downloaded. Looks like it might be just truncating the images to some fixed sizes, so that might not mean anything. I need to do a binary compare with the prebuilt images. However, it still died with an error, so I can’t be sure of their correctness:

Command (m for help): Disk /home/john/work/PYNQ/sdbuild/output/ZCU104-2.5.img: 7 GiB, 7516192768 bytes, 14680064 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xce1fce36

Device                                              Boot  Start      End  Sectors  Size Id Type
/home/john/work/PYNQ/sdbuild/output/ZCU104-2.5.img1 *      2048   206847   204800  100M  c W95 FAT
/home/john/work/PYNQ/sdbuild/output/ZCU104-2.5.img2      206848 12777071 12570224    6G 83 Linux

Command (m for help): The partition table has been altered.
Syncing disks.

+ total_size=6388536
+ truncate -s 6388536K /home/john/work/PYNQ/sdbuild/output/ZCU104-2.5.img
mkdir -p /home/john/work/PYNQ/sdbuild/output/dist
mkdir -p /home/john/work/PYNQ/sdbuild/output/dist/aarch64
cp -rf /home/john/work/PYNQ/sdbuild/build/PYNQ/dist/*.tar.gz /home/john/work/PYNQ/sdbuild/output/dist/aarch64
cp: cannot stat '/home/john/work/PYNQ/sdbuild/build/PYNQ/dist/*.tar.gz': No such file or directory
Makefile:327: recipe for target '/home/john/work/PYNQ/sdbuild/output/dist/aarch64' failed
make: *** [/home/john/work/PYNQ/sdbuild/output/dist/aarch64] Error 1

Other than the ZCU104 BSP, were there any other files missing from the repo that you had to get? Also, you mentioned PREBUILT. What was the exact “make” command line you used?

Really appreciate the help!

Thanks again,
John

Hey @JTC, glad to see you got images built! My build had the same truncation step, so looks fine. I recall seeing that PYNQ/sdbuild/build/PYNQ/dist/*.tar.gz at some point, though on my latest log it isn’t there. Not sure that’s required… perhaps some Pynq guru can explain.
I don’t recall other files added than the prebuilt image. I did have a custom ZCU104 hdf that removed the video subsystem. The file was in ~/PYNQ/boards/ZCU104/petalinux_bsp/system.hdf.
My make command to build only ZCU104 with prebuilt option was:
user@ubuntu1604:~/PYNQ/sdbuild$ make BOARDS=ZCU104 PREBUILT=/home/user/Downloads/bionic.aarch64.2.5.img |& tee pynq-zcu104.log

Thanks,
-Pat

I am sorry to see that someone else is struggling with image rebuilding
Solutions for this are currently internally discussed guys, it just takes some time to act on them as you can imagine.

That dist/* is the tarball that is produced during image building corresponds to the source distribution that we use to pip install the pynq package.
For some reason it seems it was not produced in your run. You can see the target in the Makefile at line 313.
What you could do is remove that line (or remove the Make target altogether), it’s not really needed for your build.

Again, apologies for the trouble in rebuilding images you folks are experiencing. I appreciate though that you guys are helping each other in overcoming this!

1 Like

Giuseppe,

Thanks for the info on the tarball. One thing that would be very helpful for someone trying this from scratch would be to document the fact that a Xilinx HDMI IP license is required. The build error you get when this license is missing is not obvious. Also, when I tried a while back, I was using an Ubuntu 18.04 VM. I had much less trouble this time around with 16.04. The documentation does not specify the Ubuntu version to use (unless I missed that somewhere, but it isn’t mentioned at all here).

Thanks,
John

1 Like

You are right. In particular, the 16.04 requirement is indeed very subtly mentioned here, but not on the official documentation.

We are discussing ways of making the image building process less painful. All your feedbacks were noted and will be considered.

Many thanks!!!

1 Like

No problem. Hopefully we can make this smoother for the next person…

BTW, I just used image_from_prebuilt.sh to make a build for the ZC706:

image_from_prebuilt.sh zc706 xilinx-zc706-v2019.1-final.bsp arm bionic.arm.2.5.img

When I booted the resulting up on the ZC706, the Ethernet was dead. Is network support not included when you build this way?

2 Likes

Quick question: have you included the ethernet package when building your image?
For example, look at the Pynq-Z2.spec here we explicitly add the ethernet package to be installed in the image at build time.

The package is pretty simple, all it does can be seen here. Perhaps just try to manually replicate what is done when installing the package in your already built image.
pre.sh is what “installs” the package, while eth0 is the actual script that brings ethernet up.

I may be wrong and you already did that, but it’s worth a shot.

I was using the “image_from_prebuilt.sh” script, which doesn’t look like it takes a spec file or anything other than a BSP and prebuilt image. (Or does it?) This build was more or less an experiment to see if it would include a base overlay as my previous attempt (which did use a spec file) had ethernet, but was missing a base overlay. I’ll look at the links you sent and try that approach again. Thanks!

you can take a look at GitHub - Avnet/Ultra96-PYNQ: Board files to build Ultra 96 PYNQ image for structure and instructions, it is a partner board and in the readme there are steps on how to build images for the Ultra96. You can try to mirror what is done there.
Hope it helps

1 Like

Hi @patocarr & @JTC , I am resuming this thread to update you on some image build improvements we just pushed into our repo. We took your feedbacks and did a PR (sdbuild flow improvements by giunatale · Pull Request #975 · Xilinx/PYNQ · GitHub) that has been recently merged in.

Along with some documentation improvements (as I already updated @JTC on another thread) that still need to be pushed to the readthedocs page though, we took care of addressing the bitstream rebuilding issue.
You can now use the provided PYNQ source distribution tarball to pass it to the Make command, so that bitstreams and other binaries are re-used instead of being rebuilt. This should fix the HDMI licensing issue for ZCU104 and also avoid to rebuild bitstreams for “unwanted” boards.

To use it, you simply do

make PYNQ_SDIST=<sdist tarball path> 

The feature is already documented on the sdbuild readme and again, it is also ready to be pushed on readthedocs, it’s just a matter of time now.

Again, many thanks for interacting with us and providing valuable feedback, we really appreciate you guys and we want to thank you for being an active part of our community!

1 Like

Hi @gnatale

Great! I’ve tested the option building the ZCU104 and worked like a charm. FYI, I built with make BOARDS=ZCU104 PYNQ_SDIST=<path-to-tar-gz>

I appreciate your efforts in responding to users’ feedback in a timely manner.

Thanks!
-Pat

1 Like