Petalinux2018.3によるzynq-7000ブート用SDカード作成 のバックアップ差分(No.2)

更新


  • 追加された行はこの色です。
  • 削除された行はこの色です。
[[公開メモ]]

* Petalinux 2018.3 を使って zynq-7000 用のブートSDカードを作る [#xf4d6dda]

[[電気回路/zynq/Petalinux2018.3環境を整える]] の続き。

以前、Petalinux 2016.4 でやった [[電気回路/zynq/Petalinux のビルド#aabc4100]] を新しいバージョンでやり直すことになる。
以前、Petalinux 2016.4 でやった [[電気回路/zynq/Petalinux のビルド#aabc4100]] および [[電気回路/zynq/Petalinux のカスタマイズ#p4f8f224]] を新しいバージョンでやり直すことになる。

ターゲットは z-turn board
#contents

ターゲットは z-turn board で、これまで以下のような記事を書いていた。

#ls2(電気回路/z-turn,compact)

Petalinux により標準でサポートされている環境ではない(BSP が提供されていない)ので、
いろいろ調べながらやることになる。

* プロジェクトの作成 [#o40aac7b]

z-turn ボードに対応する BSP は配布されていないので、
zynq の汎用テンプレートを使ってプロジェクトを作る。
(BSP が配布されているシステムであればプロジェクト作成時に BSP を指定する)

プロジェクトルートに .gitignore が作られるので、
それをそのまま使うことで git による管理が基本的には可能となる。

ただし、現時点で petalinux の git 対応は完全ではないため、
プロジェクトを共有するには BSP を使った方が良い、との注意もあった。

 LANG:console
 $ cd
 $ mkdir petalinux
 $ cd petalinux
 $ petalinux-create -t project --template zynq -n zturn_v2018.3
  INFO: Create project: zturn_v2018.3
  INFO: New project successfully created in /home/takeuchi/petalinux/zturn_v2018.3
 $ cd zturn_v2018.3
 $ ls -a
  ./  ../  .gitignore  .petalinux/  config.project  project-spec/
 $ cat .gitignore
  */*/config.old
  */*/rootfs_config.old
  build/
  images/linux/
  pre-built/linux/
  .petalinux/*
  !.petalinux/metadata
  *.o
  *.jou
  *.log
  project-spec/meta-plnx-generated/
  /components/plnx_workspace
 $ git init
  Initialized empty Git repository in /home/takeuchi/petalinux/zturn_v2018.3/.git/
 $ git add .
 $ git config --global user.email "osamu@big.jp"
 $ git config --global user.name "Osamu Takeuchi"
 $ git commit -m "newly created"
  [master (root-commit) 441cd0f] newly created
   22 files changed, 997 insertions(+)
   create mode 100644 .gitignore
   create mode 100644 config.project
   create mode 100644 project-spec/attributes
   create mode 100644 project-spec/configs/config
   create mode 100644 project-spec/configs/rootfs_config
   create mode 100644 project-spec/hw-description/metadata
   create mode 100644 project-spec/meta-user/COPYING.MIT
   create mode 100644 project-spec/meta-user/README
   create mode 100644 project-spec/meta-user/conf/layer.conf
   create mode 100644 project-spec/meta-user/conf/petalinuxbsp.conf
   create mode 100644 project-spec/meta-user/recipes-apps/gpio-demo/files/Makefile
   create mode 100644 project-spec/meta-user/recipes-apps/gpio-demo/files/gpio-demo.c
   create mode 100644 project-spec/meta-user/recipes-apps/gpio-demo/gpio-demo.bb
   create mode 100644 project-spec/meta-user/recipes-apps/peekpoke/files/Makefile
   create mode 100644 project-spec/meta-user/recipes-apps/peekpoke/files/peek.c
   create mode 100644 project-spec/meta-user/recipes-apps/peekpoke/files/poke.c
   create mode 100644 project-spec/meta-user/recipes-apps/peekpoke/peekpoke.bb
   create mode 100644 project-spec/meta-user/recipes-bsp/device-tree/device-tree.bbappend
   create mode 100644 project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
   create mode 100644 project-spec/meta-user/recipes-bsp/u-boot/files/platform-top.h
   create mode 100644 project-spec/meta-user/recipes-bsp/u-boot/u-boot-xlnx_%.bbappend
   create mode 100644 project-spec/meta-user/recipes-core/images/petalinux-image-full.bbappend

config.project と project-spec/ とがプロジェクトの本体になる。

* vivado のハードウェア設定を取り込みつつ基本の設定 [#o3495afb]

[[vivado のハードウェア設定を出力する>電気回路/zynq/Petalinux のビルド#a82e50cc]] の手順で 
system.hdf ファイルを作成して、zturn_v2018.3/hw_platform/system.hdf に置いた。

 LANG:console
 $ ls hw_platform/
  system.hdf
 $ petalinux-config --get-hw-description=hw_platform
  INFO: Getting hardware description...
  [INFO] generating Kconfig for project
  [INFO] menuconfig project
  (設定画面が現れる → とりあえず何も変更せずに Exit して設定を保存する)
  configuration written to /home/takeuchi/petalinux/zturn_v2018.3/project-spec/configs/config
  
  *** End of the configuration.
  *** Execute 'make' to start the build or try 'make help'.
  
  [INFO] sourcing bitbake
  [INFO] generating plnxtool conf
  [INFO] generating meta-plnx-generated layer
  [INFO] generating machine configuration
  [INFO] generating bbappends for project . This may take time !
  [INFO] generating u-boot configuration files
  [INFO] generating kernel configuration files
  [INFO] generating kconfig for Rootfs
  [INFO] oldconfig rootfs
  [INFO] generating petalinux-user-image.bb
 $ git diff
 $

とりあえず何も変更せずに Exit したところ、
git 先生は何も変っていないとおっしゃる・・・ほんとに?

 LANG:console
 $ ls
  build/  components/  config.project  hw_platform/  project-spec/
 $ ls build/
  bitbake-cookerdaemon.log  cache/  conf/  config.log  misc/  sstate-cache/  tmp/

./build に config.log やら conf/ やらできてますが無視するわけ???

.gitignore はもう少しちゃんと見直すべきっぽい。

** 罫線の表示がおかしい [#t90ff50a]

設定画面が現れたのだけれど・・・そのままだと罫線部分が文字化けする。

&ref(petalinux-config1.png,,50%);

https://islandcnt.exblog.jp/16849117/ の "-YaSTのライン化け-" にあるように、
PuTTY の設定で Charactor set を use font encording にすればいいらしい。

&ref(petalinux-config2.png,,50%);

ただこれだと LANG=ja_JP.UTF-8 での日本語表示がおかしくなる。

http://totech.hateblo.jp/entry/2014/09/22/071012 にあるように 
ja_JP.sjis ロケールを追加して、

 LANG:console
 $ sudo localedef -f SHIFT_JIS -i ja_JP ja_JP.SJIS
  character map `SHIFT_JIS' is not ASCII compatible, locale not ISO C compliant
 $ export LANG=ja_JP.sjis
  takeuchi@petalinux2019-3:~/petalinux/zturn_v2018.3$ ls -l
  合計 28
  drwxrwxr-x 7 takeuchi takeuchi 4096  3月 15 20:38 build
  drwxrwxr-x 3 takeuchi takeuchi 4096  3月 15 20:31 components
  -rw-r--r-- 1 takeuchi takeuchi  248  3月 15 20:14 config.project
  drwxrwxr-x 2 takeuchi takeuchi 4096  3月 15 20:30 hw_platform
  drwxr-xr-x 6 takeuchi takeuchi 4096  3月 15 20:36 project-spec

のようにすれば文字化けはなくなるのだけれど・・・今時 Linux ターミナルで
SJIS 使うのはどうなのかと。

LANG=C で進めるか、その都度 PuTTY の設定を変える方がよいのかもしれない。

* export LANG=C すべき [#rfb10738]

ああそうか、そもそも [[電気回路/zynq/Petalinux のビルド#y0c5addb]] で痛い目に遭ったように、
Petalinux 自体が LANG=C 以外だとおかしな事になるんだった。

この問題は今も続いているようで、

 LANG:console
 $ export LANG=ja_JP.sjis
 $ petalinux-build -c kernel
  [INFO] building kernel
  [INFO] sourcing bitbake
  INFO: bitbake virtual/kernel
  Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).
  Python can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.
  ERROR: Failed to build kernel

のように、自ら検出してエラーを出してくれるようになっていた。

あれ?エラーメッセージを読むと UTF-8 なら問題ないと書いてある???

というかむしろ、

 LANG:console
 $ export LANG=C
 $ petalinux-build -c kernel
  [INFO] building kernel
  [INFO] sourcing bitbake
  INFO: bitbake virtual/kernel
  Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).
  Python can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.
  ERROR: Failed to build kernel

LANG=C だと UTF-8 が処理できないのでダメらしい。

* 暗号化ファイルシステムの問題 [#haea0979]

ということは、LANG=ja_JP.UTF-8 なら問題ない?

 LANG:console
 $ export LANG=ja_JP.UTF-8
 $ petalinux-build -c kernel
  [INFO] building kernel
  [INFO] sourcing bitbake
  INFO: bitbake virtual/kernel
  ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
      Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
      Following is the list of potential problems / advisories:
  
      Failed to create a file with a long name in TMPDIR. Please use a filesystem that does not unreasonably limit filename length.
  Failed to create a file with a long name in SSTATE_DIR. Please use a filesystem that does not unreasonably limit filename length.
 
  Summary: There was 1 ERROR message shown, returning a non-zero exit code.
 ERROR: Failed to build kernel

今度は長いファイル名を使えないのがダメと言われた。

うわーこれきついや。

仕方がないので [[ホームディレクトリ暗号化の解除>電気回路/zynq/Petalinux2018.3環境を整える#e1dacfc9]]
の手順で暗号化を解除した。

すると、

 LANG:console
 $ source /opt/petalinux_2018.3/settings.sh
 $ petalinux-build -c kernel
  [INFO] building kernel
  [INFO] sourcing bitbake
  INFO: bitbake virtual/kernel
  Parsing recipes:   5%

のようにビルドが進むようになった。

* 設定 [#ne1acba3]


Counter: 12742 (from 2010/06/03), today: 1, yesterday: 0