# Use pre-built PYNQ/boards base, logictools, etc?

**URL:** <https://discuss.pynq.io/t/use-pre-built-pynq-boards-base-logictools-etc/746>\
**Category:** Support\
**Created:** [December 12, 2019, 5:15am UTC](https://discuss.pynq.io/t/use-pre-built-pynq-boards-base-logictools-etc/746 "2019-12-12T05:15:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfdmod](https://avatars.discourse-cdn.com/v4/letter/r/edb3f5/32.png) [@rfdmod](https://discuss.pynq.io/u/rfdmod)\
**Post date:** [December 12, 2019, 5:15am UTC](https://discuss.pynq.io/t/use-pre-built-pynq-boards-base-logictools-etc/746/1 "2019-12-12T05:15:35Z")

</div>

Support,

I manually ran make for the base, logictools, etc for each board in the PYNQ/boards directories. When I ran PYNQ/sdbuild/make BOARDDIR=\<my\_board\_dir\> BOARDS=\<my\_board\> it once again had to re-build all the base, logictools, etc for each board. Is there a way to have the build process use all the pre-built overlays from the PYNQ/boards directories ? I assume the PYNQ/sdbuild/build/PYNQ/boards/\* are copied from the PYNQ/boards/\* directories however they do not copy the pre-built base overlays etc.

regards

---

<div class="post-metadata">

**Author:** ![patocarr](https://avatars.discourse-cdn.com/v4/letter/p/d2c977/32.png) [@patocarr](https://discuss.pynq.io/u/patocarr)\
**Post date:** [December 12, 2019, 7:41am UTC](https://discuss.pynq.io/t/use-pre-built-pynq-boards-base-logictools-etc/746/2 "2019-12-12T07:41:53Z")

</div>

Hi @rfdmod  
There’s a new feature that handles the build you’re looking for. It’s so recent it hasn’t made it to the documentation yet. Take a look at this post:  
[https://discuss.pynq.io/t/problems-getting-build-system-up-and-running/665/18](https://discuss.pynq.io/t/problems-getting-build-system-up-and-running/665/18)

Thanks,  
-Pat

---

<div class="post-metadata">

**Author:** ![gnatale](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/gnatale/32/11_2.png) [@gnatale](https://discuss.pynq.io/u/gnatale)\
**Post date:** [December 12, 2019, 12:43pm UTC](https://discuss.pynq.io/t/use-pre-built-pynq-boards-base-logictools-etc/746/3 "2019-12-12T12:43:20Z")

</div>

I’d recommend you use the fature @patocarr suggested and avoid building the bistreams yourself altogether. I also suggest you to use the prebuilt rootfs so you will save even more time.

The two options are documented here: [PYNQ/sdbuild at master · Xilinx/PYNQ · GitHub](https://github.com/Xilinx/PYNQ/tree/master/sdbuild)  
and here (not yet updated on readthedocs): [PYNQ/pynq\_sd\_card.rst at master · Xilinx/PYNQ · GitHub](https://github.com/Xilinx/PYNQ/blob/master/docs/source/pynq_sd_card.rst)  
In particular:

- [PYNQ/pynq\_sd\_card.rst at master · Xilinx/PYNQ · GitHub](https://github.com/Xilinx/PYNQ/blob/master/docs/source/pynq_sd_card.rst#re-use-the-pynq-source-distribution-tarball)
- [PYNQ/pynq\_sd\_card.rst at master · Xilinx/PYNQ · GitHub](https://github.com/Xilinx/PYNQ/blob/master/docs/source/pynq_sd_card.rst#using-the-prebuilt-board-agnostic-image)

The relevant excerpt from the sdbuild readme:

* * *

To use a board-agnostic image to build a board-specific image you can pass the `PREBUILT` variable:

`make PREBUILT=<image path> BOARDS=<board>`

To use a previously built PYNQ source distribution tarball you can pass the `PYNQ_SDIST` variable. This will also avoid having to rebuild bitstreams (except for external boards) and MicroBlazes’ bsps and binaries.

`make PYNQ_SDIST=<sdist tarball path>`

---

<div class="post-metadata">

**Author:** ![rfdmod](https://avatars.discourse-cdn.com/v4/letter/r/edb3f5/32.png) [@rfdmod](https://discuss.pynq.io/u/rfdmod)\
**Post date:** [December 14, 2019, 3:40am UTC](https://discuss.pynq.io/t/use-pre-built-pynq-boards-base-logictools-etc/746/4 "2019-12-14T03:40:31Z")

</div>

Hi Gnatele,

I used the two options mentioned, however it is still trying to re-build the bitstreams  
for the boards.

When PYNQ/sdbuild/build/PYNQ/sdbuild/packages/pynq/pre.sh reaches  
line 41 overlays=`find . -maxdepth 2 -iname 'makefile' -printf '%h\n' | cut -f2 -d"/"`  
it will not find any overlays since the ‘makefiles’ are not present in the untarred pynq-2.5.tar.gz

I downloaded pynq-2.5.tar.gz from [Releases · Xilinx/PYNQ · GitHub](https://github.com/Xilinx/PYNQ/releases)

you can see this in my log file below:

++ ls /home/user/local/git/PYNQ/sdbuild/build/PYNQ/sdist\_untar/pynq-2.5/boards

- boards=‘Pynq-Z1  
Pynq-Z2  
ZCU104’
- for bd\_name in ‘$boards’
- cd /home/user/local/git/PYNQ/sdbuild/build/PYNQ/sdist\_untar/pynq-2.5/boards/Pynq-Z1  
++ find . -maxdepth 2 -iname makefile -printf ‘%h\n’  
++ cut -f2 -d/
- overlays=
- for bd\_name in ‘$boards’
- cd /home/user/local/git/PYNQ/sdbuild/build/PYNQ/sdist\_untar/pynq-2.5/boards/Pynq-Z2  
++ find . -maxdepth 2 -iname makefile -printf ‘%h\n’  
++ cut -f2 -d/
- overlays=
- for bd\_name in ‘$boards’
- cd /home/user/local/git/PYNQ/sdbuild/build/PYNQ/sdist\_untar/pynq-2.5/boards/ZCU104  
++ find . -maxdepth 2 -iname makefile -printf ‘%h\n’  
++ cut -f2 -d/
- overlays=
- rm -rf /home/user/local/git/PYNQ/sdbuild/build/PYNQ/sdist\_untar
- cd /home/user/local/git/PYNQ/sdbuild/build/PYNQ
- ./build.sh  
./build.sh

Script for building default overlays, microblaze bsp’s and binaries.

skipping bitstream base.bit for SnickerdoodleBlack  
skipping bitstream logictools.bit for Pynq-Z2  
building bitstream base.bit for Pynq-Z2  
make[1]: Entering directory ‘/home/user/local/git/PYNQ/sdbuild/build/PYNQ/boards/Pynq-Z2/base’  
vivado -mode batch -source build\_base\_ip.tcl -notrace

---

<div class="post-metadata">

**Author:** ![gnatale](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/gnatale/32/11_2.png) [@gnatale](https://discuss.pynq.io/u/gnatale)\
**Post date:** [December 16, 2019, 11:45am UTC](https://discuss.pynq.io/t/use-pre-built-pynq-boards-base-logictools-etc/746/5 "2019-12-16T11:45:17Z")

</div>

I am sorry, you are totally right! During testing, I happened to use an sdist that had the makefile in it so I introduced this bug. I’ll immediately file a PR to fix it.  
In the meantime, I suggest you change the incriminated line with what the PR will look like

> <https://github.com/Xilinx/PYNQ/blob/master/sdbuild/packages/pynq/pre.sh#L47>

into  
`overlays=`find . -maxdepth 2 -iname ‘\*.bit’ -printf ‘%h\n’ | cut -f2 -d"/"``

EDIT: PR submitted: [Fix bug in pynq pre.sh for external boards by giunatale · Pull Request #979 · Xilinx/PYNQ · GitHub](https://github.com/Xilinx/PYNQ/pull/979)  
Thanks again for pointing this out!

---

<div class="post-metadata">

**Author:** ![rfdmod](https://avatars.discourse-cdn.com/v4/letter/r/edb3f5/32.png) [@rfdmod](https://discuss.pynq.io/u/rfdmod)\
**Post date:** [December 16, 2019, 6:14pm UTC](https://discuss.pynq.io/t/use-pre-built-pynq-boards-base-logictools-etc/746/6 "2019-12-16T18:14:55Z")

</div>

I’m not sure if this will affect anyone else but I am using a vmware virtual machine and after patching the overlay line as suggested and restarting the build, I received the following error:

rm -rf base \*.jou \*.log NA  
make[1]: Leaving directory ‘/home/user/local/git/PYNQ/sdbuild/build/PYNQ/boards/ZCU104/base’

- cd /home/user/local/git/PYNQ/sdbuild/build/PYNQ
- python3 setup.py sdist  
Traceback (most recent call last):  
File “setup.py”, line 34, in   
from setuptools import setup, Extension, find\_packages, Distribution  
ImportError: No module named ‘setuptools’
- unmount\_special

To fix this I had to do the following:

sudo apt install python3-pip  
sudo pip3 install --upgrade “setuptools\>=24.2.0”

After that the build completed fine. The entire build after a make clean now only takes about 27 minutes for my setup !! Thanks for all your work.

---

<div class="post-metadata">

**Author:** ![gnatale](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/gnatale/32/11_2.png) [@gnatale](https://discuss.pynq.io/u/gnatale)\
**Post date:** [December 17, 2019, 11:09am UTC](https://discuss.pynq.io/t/use-pre-built-pynq-boards-base-logictools-etc/746/7 "2019-12-17T11:09:30Z")

</div>

setup\_host.sh has this install at the bottom.

> <https://github.com/Xilinx/PYNQ/blob/master/sdbuild/scripts/setup_host.sh#L123>

So this should not be a problem. Perhaps I am assuming you built the VM before I did the PR to fix the imagebuild (that’s when I added that line in setup\_host)

---

<div class="post-metadata">

**Author:** ![gnatale](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/gnatale/32/11_2.png) [@gnatale](https://discuss.pynq.io/u/gnatale)\
**Post date:** [December 17, 2019, 11:10am UTC](https://discuss.pynq.io/t/use-pre-built-pynq-boards-base-logictools-etc/746/8 "2019-12-17T11:10:04Z")

</div>

btw, the PR mentioned above got merged yesterday 🙂

Again, thanks for reporting this out!
