LoginSignup
0
0

More than 1 year has passed since last update.

PetalinuxをWSL環境(Ubuntu20.04)で動かすときに困ったこといろいろ

Last updated at Posted at 2022-11-07

最終更新日 2022.11.11

Petalinuxをインストールするときに困ったことが結構あったのでいくつか備忘録を載せます。今後困る人が少しだけ楽できるといいですね。

現在のPetalinux!

ビルドが終わらない・・・
やっぱりサポートされている16.04.3 LTSを使うべきなのかもしれない・・・

インストール時に参照したページ

Petalinuxインストールするときに最初に参照したページはここ。

Digilentの出しているZybo-Z7を使おうとしている人は、下記のページを読めば環境構築の手順が全部書いてある。

分からんことがあったらXilinxの公式ドキュメントも参照。

Pythonがインストールされていない or バージョンが合わないエラー

インストールに必要なモジュールをドキュメント通りインストールしていざ、下記コマンドを実行すると、

./petalinux-v2017.4-final-installer.run /opt/pkg/petalinux

こんなエラーが出ました。

dpkg-query: package 'python' is not installed and no information is available Use dpkg --info (= dpkg-deb --info) to examine archive files ERROR: You have tools don't meet the version requirements: -Detected python version is less than the expected 2.7.3

pythonのバージョンを確認しても2.7.18が入っているので問題なさそうに見えます。(筆者はとち狂ってpythonの2.7.3よりも前のバージョンを入れなくてはいけないのでは?と考えて2.7.2を入れてみたりして無駄に時間を食いました)
同様のエラーメッセージで調べると既に先人が切り開いてくれている壁のようです。

どうやら、Petalinuxがpythonモジュールを見つけてくれないのが問題で、この回答者は/var/lib/dpkg/statusに直接pythonモジュールの記述を追加して解決したみたいです。

Then manually add an entry for python to /var/lib/dpkg/status. Make a backup of the file before you do this. If you mess up this file you will have a bad day. This entry will work:

That's a copy of the python2 entry, with unnecessary fields removed, and an updated description. The file seems to be sorted alphabetically, so I added this entry where it should be alphabetically.

先人に倣って/var/lib/dpkg/statusのバックアップを作成してから、下記内容をpython2の手前に追記しましょう。(上記リンク上ではVersionに2.7.17を入れていますが、自分の環境のpythonのバージョンに合わせましょう)

Package: python
Status: install ok installed
Maintainer: Fake Entry <fake@example.com>
Architecture: all
Version: 2.7.18
Description: fake package for petalinux

ちなみに自分の環境でもpython-is-python2があることで他のモジュールのインストールに支障をきたすことがありました。そういう状況に陥った方は下記コマンドで削除すると解決します。

sudo apt remove python-is-python2

Build the petalinux projectでこける

Petalinuxインストールバトルに勝利したのも束の間、petalinux-buildで躓きます。

petalinux-build

上記コマンドを実行すると、

ERROR: Failed to generate /home/xxx/work/petalinux/Petalinux-Zybo-Z7-20/Zybo-Z7-20/build/misc/config/Kconfig.syshw
ERROR: Failed to Kconfig project
ERROR: Failed to build project

情報がほぼなにもないエラーが出ました。
ちなみに上記コマンド実行後にはbuildディレクトリができていて、ディレクトリ内のbuild.logの中を見るとこんなエラーが出ています。

/opt/pkg/petalinux/tools/hsm/bin/xsct: line 138: 12633 Segmentation fault      "$RDI_BINROOT"/unwrapped/"$RDI_PLATFORM$RDI_OPT_EXT"/rlwrap -rc -f "$RDI_APPROOT"/scripts/xsdb/xsdb/cmdlist -H "$HOME"/.xsctcmdhistory "$RDI_BINROOT"/loader -exec rdi_xsct "${RDI_ARGS[@]}"

どうやらxsctファイルの138行目が上手く動いていないみたいですね。これも既に先人が切り開いてくれている壁なので、解決策を拝借しましょう。

ちょっと強調させ方がうさんくさいですがなんか他の質問とか見ても、rlwrapを使わずに直接rdi_xsctを動かすと解決したよと言っています。

BEST SOLUTION
I have investigated the problem, and found that the responsible line is the line 137 in the tools/hsm/bin/xsct file.
I have modified the xsct file so that rdi_xsct is called directly, not via rlwrap:

そこで/opt/pkg/petalinux/tools/hsm/bin/xsct内の138行目の内容を、

"$RDI_BINROOT"/unwrapped/"$RDI_PLATFORM$RDI_OPT_EXT"/rlwrap -rc -f "$RDI_APPROOT"/scripts/xsdb/xsdb/cmdlist -H "$HOME"/.xsctcmdhistory "$RDI_BINROOT"/loader -exec rdi_xsct "${RDI_ARGS[

↓に書き換えます。

#"$RDI_BINROOT"/unwrapped/"$RDI_PLATFORM$RDI_OPT_EXT"/rlwrap -rc -f "$RDI_APPROOT"/scripts/xsdb/xsdb/cmdlist -H "$HOME"/.xsctcmdhistory "$RDI_BINROOT"/loader -exec rdi_xsct "${RDI_ARGS[@]}"

"$RDI_BINROOT"/loader -exec rdi_xsct "${RDI_ARGS[@]}"

すると先述のエラーが出なくなりました。

戦いは続く

自分の環境では1時間くらいビルド待ちしていますがまだ完了していないです。待っている間にこの記事を作成しました。今後もいろんなところでつまずくと思うので、その都度この記事を更新していこうと思います。

宿題

使わんしいいやと思って放置してる下記のWARNINGもそのうち解消しようかな…

WARNING: No tftp server found - please refer to "PetaLinux SDK Installation Guide" for its impact and solution
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