PetaLinuxでプロジェクト作成します。
PetaLinuxのビルドは次の順番で行っていきます。
| 番号 | 項目 | コマンド | |-----|-----| | 1 | ハードウェアプラットフォームの作成(カスタムハードウェアのみ) | | | 2 | PetaLinuxプロジェクトの作成 | petalinux-create -t project| | 3 | PetaLinuxプロジェクトの初期化(カスタムハードウェアのみ) | | | 4 | システムレベルオプションの設定 | petalinux-config --get-hw-description| | 5 | ユーザーコンポーネントの作成 | petalinux-create -t COMPONENT| | 6 | Linuxカーネルの設定 | petalinux-config -c kernel| | 7 | ルートファイルシステムの設定 | petalinux-config -c rootfs| | 8 | システムのビルド | petalinux-build| | 9 | システム運用のためのパッケージ化 | petalinux-package| | 10 | テスト用にシステムをブート | petalinux-boot|
本試行ではZCU104のBSPを使用してZCU104向けのPetaLinux環境を生成します。
XilinxのダウンロードのページからZCU104をダウンロードします。
ダウンロードしたBSPでプロジェクトを作成します。
$ petalinux-create -t project -s ./xilinx-zcu104-v2020.2-final.bsp
INFO: Create project:
INFO: Projects:
INFO: * xilinx-zcu104-2020.2
INFO: Has been successfully installed to /disk/yocto/petalinux_temp/
INFO: New project successfully created in /disk/yocto/petalinux_temp/
プロジェクトが作成されると次のディレクトリ内容になります。
$ ls xilinx-zcu104-2020.2/
README components hardware project-spec
README.hw config.project pre-built
カスタムプロジェクト、例えば、Ultra96向けプロジェクを作成する場合は次のように進めます。
ここからはカスタムプロジェクトでの試行です。
空のプロジェクトを作成する場合、次のように実行します。
$ petalinux-create --type project --template zynqMP --name ultra96v2
INFO: Create project: ultra96v2
INFO: New project successfully created in /disk/yocto/petalinux_temp/ultra96v2
次のようにディレクトリにファイルが生成されます。
$ ls ultra96v2/
config.project project-spec
Vivadoで作成したXASファイルを指定してプロジェクト路作成します。
$ cd ultra96v2
$ petalinux-config --get-hw-description /disk/ultra96v2_vivado/ultra96v2.xsa
INFO: Sourcing build tools
INFO: Getting hardware description...
INFO: Rename ultra96v2.xsa to system.xsa
[INFO] Generating Kconfig for project
[INFO] Menuconfig project
configuration written to /disk/yocto/petalinux_temp/ultra96v2/project-spec/configs/config
途中でLinux Kernelのコンフィグレーションが開くのでひとまず、’Exit’で抜けます。
続きは次のように進みます。
[INFO] Extracting yocto SDK to components/yocto
[INFO] Sourcing build environment
[INFO] Generating kconfig for Rootfs
[INFO] Silentconfig rootfs
[INFO] Generating plnxtool conf
[INFO] Adding user layers
[INFO] Generating workspace directory
プロジェクトが作成されるとディレクトリの内容は次のようになります。
$ ls
build components config.project project-spec
PetaLinuxをビルドします。
$ petalinux-build
INFO: Sourcing build tools
[INFO] Building project
[INFO] Sourcing build environment
[INFO] Generating workspace directory
INFO: bitbake petalinux-image-minimal
WARNING: Host distribution "ubuntu-20.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Parsing recipes: 46% |################### | ETA: 0:00:19
ここからPetaLinuxのビルドが始まります。 ビルドは時間がかかるのでゆっくりと待ちましょう。
途中でACLでエラーが発生しました。
ERROR: Task (/disk/yocto/petalinux_temp/ultra96v2/components/yocto/layers/core/meta/recipes-support/attr/acl_2.2.52.bb:do_install) failed with exit code '1'
ログを見ると、WARNINGでexit 1しているのでエラーをなったみたいだ。
WARNING: /disk/yocto/petalinux_temp/ultra96v2/build/tmp/work/aarch64-xilinx-linux/acl/2.2.52-r0/temp/run.do_install.3243479:1 exit 1 from 'exit 1'
どうも、問題なくdo_installできてそうなのでもう一度、ビルドを実行する。
$ petalinux-build
INFO: Sourcing build tools
[INFO] Building project
[INFO] Sourcing build environment
[INFO] Generating workspace directory
INFO: bitbake petalinux-image-minimal
WARNING: Host distribution "ubuntu-20.04" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Loading cache: 100% |############################################| Time: 0:00:00
Loaded 4264 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:00:03
Parsing of 2995 .bb files complete (2994 cached, 1 parsed). 4265 targets, 173 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Fetching uninative binary shim from file:///disk/yocto/petalinux_temp/ultra96v2/components/yocto/downloads/uninative/9498d8bba047499999a7310ac2576d0796461184965351a56f6d32c888a1f216/x86_64-nativesdk-libc.tar.xz;sha256sum=9498d8bba047499999a7310ac2576d0796461184965351a56f6d32c888a1f216
WARNING: Your host glibc verson (2.31) is newer than that in uninative (2.30). Disabling uninative so that sstate is not corrupted.
Initialising tasks: 100% |#######################################| Time: 0:00:01
Checking sstate mirror object availability: 100% |###############| Time: 0:00:07
Sstate summary: Wanted 144 Found 57 Missed 87 Current 872 (39% match, 91% complete)
NOTE: Executing Tasks
NOTE: Setscene tasks completed
NOTE: Tasks Summary: Attempted 3614 tasks of which 3087 didn't need to be rerun and all succeeded.
Summary: There were 2 WARNING messages shown.
INFO: Failed to copy built images to tftp dir: /tftpboot
[INFO] Successfully built project
ビルドが完了しました。
ビルドが完了するとディレクトリの内容が次のようになります。
$ ls
build components config.project images project-spec
ビルドの生成物を確認してみよう。
$ ls build/tmp/deploy/images/zynqmp-generic/
Image
Image--5.4+git0+62ea514294-r0-zynqmp-generic-20210102031707.bin
Image-zynqmp-generic.bin
Xilinx-zynqmp-generic.xsa
arm-trusted-firmware--2.0-xilinx-v2020.2+gitAUTOINC+e6eea88b14-r0-20210102025149.bin
arm-trusted-firmware--2.0-xilinx-v2020.2+gitAUTOINC+e6eea88b14-r0-20210102025149.elf
arm-trusted-firmware--2.0-xilinx-v2020.2+gitAUTOINC+e6eea88b14-r0-20210102025149.ub
arm-trusted-firmware.bin
arm-trusted-firmware.elf
arm-trusted-firmware.ub
atf-uboot.ub
boot.scr
fitImage
fitImage--5.4+git0+62ea514294-r0-zynqmp-generic-20210102031707.bin
fitImage-its--5.4+git0+62ea514294-r0-zynqmp-generic-20210102031707.its
fitImage-its-petalinux-image-minimal-zynqmp-generic--5.4+git0+62ea514294-r0-zynqmp-generic-20210102031707.its
fitImage-its-petalinux-image-minimal-zynqmp-generic-zynqmp-generic
fitImage-its-zynqmp-generic
fitImage-linux.bin--5.4+git0+62ea514294-r0-zynqmp-generic-20210102031707.bin
fitImage-linux.bin-zynqmp-generic
fitImage-petalinux-image-minimal-zynqmp-generic--5.4+git0+62ea514294-r0-zynqmp-generic-20210102031707.bin
fitImage-petalinux-image-minimal-zynqmp-generic-zynqmp-generic
fitImage-zynqmp-generic.bin
fsbl-2020.2+gitAUTOINC+08b9f4304d-r0-zynqmp-generic-20210102031707.elf
fsbl-zynqmp-generic.elf
modules--5.4+git0+62ea514294-r0-zynqmp-generic-20210102031707.tgz
modules-zynqmp-generic.tgz
petalinux-image-minimal-zynqmp-generic-20210102031707.qemuboot.conf
petalinux-image-minimal-zynqmp-generic-20210102031707.rootfs.cpio
petalinux-image-minimal-zynqmp-generic-20210102031707.rootfs.cpio.gz
petalinux-image-minimal-zynqmp-generic-20210102031707.rootfs.cpio.gz.u-boot
petalinux-image-minimal-zynqmp-generic-20210102031707.rootfs.jffs2
petalinux-image-minimal-zynqmp-generic-20210102031707.rootfs.manifest
petalinux-image-minimal-zynqmp-generic-20210102031707.rootfs.tar.gz
petalinux-image-minimal-zynqmp-generic-20210102031707.testdata.json
petalinux-image-minimal-zynqmp-generic.cpio
petalinux-image-minimal-zynqmp-generic.cpio.gz
petalinux-image-minimal-zynqmp-generic.cpio.gz.u-boot
petalinux-image-minimal-zynqmp-generic.jffs2
petalinux-image-minimal-zynqmp-generic.manifest
petalinux-image-minimal-zynqmp-generic.qemuboot.conf
petalinux-image-minimal-zynqmp-generic.tar.gz
petalinux-image-minimal-zynqmp-generic.testdata.json
pmu-firmware-2020.2+gitAUTOINC+08b9f4304d-r0-zynqmp-generic-20210102031707.elf
pmu-firmware-zynqmp-generic.elf
pmu-zynqmp-generic.elf
pxeboot
pxelinux.cfg
qemu-hw-devicetrees
system-top.dtb
system.dtb
u-boot-xlnx-AUTOINC+bb4660c33a.elf
u-boot-zynq-scr--1.0-r0-20210102025149.scr
u-boot-zynqmp-generic-v2020.01-xilinx-v2020.2+gitAUTOINC+bb4660c33a-r0.bin
u-boot-zynqmp-generic.bin
u-boot-zynqmp-generic.elf
u-boot.bin
u-boot.elf
uEnv.txt
vmlinux
vmlinux--5.4+git0+62ea514294-r0-zynqmp-generic-20210102031707.bin
vmlinux-zynqmp-generic.bin
zynqmp-generic-system-20210102025149.dtb
zynqmp-generic-system.dtb
zynqmp-zcu102-rev1.0--5.4+git0+62ea514294-r0-zynqmp-generic-20210102031707.dtb
zynqmp-zcu102-rev1.0-zynqmp-generic.dtb
zynqmp-zcu102-rev1.0.dtb
ブートイメーを作成します。
$ petalinux-package --boot --u-boot --format BIN
INFO: Sourcing build tools
INFO: File in BOOT BIN: "/disk/yocto/petalinux_temp/ultra96v2/images/linux/zynqmp_fsbl.elf"
INFO: File in BOOT BIN: "/disk/yocto/petalinux_temp/ultra96v2/images/linux/pmufw.elf"
INFO: File in BOOT BIN: "/disk/yocto/petalinux_temp/ultra96v2/images/linux/bl31.elf"
INFO: File in BOOT BIN: "/disk/yocto/petalinux_temp/ultra96v2/images/linux/system.dtb"
INFO: File in BOOT BIN: "/disk/yocto/petalinux_temp/ultra96v2/images/linux/u-boot.elf"
INFO: Generating zynqmp binary package BOOT.BIN...
****** Xilinx Bootgen v2020.2
**** Build date : Nov 15 2020-06:11:24
** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
[INFO] : Bootimage generated successfully
INFO: Binary is ready.
WARNING: Unable to access the TFTPBOOT folder /tftpboot!!!
WARNING: Skip file copy to TFTPBOOT folder!!!
ログからわかるようにimages/linuxにPetaLinuxの生成物が格納されています。
$ ls images/linux/
BOOT.BIN pmufw.elf rootfs.manifest zynqmp-qemu-arm.dtb
Image pxelinux.cfg rootfs.tar.gz zynqmp-qemu-multiarch-arm.dtb
bl31.bin rootfs.cpio system.dtb zynqmp-qemu-multiarch-pmu.dtb
bl31.elf rootfs.cpio.gz u-boot.bin zynqmp_fsbl.elf
boot.scr rootfs.cpio.gz.u-boot u-boot.elf
image.ub rootfs.jffs2 vmlinux
これらをSDカードに格納して、ZCU104を起動します。