Petalinux のカスタマイズ のバックアップ差分(No.4)
更新- バックアップ一覧
- 現在との差分 を表示
- ソース を表示
- バックアップ を表示
- 電気回路/zynq/Petalinux のカスタマイズ へ行く。
- 追加された行はこの色です。
- 削除された行はこの色です。
[[電気回路/zynq]] * 概要 [#y8f64369] [[電気回路/zynq/Petalinux のビルド]] の続きです。 z-turn ボード用に Petalinux から起動 SD カードを作ったのですが、 - シリアルポート番号の問題でメインコンソールが正常起動しない - BOOT.bin と image.ub だけ、という構成は部分的な差し替えが難しいので改善したい - その他諸々 いろいろ不満があるので解決しようと思います。 #contents * フォルダ構成 [#c9712a98] - ~~/z-turn/ -- petalinux/ : petalinux SDK のルートフォルダ -- zturn-v2016.4/ : プロジェクトのルートフォルダ -- design_1_wrapper_hw_platform_1/ : vivado から export したフォルダ 主にプロジェクトのルートフォルダである ~/z-turn/zturn-v2016.4/ で作業します。 * 環境設定スクリプト [#d4b540f1] - petalinux-setup というコマンドで petalinux 環境を整えられるようにした - petalinux のコマンドは LANG=C でないと動かないので、 忘れずに LANG=C するために alias を設定した LANG:console $ alias petalinux-setup='source ~/z-turn/petalinux/settings.sh' $ petalinux-setup PetaLinux environment set to '/home/osamu/z-turn/petalinux' WARNING: /bin/sh is not bash! bash is PetaLinux recommended shell. Please set your default shell to bash. INFO: Checking free disk space INFO: Checking installed tools INFO: Checking installed development libraries INFO: Checking network and other services $ set | grep PETA PETALINUX=/home/osamu/z-turn/petalinux PETALINUX_VER=2016.4 $ petalinux-^t petalinux-boot petalinux-config petalinux-package petalinux-util petalinux-build petalinux-create petalinux-setup $ petalinux-^c $ cat >> ~/.bashrc # 自動実行スクリプトに登録する alias petalinux-setup='export LANG=C; source ~/z-turn/petalinux/settings.sh' alias petalinux-boot='LANG=C petalinux-boot' alias petalinux-build='LANG=C petalinux-build' alias petalinux-config='LANG=C petalinux-config' alias petalinux-create='LANG=C petalinux-create' alias petalinux-package='LANG=C petalinux-package' alias petalinux-util='LANG=C petalinux-util' ^D * UART 設定 [#oa312ad9] たぶん3つの方法があって、 たぶん4つの方法があって、 + vivaldo の mio 設定で UART0 のピン配置と UART1 のピン配置を入れ替えてしまう方法。 -- これをしてしまうと、z-turn 付属の DVD から作った SD カードなどとは設定が異なってしまうので、後々ちょっとだけ 面倒かもしれない。 + 真面目に設定項目を探して ttyPS1 を使ってもらえるようにすること。 + そもそも使っていない UART を off にしてしまうこと。 + devicetree で ttyPS0 と ttyPS1 を入れ替える方法 + Linux 側の設定項目を探して ttyPS1 を使ってもらう方法 + そもそも使っていない UART を off にしてしまう方法 -- 問題が解決したわけでは無いので、後からこのポートを使いたいときに同じ問題が再発する。 2つ目を目指すとして、 始め3つ目を目指したのですが、bootargs の設定だけでなく、/etc/inittab も設定しなければ ならないようで、結構面倒くさい。 シリアルポートの設定について で、z-turn 付属の BOOT.bin, uEnv.txt, uImage から立ち上げたコンソールを見直したところ、 LANG:console $ petalinux-config # .bashrc の設定により LANG=C petalinux-config が起動 Debian GNU/Linux 8 debian8-zynq ttyPS0 debian8-zynq login: を見ると、 となっていて、普通に ttyPS0 を使っている?! - Subsystem AUTO Hardware Settings ---> -- Serial Settings ---> --- Primary stdin/stdout = ps7_uart_1 対応する devicetree.dts を見ると、 があって、こちらは正しい。 ... chosen { bootargs = "console=ttyPS0,115200 root=/dev/ram rw earlyprintk maxcpus=1"; linux,stdout-path = "/amba/serial@e0001000"; }; aliases { ethernet0 = "/amba/ethernet@e000b000"; serial0 = "/amba/serial@e0001000"; serial1 = "/amba/serial@e0000000"; spi0 = "/amba/spi@e000d000"; }; ... もう1つは、 ふむ、e0000000 を serial1 に、e0001000 を serial0 に割り当てていて、 これは 2. の方法を使っているみたい。 - Kernel Bootargs = "console=ttyPS0,115200 earlyprintk" 一方で、 LANG:console $ less components/plnx_workspace/device-tree-generation/system.dts ... chosen { bootargs = "console=ttyPS0,115200"; }; aliases { ethernet0 = &gem0; serial0 = &uart1; serial1 = &uart0; spi0 = &qspi; }; ... となっていて、これがまずい。 なので、やはり入れ替えられているようにも見えるのだけれど・・・ - Kernel Bootargs ---> -- generate boot args automatically を off にして、 - Kernel Bootargs ---> -- user set kernel bootargs = "console=ttyPS1,115200 earlyprintk" とした。 [Save] したところ、"z-turn/zturn-v2016.4/project-spec/configs/config" へ保存され、 [Exit] したところ、しばらくいろんな設定ファイルを生成して、終了した。 新しい設定でビルドするため、 LANG:console $ petalinux-build $ less components/plnx_workspace/device-tree-generation/pcw.dtsi ... &uart0 { device_type = "serial"; port-number = <1>; status = "okay"; } ; &uart1 { device_type = "serial"; port-number = <0>; status = "okay"; }; ... $ less components/plnx_workspace/device-tree-generation/pcw.dtsi ... uart0: serial@e0000000 { compatible = "xlnx,xuartps", "cdns,uart-r1p8"; status = "disabled"; clocks = <&clkc 23>, <&clkc 40>; clock-names = "uart_clk", "pclk"; reg = <0xE0000000 0x1000>; interrupts = <0 27 4>; }; uart1: serial@e0001000 { compatible = "xlnx,xuartps", "cdns,uart-r1p8"; status = "disabled"; clocks = <&clkc 24>, <&clkc 41>; clock-names = "uart_clk", "pclk"; reg = <0xE0001000 0x1000>; interrupts = <0 50 4>; }; ... したところ、bootargs を1文字書き換えただけとは思えないほど待たされて、 ようやく終了。 えーと、これ、どう見ればいいのかしら? やはりこのビルドシステムはどうかしてる。 USB_UART が uart1:serial@e0001000 に繋がっているのは間違いなくて、 serial0 = &uart1 で serial0 に接続されているように読める? uEnv.txt を書き換えるならコンパイルすら必要ないし、 system.dts を書き換えたとしても .dtb への変換は1秒もかからないはず。 で、chosen が console=ttyPS0,115200 のままになっているのはどうしてなのか。 こんな変更で10分も待たされるなんて、 依存関係の管理があまりにお粗末としか。。。 git で様子を見ると、~ components/plnx_workspace/device-tree-generation/plnx_arm-system.dts と~ components/plnx_workspace/device-tree-generation/system-conf.dtsi ~ は console=ttyPS1,115200 に書き換わっているのに、~ components/plnx_workspace/device-tree-generation/system.dts ~ は影響を受けていない? しかもこれ、petalinux-configure を起動してしまうと、^C で抜けても強制的に設定ファイルが更新されてしまうため、何も変更していなかったとしても次の petalinux-build で長時間待たされる。どうしてこうなった?どうしてこうなった?としか、ねえ。 system.dts の冒頭のタイムスタンプは変わっているので、 コンパイルし直されていないわけでは無いみたいなのだけれど? BOOT.BIN 作成のため、 (ここでちょっと中断中) LANG:console $ petalinux-package --boot --fsbl ../design_1_wrapper_hw_platform_1/fsbl.elf --fpga images/linux/design_1_wrapper.bit --u-boot --force あー、ところで、components は .gitignore しておくべきなんですね。 BOOT.BIN の生成は一瞬で終わった。(胸をなで下ろす) $ jed project-spec/meta-user/recipes-dt/device-tree/files/system-top.dts $ cat project-spec/meta-user/recipes-dt/device-tree/files/system-top.dts /dts-v1/; /include/ "system-conf.dtsi" / { chosen { bootargs = "console=ttyPS0,115200"; }; }; ** 起動してみる = まだ半ば [#o2032d6e] ** inittab をいじる余地はある? [#id3f8960] 手動で bootargs を入れたときと同様に、ログインメッセージの直前で止まってしまいます。 これ以上、petalinux-config でいじれるところはなさそう。 ** 何が問題か [#id3f8960] (裏で)立ち上がった z-turn 上の linux に ssh で繋いで inittab を見てみると、 LANG:console login as: root root@10.225.225.142's password: (root) $ cat /etc/inittab # /etc/inittab: init(8) configuration. # $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $ # The default runlevel. id:5:initdefault: # Boot-time system configuration/initialization script. # This is run first except when booting in emergency (-b) mode. si::sysinit:/etc/init.d/rcS # What to do in single-user mode. ~~:S:wait:/sbin/sulogin # /etc/init.d executes the S and K scripts upon change # of runlevel. # # Runlevel 0 is halt. # Runlevel 1 is single-user. # Runlevels 2-5 are multi-user. # Runlevel 6 is reboot. l0:0:wait:/etc/init.d/rc 0 l1:1:wait:/etc/init.d/rc 1 l2:2:wait:/etc/init.d/rc 2 l3:3:wait:/etc/init.d/rc 3 l4:4:wait:/etc/init.d/rc 4 l5:5:wait:/etc/init.d/rc 5 l6:6:wait:/etc/init.d/rc 6 # Normally not reached, but fallthrough in case of emergency. z6:6:respawn:/sbin/sulogin PS0:12345:respawn:/bin/start_getty 115200 ttyPS0 # /sbin/getty invocations for the runlevels. # # The "id" field MUST be the same as the last # characters of the device (after "tty"). # # Format: # <id>:<runlevels>:<action>:<process> # 1:12345:respawn:/sbin/getty 38400 tty1 $ runlevel N 5
Counter: 34630 (from 2010/06/03),
today: 2,
yesterday: 0