element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Eye On Intelligence Challenge
  • Challenges & Projects
  • Design Challenges
  • Eye On Intelligence Challenge
  • More
  • Cancel
Eye On Intelligence Challenge
Blog Z7_Color_AID Blog #2: Reproduce PYNQ Image on Ubuntu 20.04
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Eye On Intelligence Challenge to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: flyingbean
  • Date Created: 21 Oct 2024 12:17 AM Date Created
  • Views 761 views
  • Likes 6 likes
  • Comments 2 comments
  • video processing
  • arty z7
  • zynq
  • xilinx
  • jupyter
  • Eye on Intelligence Challenge
  • pynq
Related
Recommended

Z7_Color_AID Blog #2: Reproduce PYNQ Image on Ubuntu 20.04

flyingbean
flyingbean
21 Oct 2024

Table of Contents

  • Motivation to Rebuild Pynq_Z1 Image
  • Rebuild Pynq_Z1 image
  • Test Rebuilt Pynq_Z1_v3.0.1 Image
  • Future Path on PYNQ/Z7_Color_AID Project
  • References

Motivation to Rebuild Pynq_Z1 Image

Porting a supported PYNQ platform from PYNQ github to a custom board can be very challenging. I am still in the middle of learning how to build a PYNQ image on a custom board. I did spend a couple of weeks to reproduce Pynq_Z1_v2.6 image. However, it was a dead end from my experiment since there were a lot of dependencies for building Pynq_Z1_v2.6 image are no longer supported by the repositories which were called by the cross-compiler tool chains/Make scripts. After I failed to rebuild Pynq_Z1_v2.6 image on Ubuntu 18.04 last month, I think it is good to share my experience about reproducing PYNQ v3.0.1 image in house.

This blog is going to share my journey to rebuild Pynq_Z1_v3.0.1 image on Ubuntu 20.04.

Rebuild Pynq_Z1 image

I installed Oracle VirtualBox 7.0 on Windows 10. I downloaded Vitis 2022.1 and Petalinux 2022.1 from AMD/Xilinx website. I also installed Ubuntu 20.04 on VirtuaBox 7.0 environment. I will only describe how I reproduced Pynq_Z1_v3.0.1.img on my PC in this blog post.   

As my last blog mentioned, one of the valuable resources for learning PYNQ is PYNQ official documentation website (Ref[1]). PYNQ SD Card image section covered most of the contents to build PYNQ images. I started my journey after I read “Building the Image From Source” section of Ref[1]. I did not use vagrant software to configure the environment. I already validated Vitis 2022.1 and Petalinux 2022.1 on Ubuntu 20.04. If you don’t know how to install Vitis 2022.1 and Petalinux 2022.1 on Ubuntu, please google the topic. There are many blogs about this topic to help you with proper installation procedures.

1. Clone PYNQ Github

Log into Ubuntu 20.04 environment and create a folder at home directory. I named it as project_folder to instead of ./Projects/Zynq/Arty_Z7_20/PYNQ_image_build. Then clone PYNQ github as below first.

$ (Project_folder) git clone https://github.com/Xilinx/PYNQ.git

image

Get into PYNQ folder as below, then check out v3.0.1 branch.

$(project_folder)/PYNQ git checkout v3.0.1

image

2. Setup build environment

Properly setup environment is very important.  The key file of that is setup_host.sh under (project_folder)/PYNQ/sdbuild/script.

image

There is one line of scripts at setup_host.sh from v3.0.1 Github checkout which is out of date. Please correct it as below. The link of qemu download  was changed to https://download.qemu.org at this blog drafting time.

image

After saving the updated setup_host.sh, use this command as below to building cross-compiler tool chains for PYNQ. Please pay attention to where to start running the script.

$(project_folder ) ./sdbuild/scripts/setup_host.sh

image

It will take one hour or so to build the cross-compiler tool chains. The time might be varied depending on the PC features. Here is the snapshot of the location of the cross-compiler tool chains on the Ubuntu.

image

I updated .bashrc file for PATH environment variable as below for this project. The PATH was updated as this

export PATH=”/opt/crosstool-ng/bin:/opt/qemu/bin:$PATH”

image

Notes: .bashrc is located at /home/flyingbean on my Ubuntu.

Please run the command after updating .bashrc at the same directory of .bashrc.

