LoginSignup
0
0

More than 1 year has passed since last update.

Xilinx ZCU102向けPYNQビルドと確認(v2.7対応)

Last updated at Posted at 2022-07-21

前回image_v2.6.2をベースにビルド方法と動作確認を実施しましたが、その後v2.7が出てきたので、ZCU102向けにビルドしました。
今回もいろいろ大変だったので備忘録として残しておきます。

前提となる環境

  • Ubuntu 18.04
  • Vitis 2020.2
  • Petalinux 2020.2

バージョンが固定されており、上記の組み合わせ以外ではビルドはできません。
Vitis 2020.2はY2K22による不具合がありますので、必ずパッチを適用して下さい。

事前準備

次のファイルを~/に用意します。

本バージョンは前回のようにZCU104用PYNQ Imageをベースに作ろうとしたら上手くいかなかったので、ソースコードからビルドします。

ビルド実行

以下のスクリプトを実行します。
スクリプトの中の./scripts/setup_host.shの時点でQEMU等をコンパイル・インストールするので、Ubuntu 18.04のroot権限が必要です。

# pynq
git clone https://github.com/Xilinx/PYNQ.git -b image_v2.7 --depth 1
cd PYNQ

# ZCU102 setting
cp -rf ./boards/ZCU104 ./boards/ZCU102
rm -rf ./boards/ZCU102/petalinux_bsp/
mv ./boards/ZCU102/ZCU104.spec ./boards/ZCU102/ZCU102.spec
sed -i -e "s/104/102/g" ./boards/ZCU102/ZCU102.spec

# copy files
cp ~/xilinx-zcu102-v2020.2-final.bsp ./boards/ZCU102/

# install qemu,crosstool-ng
cd ./sdbuild/
./scripts/setup_host.sh

# path
PATH=/opt/qemu/bin:/opt/crosstool-ng/bin:$PATH
source /<path/to>/xilinx/Petalinux/2020.2/settings.sh
source /<path/to>/xilinx//Vitis/2020.2/settings64.sh

# build
sudo echo
make BOARDS=ZCU102

ライブラリの手動ダウンロードとビルド再開

ビルドを進めると、以下のところでビルドエラーとなります。

***********************************************************

Initially reported by: Peter Ogden
URL:

***********************************************************

WARNING! This sample may enable experimental features.
         Please be sure to review the configuration prior
         to building and using your toolchain!
Now, you have been warned!

***********************************************************

Now configured for "aarch64-linux-gnu,microblazeel-xilinx-elf"
gmake[1]: Leaving directory '/home/xilinx/PYNQ/sdbuild/build/gcc-mb'
+ ct-ng build
gmake[1]: Entering directory '/home/xilinx/PYNQ/sdbuild/build/gcc-mb'
[INFO ]  Performing some trivial sanity checks
[WARN ]  Number of open files 1024 may not be sufficient to build the toolchain; increasing to 2048
[INFO ]  Build started 20220721.221505
[INFO ]  Building environment variables
[INFO ]  =================================================================
[INFO ]  Retrieving needed toolchain components' tarballs
[ERROR]    isl: download failed
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Retrieving needed toolchain components' tarballs'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_Abort[scripts/functions@487]
[ERROR]  >>        called from: CT_DoFetch[scripts/functions@2103]
[ERROR]  >>        called from: CT_PackageRun[scripts/functions@2063]
[ERROR]  >>        called from: CT_Fetch[scripts/functions@2174]
[ERROR]  >>        called from: do_isl_get[scripts/build/companion_libs/121-isl.sh@16]
[ERROR]  >>        called from: do_companion_libs_get[scripts/build/companion_libs.sh@15]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@648]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      https://crosstool-ng.github.io/docs/known-issues/
[ERROR]  >>
[ERROR]  >> NOTE: Your configuration includes features marked EXPERIMENTAL.
[ERROR]  >> Before submitting a bug report, try to reproduce it without enabling
[ERROR]  >> any experimental features. Otherwise, you'll need to debug it
[ERROR]  >> and present an explanation why it is a bug in crosstool-NG - or
[ERROR]  >> preferably, a fix.
[ERROR]  >>
[ERROR]  >> NOTE: You configuration uses non-default patch sets. Please
[ERROR]  >> select 'bundled' as the set of patches applied and attempt
[ERROR]  >> to reproduce this issue. Issues reported with other patch
[ERROR]  >> set selections (none, local, bundled+local) are going to be
[ERROR]  >> closed without explanation.
[ERROR]  >>
[ERROR]  >>  If you feel this is a bug in crosstool-NG, report it at:
[ERROR]  >>      https://github.com/crosstool-ng/crosstool-ng/issues/
[ERROR]  >>
[ERROR]  >>  Make sure your report includes all the information pertinent to this issue.
[ERROR]  >>  Read the bug reporting guidelines here:
[ERROR]  >>      http://crosstool-ng.github.io/support/
[ERROR]
[ERROR]  (elapsed: 4:52.63)
[04:53] / /opt/crosstool-ng/bin/ct-ng:261: recipe for target 'build' failed
gmake[1]: *** [build] Error 1
gmake[1]: Leaving directory '/home/xilinx/PYNQ/sdbuild/build/gcc-mb'
/home/xilinx/PYNQ/sdbuild/packages/gcc-mb/Makefile:17: recipe for target '/home/xilinx/PYNQ/sdbuild/build/gcc-mb/aarch64/microblazeel-xilinx-elf/bin/mb-gcc' failed
make: *** [/home/xilinx/PYNQ/sdbuild/build/gcc-mb/aarch64/microblazeel-xilinx-elf/bin/mb-gcc] Error 2


これはislのダウンロードリンクが失われており、ダウンロードができないためです。
./sdbuild/build/gcc-mb/.build/tarballs/ディレクトリにて手動でダウンロードして下さい。

wget http://mirror.sobukus.de/files/src/isl/isl-0.20.tar.xz
wget http://mirror.sobukus.de/files/src/isl/isl-0.20.tar.xz

再び、ビルドを実行します。
ビルド中、しばしばsudoコマンドを実行するためにパスワード入力待ちとなってしまうのでビルド中にほったらかしにできません。

cd ./sdbuild/

# path
PATH=/opt/qemu/bin:/opt/crosstool-ng/bin:$PATH
source /<path/to>/xilinx/Petalinux/2020.2/settings.sh
source /<path/to>/xilinx//Vitis/2020.2/settings64.sh

# build
sudo echo
make BOARDS=ZCU102

動作確認

ビルドが完了すると、PYNQ/sdbuild/outputZCU102-2.7.0.imgという名でイメージファイル(約8.7GB)が生成されます。
これをSDカードに書き込みます。
自分はWindowsにコピーして、rufusでSDカードに書き込みました。

SDカードをZCU102に挿入してブートさせると、DisplayPort出力からPYNQのデスクトップ環境が立ち上がります。
前回と違って今回のブラウザはFirefoxのようです。
image.png

filrefoxブラウザーからlocalhostを入力すると、Jupyter Notebookに入ることができます。パスワードはxilinxです。

ビルド時間等

CPUがRyzen 9 5950X搭載のUbuntu 18.04でビルドは約12時間かかりました。
またPYNQディレクトリ全体で約58GB消費します。
今回はソースコードからのビルドだったので、とても時間がかかりました。生成されたZCU102-2.7.0.imgは大切に取っておきましょう...。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0