1.使用petalinux-config配置,输入:
petalinux-config --get-hw-description …/slht_zynq_7020/
slht@ubuntu:~/vivado_hw/SLHT-ZYNQ$ petalinux-config --get-hw-description ../slht_zynq_7020/
INFO: Sourcing build tools
INFO: Getting hardware description...
INFO: Rename system_wrapper.xsa to system.xsa
[INFO] Generating Kconfig for project
[INFO] Menuconfig project
configuration written to /home/slht/vivado_hw/SLHT-ZYNQ/project-spec/configs/config
*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.
[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
2.使用petalinux-build编译工程出现如下问题:
slht@ubuntu:~/vivado_hw/SLHT-ZYNQ$ 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: 100% |#####################################################################################################################################################################| Time: 0:00:33
Parsing of 2995 .bb files complete (0 cached, 2995 parsed). 4265 targets, 204 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Fetching uninative binary shim from file:///home/slht/vivado_hw/SLHT-ZYNQ/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.
WARNING: Unable to get checksum for linux-xlnx SRC_URI entry oe-logs: [Errno 2] No such file or directory: '/home/slht/vivado_hw/linux-xlnx/oe-logs' | ETA: 0:00:00
WARNING: Unable to get checksum for linux-xlnx SRC_URI entry oe-workdir: [Errno 2] No such file or directory: '/home/slht/vivado_hw/linux-xlnx/oe-workdir'
WARNING: Unable to get checksum for u-boot-xlnx SRC_URI entry oe-logs: [Errno 2] No such file or directory: '/home/slht/vivado_hw/u-boot-xlnx/oe-logs'
WARNING: Unable to get checksum for u-boot-xlnx SRC_URI entry oe-workdir: [Errno 2] No such file or directory: '/home/slht/vivado_hw/u-boot-xlnx/oe-workdir'
Initialising tasks: 100% |##################################################################################################################################################################| Time: 0:00:05
Checking sstate mirror object availability: 100% |##########################################################################################################################################| Time: 0:00:00
Sstate summary: Wanted 961 Found 0 Missed 961 Current 0 (0% match, 0% complete)
NOTE: Executing Tasks
NOTE: Setscene tasks completed
ERROR: quilt-native-0.66-r0 do_fetch: Network access disabled through BB_NO_NETWORK (or set indirectly due to use of BB_FETCH_PREMIRRORONLY) but access requested with command /usr/bin/env wget -t 2 -T 30 --passive-ftp --no-check-certificate -P /home/slht/vivado_hw/SLHT-ZYNQ/build/downloads 'http://petalinux.xilinx.com/sswreleases/rel-v2020/downloads/quilt-0.66.tar.gz' (for url http://petalinux.xilinx.com/sswreleases/rel-v2020/downloads/quilt-0.66.tar.gz)
ERROR: Logfile of failure stored in: /home/slht/vivado_hw/SLHT-ZYNQ/build/tmp/work/x86_64-linux/quilt-native/0.66-r0/temp/log.do_fetch.2988387
ERROR: Task (/home/slht/vivado_hw/SLHT-ZYNQ/components/yocto/layers/core/meta/recipes-devtools/quilt/quilt-native_0.66.bb:do_fetch) failed with exit code '1'
ERROR: gnu-config-native-20190501+gitAUTOINC+b98424c249-r0 do_fetch: Network access disabled through BB_NO_NETWORK (or set indirectly due to use of BB_FETCH_PREMIRRORONLY) but access requested with command /usr/bin/env wget -t 2 -T 30 --passive-ftp --no-check-certificate -P /home/slht/vivado_hw/SLHT-ZYNQ/build/downloads 'http://petalinux.xilinx.com/sswreleases/rel-v2020/downloads/git2_git.savannah.gnu.org.config.git.tar.gz' (for url http://petalinux.xilinx.com/sswreleases/rel-v2020/downloads/git2_git.savannah.gnu.org.config.git.tar.gz)
ERROR: Logfile of failure stored in: /home/slht/vivado_hw/SLHT-ZYNQ/build/tmp/work/x86_64-linux/gnu-config-native/20190501+gitAUTOINC+b98424c249-r0/temp/log.do_fetch.2988402
ERROR: Task (virtual:native:/home/slht/vivado_hw/SLHT-ZYNQ/components/yocto/layers/core/meta/recipes-devtools/gnu-config/gnu-config_git.bb:do_fetch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 31 tasks of which 0 didn't need to be rerun and 2 failed.
Summary: 2 tasks failed:
/home/slht/vivado_hw/SLHT-ZYNQ/components/yocto/layers/core/meta/recipes-devtools/quilt/quilt-native_0.66.bb:do_fetch
virtual:native:/home/slht/vivado_hw/SLHT-ZYNQ/components/yocto/layers/core/meta/recipes-devtools/gnu-config/gnu-config_git.bb:do_fetch
Summary: There were 6 WARNING messages shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
ERROR: Failed to build project
3.修改文件petalinuxbsp.conf,内容如下:
slht@ubuntu:~/vivado_hw/SLHT-ZYNQ$ vim project-spec/meta-user/conf/petalinuxbsp.conf
#User Configuration
#OE_TERMINAL = "tmux"
PREMIRRORS_prepend = " \
git://.*/.* file:///mnt/hgfs/Share/downloads/ \n \
gitsm://.*/.* file:///mnt/hgfs/Share/downloads/ \n \
ftp://.*/.* file:///mnt/hgfs/Share/downloads/ \n \
http://.*/.* file:///mnt/hgfs/Share/downloads/ \n \
https://.*/.* file:///mnt/hgfs/Share/downloads/ \n"
4.重新编译
slht@ubuntu:~/vivado_hw/SLHT-ZYNQ$ 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 1588 entries from dependency cache.
Parsing recipes: 100% |#####################################################################################################################################################################| Time: 0:00:15
Parsing of 2995 .bb files complete (1122 cached, 1873 parsed). 4265 targets, 204 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
NOTE: Fetching uninative binary shim from file:///home/slht/vivado_hw/SLHT-ZYNQ/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.
WARNING: Unable to get checksum for linux-xlnx SRC_URI entry oe-logs: [Errno 2] No such file or directory: '/home/slht/vivado_hw/linux-xlnx/oe-logs' | ETA: 0:00:00
WARNING: Unable to get checksum for linux-xlnx SRC_URI entry oe-workdir: [Errno 2] No such file or directory: '/home/slht/vivado_hw/linux-xlnx/oe-workdir'
WARNING: Unable to get checksum for u-boot-xlnx SRC_URI entry oe-logs: [Errno 2] No such file or directory: '/home/slht/vivado_hw/u-boot-xlnx/oe-logs'
WARNING: Unable to get checksum for u-boot-xlnx SRC_URI entry oe-workdir: [Errno 2] No such file or directory: '/home/slht/vivado_hw/u-boot-xlnx/oe-workdir'
Initialising tasks: 100% |##################################################################################################################################################################| Time: 0:00:03
Checking sstate mirror object availability: 100% |##########################################################################################################################################| Time: 0:00:00
Sstate summary: Wanted 958 Found 0 Missed 958 Current 3 (0% match, 0% complete)
NOTE: Executing Tasks
NOTE: Setscene tasks completed
NOTE: linux-xlnx: compiling from external source tree /home/slht/vivado_hw/linux-xlnx
NOTE: u-boot-xlnx: compiling from external source tree /home/slht/vivado_hw/u-boot-xlnx
NOTE: Tasks Summary: Attempted 3507 tasks of which 30 didn't need to be rerun and all succeeded.
Summary: There were 6 WARNING messages shown.
INFO: Failed to copy built images to tftp dir: /tftpboot
[INFO] Successfully built project
5.固件打包
slht@ubuntu:~/vivado_hw/SLHT-ZYNQ$ petalinux-package --boot --fsbl --fpga --u-boot --force
INFO: Sourcing build tools
INFO: File in BOOT BIN: "/home/slht/vivado_hw/SLHT-ZYNQ/images/linux/zynq_fsbl.elf"
INFO: File in BOOT BIN: "/home/slht/vivado_hw/SLHT-ZYNQ/project-spec/hw-description/system_wrapper.bit"
INFO: File in BOOT BIN: "/home/slht/vivado_hw/SLHT-ZYNQ/images/linux/u-boot.elf"
INFO: File in BOOT BIN: "/home/slht/vivado_hw/SLHT-ZYNQ/images/linux/system.dtb"
INFO: Generating Zynq 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!!!
6.生成了如下固件文件
slht@ubuntu:~/vivado_hw/SLHT-ZYNQ$ ls images/linux/
BOOT.BIN image.ub rootfs.cpio rootfs.cpio.gz.u-boot rootfs.manifest system.bit u-boot.bin uImage zImage
boot.scr pxelinux.cfg rootfs.cpio.gz rootfs.jffs2 rootfs.tar.gz system.dtb u-boot.elf vmlinux zynq_fsbl.elf
7.放进sd卡的boot分区就可以运行啦