«

Ubuntu 22.04.3 LTS 下 petalinux 2023.1 环境设置 以及QSPI刷写出错问题解决

学长 发布于 阅读:2651 ZYNQ 7020


下载ubuntu:https://ubuntu.com/download/desktop

下载petalinux:https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools.html


先安装ubuntu

改root密码

sudo passwd root

但是怎么改回默认的随机密码我就不知道了。。。网上也没人纠结这个

下面就不写sudo了自己su去

然后发现共享文件会出现

无法更新运行时文件夹共享状态:在客户机操作系统内装载共享文件夹文件系统时出错

网上会告诉你重装下VMware Tools,实际上根本不是这个问题

根据官网的说法:

https://kb.vmware.com/s/article/1022525?lang=zh_CN

对于 Ubuntu 14.x 及更高版本,我们建议使用 Open-VM-Tools。

所以说得安装Open VM Tools

直接通过

sudo apt-get install open-vm-tools

剪切板之类还得系统重启下


https://xilinx.eetrend.com/blog/2021/100554442.html

这个文档的只需要


sudo apt-get install tofrodos iproute2 gawk xvfb gcc git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget diffstat chrpath socat xterm autoconf libtool tar unzip texinfo gcc-multilib build-essential libsdl1.2-dev libglib2.0-dev libssl-dev screen pax gzip



当中的这一句话,毕竟自己手打起来挺累的


准备安装的时候会发现还是会提醒tftp sevice没启动


https://developer.aliyun.com/article/444957

前面的部分跳过因为只装tftpd根本不能在很早的版本启动这个服务,现在最新的22.0.4.3就更不用说了


sudo apt-get install tftp-hpa tftpd-hpa xinetd

sudo service tftpd-hpa restart


其实xinetd一般不会没有的,无所谓多确认下挺好的



开始安装

./petalinux-v2023.1-05012318-installer.run -d /opt/petalinux/2023.1/


如果没目录自己mkdir下,petalinux 2023 的版本是不支持root 安装的

然后系统会出现以下的信息说明一起正常

INFO: Checking installation environment requirements...
WARNING: This is not a supported OS
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
INFO: Checking installer checksum...
INFO: Extracting PetaLinux installer...


改ubuntu的shell 从dash 改成bash

查看是否是dash

ll /bin/sh

如果不是bash

sudo dpkg-reconfigure dash

选择No

然后

source /opt/petalinux/2023.1/settings.sh

如果你安装的位置跟我不一样自行找到你的安装目录

然后可以在

gedit ~/.bashrc

你要喜欢vi也行,反正在最后一行加上

source /opt/petalinux/2023.1/settings.sh

就不用每次启动再source一边了


vivado 2019.2以后导出的硬件是.xsa不是.hdf只要petalinux是2019.2以后就可以顺利通过.xsa创建项目


执行


petalinux-create -t project --template zynq -n qspi_boot_petalinux

cd到项目文件夹里面,然后复制vivado导出的.xsa文件

petalinux-config --get-hw-description=./design_1_wrapper.xsa 


出现报错


[INFO] Sourcing buildtools

[INFO] Getting hardware description...

INFO: Renaming design_1_wrapper.xsa to system.xsa

[INFO] Generating Kconfig for project

Traceback (most recent call last):

  File "/home/fpga/Desktop/qspi_boot_petalinux/components/yocto/layers/meta-xilinx/meta-xilinx-core/gen-machine-conf/gen-machineconf", line 439, in <module>

    ret = main()

  File "/home/fpga/Desktop/qspi_boot_petalinux/components/yocto/layers/meta-xilinx/meta-xilinx-core/gen-machine-conf/gen-machineconf", line 422, in main

    get_hw_description(args, hw_flow)

  File "/home/fpga/Desktop/qspi_boot_petalinux/components/yocto/layers/meta-xilinx/meta-xilinx-core/gen-machine-conf/gen_config.py", line 577, in get_hw_description

    run_cmd(cmd, output, args.logfile, shell=True)

  File "/home/fpga/Desktop/qspi_boot_petalinux/components/yocto/layers/meta-xilinx/meta-xilinx-core/gen-machine-conf/gen_config.py", line 475, in run_cmd

    raise Exception(stderr.decode("utf-8"))

Exception: package require xsdb FAILED:

error loading hsi package: couldn't load file "libxv_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory

    while executing

"error "error loading hsi package: $msg""

    invoked from within

"if { [catch {

    package require hsi

    package require hsi::utils

    namespace eval hsi {namespace import ::common::*}

    namespace eval hsi {nam..."

    (file "/opt/petalinux/2023.1/tools/xsct/scripts/xsct/xsdb/xsdb.tcl" line 11968)

    invoked from within

"source /opt/petalinux/2023.1/tools/xsct/scripts/xsct/xsdb/xsdb.tcl"

    ("package ifneeded xsdb 0.1" script)

ERROR: Failed to run gen-machineconf

ERROR: Failed to generate plnxconf setup for project


在官网发现解决办法: https://support.xilinx.com/s/question/0D54U0000738dR0SAI/petalinux-20231-importing-a-hardware-configuration-exception-package-require-xsdb-failed?language=en_US

安装下面的包


sudo apt install libtinfo5

重新

petalinux-config --get-hw-description=./design_1_wrapper.xsa 

修改好后save

petalinux-build

要等待的时间比较久

一般petalinux 项目做完后只需要里面的image文件夹,其他都可以删除了,2023.1版本的项目petalinux-build完基本半个小时这样整个项目14.4G

旧版本中subsystem/linux/configs/device-tree/system-conf.dtsi目测是变成project-spec/configs/flash_parts.txt

以前默认的kernel起始位置也从0x520000也变成0x500000


刷写出错。。。

ERROR: attempting erase past flash size (0x1000000)

目前image.ub包超大。。。128 M bit 相当于 16Mbyte 结果 image.ub就17MB了正在找原因中

/home/fpga/Desktop/qspi_boot_petalinux/project-spec/configs/config

文件中

CONFIG_SUBSYSTEM_NETBOOT_OFFSET=0x10000000

128*1024*1024=0x8000000

可以在文件中直接改目前结果超大。。。

或者在petalinux界面改JTAG/DDR image offsets

保存后CONFIG_SUBSYSTEM_NETBOOT_OFFSET就变成CONFIG_SUBSYSTEM_UBOOT_FIT_IMAGE_OFFSET

没有找到直接在petalinux-config 界面中修改的办法。。。神奇的2023.1版

有说128Mb应该用0x4000000

petalinux-config -c u-boot

修改也不起作用。。。莫非我得整个项目重建???


根据官方文档去设置容量限制

petalinux-config -c rootfs

选择 File System Packages

去掉不用的就小了。。。运行和退出需要等指令运行完成需要一点时间

petalinux-config -c kernel

选择 General Setup

然后你会发现基本上2021版本以后不太可能到16MB以下。。。尼玛。。。

直接用X_demo里的BOOT.bin了


vivado 2023.1

petalinux 2023.1

Ubuntu 22.04.3 LTS 标准未选择 third party software 的安装

参考项目 :

MicroZus开发平台参考教程 - 基于ZYNQ 7020的 FPGA + ARM开发》,23 Zynq Linux开发 - 从QSPI-Flash启动PetaLinux


扫描二维码,在手机上阅读