$ source .bashrc

image

I can check PYNQ environment with this command:

$(project_folder ) ./sdbuild/scripts/check_env.sh

 image

3. Download prebuilt files

Starting from PYNQ v3.0.1, prebuilt folder has to be setup before building PYNQ image.

There is no any file under ./sdbuild/prebuilt from PYNQ github checkout.

image

Two files will be added into prebuilt folder before running Make flow. Ref[2] for v3.0.1 listed the download link for the files: one is rootfs tarball, another is PYNQ source distribution binary.

image

Since it is Zynq FPGA, PYNQ rootfs arm v3.0.1 is needed for the project. The name for Zynq rootfs tarball is jammy.art.3.0.1.gz . I copied jammy.arm.3.0.1.gz and pynq-3.0.1.tar.gz into ./sdbuild/prebuilt folder as below.

image

However, the MAKE flow of PYNQ only accepts normalized names with .tar.gz format tarball. So I renamed both files as the guidance from Ref[1] as below.

$(project_folder )/PYNQ/sdbuild/prebuilt$ mv jammy.arm.3.0.1.gz pynq_rootfs.arm.tar.gz

$(project_folder )/PYNQ/sdbuild/prebuilt$ mv pynq-3.0.1.tar.gz pynq_sdist.tar.gz

image

4.Build PYNQ v3.0.1 image

A simple make script can handle the image build flow as below.

$(project_folder )/PYNQ/sdbuild $ make BOARDS=Pynq-Z1

image

The whole building time is around a few hours here.

image

image

If there is no error during the building flow, the above snapshot is the end of successfully building a PYNQ image.

The PYNQ image file is located at output folder under sdbuild directory.

image

Test Rebuilt Pynq_Z1_v3.0.1 Image

I burned the reproduce Pynq-Z1-3.0.1.img into another SD card and inserted it into Arty-Z7-20 platform. It booted same as the original PYNQ image. Two user application cases were tested as follows for the reproduced Pynq_Z1_v3.0.1 image.

image

1. OpenCV testing via HDMI/Webcam

OpenCV is the key feature for Z7_Color_AID  project. I did test the sample code from PYNQ image: opencv_filters_webcam.ipynb.

image

opencv_filters_webcam.ipynb on Jupyter lab:

image

2. PYNQ/Jupyter audio library sample code for audio output on Arty_Z7_20

I planed to use the audio output for Z7_Color_AID project. It is time to test the feature of PYNQ/Jupyter audio library on Arty_Z7_20. The baseline file is audio_playback.ipynb from /base/audio folder inside the Pynq_Z1_v3.0.1 image.

image

There is no audio recording feature on Arty_Z7_20 platform. So I commented out the record routing at audio_playback.ipynb as below.
image

I downloaded a sample WAV file as the audio file for the audio port on Arty_Z7_20 platform. I used a speaker to play the sample WAV format audio now.

image

The beauty of the PYNQ/Jupyter audio library is that I can play the audio from Web Browser as well.

image

Here is the video recording of the audio feature on PYNQ/Arty_Z7_20.

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

There are more features from PYNQ audio library for the sample WAV file, such as amplitude plot on time domain, frequency domain, even audio signal spectrogram as below.

image

image

image

I am fully impressed by PYNQ/Jupyter audio library features.

From now on, I will use the rebuilt PYNQ images for my projects.

Future Path on PYNQ/Z7_Color_AID Project

I will present what I learned from PYNQ overlay features and PYNQ library structure for the development of Z7_Color_AID  project in the future blogs.

 

References

[1] PYNQ SD Card image   v3.1     https://pynq.readthedocs.io/en/latest/pynq_sd_card.html      2024

[2] https://www.pynq.io/boards.html                                                                                                2024

Z7_Color_AID-Blog#01

  • Sign in to reply
  • nsptrq
    nsptrq 11 days ago

    Hi, I'm currently working on rebuilding the PYNQ image for a custom board. Could you share what specific requirement files or configuration files need to be included in the board folder (e.g., board.spec, hdf/xsa , .bsp, etc.)? I want to make sure I have everything set up correctly before starting the build process. Thanks in advance!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB 8 months ago

    Interesting results.

    I was surprised to see that there were extensive audio analysis software for the pynq.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube