一、环境安装

1、软硬件需求:Vivado 2019.1、ZCU106、Ubuntu 18.04.1、petalinux 2019.1

本文基于2019.1版本的UG1144文档构建https://docs.xilinx.com/api/khub/documents/HXzkPWw1pfgmyp8i8JKniQ/content?Ft-Calling-App=ft%2Fturnkey-portal&Ft-Calling-App-Version=4.2.21https://docs.xilinx.com/api/khub/documents/HXzkPWw1pfgmyp8i8JKniQ/content?Ft-Calling-App=ft%2Fturnkey-portal&Ft-Calling-App-Version=4.2.21

2、下载Ubuntu 18.04.1

Index of /releases/18.04.1https://old-releases.ubuntu.com/releases/18.04.1/

2、安装VMware 17Pro

建议大家直接给定150G的虚拟机空间,不然后续扩容应麻烦的。

安装虚拟机(VMware)保姆级教程(附安装包)_vmware虚拟机-CSDN博客文章浏览阅读10w+次,点赞388次,收藏2.5k次。帮助小白安装虚拟机,保姆级教程。如果你点击下一步出现了这个页面的话,那就证明你电脑里面已经有vmware了,就可以直接用了,如果你想重新安装,直接删除就好,再重新打开安装程序继续安装。_vmware虚拟机https://blog.csdn.net/weixin_74195551/article/details/127288338

下面是linux扩容操作VMware虚拟机Ubuntu根目录磁盘空间(/dev/sda1)扩容-CSDN博客文章浏览阅读1.4w次,点赞42次,收藏128次。文章目录一、前言二、提前准备三、开始实践四、参考????一、前言最初,给 Ubuntu 虚拟机只分配了20G的存储空间,用来学习做作业等;但最近安装了 ROS(机器人操作系统)后,然后就提醒说"系统根目录空间不足",没办法了,只好给根目录的磁盘空间扩容了????????扩容中遇到的问题:一般 Ubuntu 的 /dev/sda1 分区是挂在 根目录("/") 上的,因此无法用常规的 LVM(逻辑卷管理)模式进行扩容。(在用 lvextend 命令用于动态扩展逻辑卷的空间,即会报 “/dev/sda1https://blog.csdn.net/xwmrqqq/article/details/109828166#:~:text=%E8%BE%93%E5%85%A5%20partprobe%20%2Fdev%2Fsda%20%EF%BC%8C%E9%80%9A%E7%9F%A5%E7%B3%BB%E7%BB%9F%E5%86%85%E6%A0%B8%E5%88%86%E5%8C%BA%E8%A1%A8%E7%9A%84%E5%8F%98%E5%8C%96%20%E8%BE%93%E5%85%A5%20resize2fs%20%2Fdev%2Fsda1,%EF%BC%8C%E5%AF%B9%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F%E8%BF%9B%E8%A1%8C%E6%89%A9%E5%AE%B9%20%E5%86%8D%E6%AC%A1%E8%BE%93%E5%85%A5%20df%20-TH%20%EF%BC%8C%E6%9F%A5%E7%9C%8B%20%2Fdev%2Fsda1%20%E6%98%AF%E5%90%A6%E6%89%A9%E5%AE%B9%E6%88%90%E5%8A%9F

3、添加服务:

①桌面右键打开终端,输入:sudo apt install apt-transport-https

②输入:sudo apt install ca-certificates

4、将Ubuntu的源更换为清华镜像源

①桌面右键打开终端,输入:sudo vi /etc/apt/sources.list

②按下键盘insert键,在源文件中每行前都加上“#”(已经有的不需要),在文件最后加上,

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse

# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse

# deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用

# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

③按下esc,输入“:wq!”即可保存退出。

④输入:apt-get update

如果出现问题:Ubuntu 无法打开锁文件 /var/lib/dpkg/lock - open。则输入下面的代码解锁。

sudo rm /var/cache/apt/archives/lock

sudo rm /var/lib/dpkg/lock

5、安装依赖

sudo apt-get install -y 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 zlib1g-dev gcc-multilib build-essential libsdl1.2-dev libglib2.0-dev zlib1g:i386 screen pax gzip gawk

sudo apt-get install xterm

sudo apt-get install python

sudo apt-get install tftpd tftp openbsd-inetd

安装完毕后,输入:

su

chmod 600 /etc/inetd.conf

vim /etc/inetd.conf

#在文件中增加以下内容 tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftproot #保存并退出

接着输入:

mkdir /tftproot chmod 777 /tftproot /etc/init.d/openbsd-inetd restart netstat -an | more | grep udp

#若看到有如下输出,即表示tftp安装成功 #udp 0 0 0.0.0.0:69 0.0.0.0:*

最后输入exit,退出

6、下载petalinux 2019.1、linux 4.19、u-boot 2019.1、sstate高速缓存,下面是下载链接

①petalinux 2019.1、sstate高速缓存

下载Vivado, Vitis, Vitis Embedded Platform, PetaLinux, Device modelshttps://china.xilinx.com/support/download/index.html/content/xilinx/zh/downloadNav/embedded-design-tools/archive.html

②、linux 4.19

GitHub - Xilinx/linux-xlnx at xlnx_rebase_v4.19_2019.1The official Linux kernel from Xilinx. Contribute to Xilinx/linux-xlnx development by creating an account on GitHub.https://github.com/Xilinx/linux-xlnx/tree/xlnx_rebase_v4.19_2019.1

下载完后,不要手贱,一定要传输到Ubuntu再解压,因为Ubuntu对大小写敏感,里面好多文件以大小写区分命名,Windows下会被覆盖!

③、u-boot 2019.1

https://github.com/Xilinx/u-boot-xlnx/tree/xilinx-v2019.1https://github.com/Xilinx/u-boot-xlnx/tree/xilinx-v2019.1

7、安装ssh服务,安装winscp软件,将下载的东西移动到ubuntu的download/petalinux目录下

sudo apt-get install openssh-server

WinSCP :: Official Site :: Free SFTP and FTP client for WindowsWinSCP is a free file manager for Windows supporting FTP, SFTP, S3 and WebDAV.https://winscp.net/eng/index.php8、运行下述命令,尽量自己敲,复制时注意空格,如果是中文空格很可能出现“xxxx: missing operand after ‘xxxx /opt/pkg/petalinux/’”错误。是你安装ubuntu时设置的用户名

sudo -s

chgrp /opt/pkg/petalinux

chown /opt/pkg/petalinux

exit

9、修改petalinux-v2019.1-final-installer.run 运行权限

chmod +x petalinux-v2019.1-final-installer.run

10、运行安装petalinux2019.1

./petalinux-v2019.1-final-installer.run /opt/pkg/petalinux/

11、输入q退出协议内容->输y同意协议内容...反复操作一直到最后安装成功

12、修改 bash,许多教程设置了开机自动加入环境变量。但是这样其他工具编译时可能会遇到问题,因此我还是建议,每次打开终端,都修改一下比较好。出现提示框,选择NO

sudo dpkg-reconfigure dash

source /opt/pkg/petalinux/settings.sh

13、如果遇到网络问题,输入ifconfig,如果显示只能链接127.0.0.1,则输入以下命令

sudo service network-manager stop

sudo rm /var/lib/NetworkManager/NetworkManager.state

sudo service network-manager start

14、终端输出以下内容,则代表petalinux 2019.1安装完毕

15、将make 4.1替换为make 3.81

Index of /gnu/makehttps://ftp.gnu.org/gnu/make/

解压后,依次输入命令:

make -v

./configure

make

sudo make install

reboot

重启ubuntu后,输入make -v查看版本。

二、创建petalinx 第一个应用

1、在 ~/Downloads目录下新建petalinux文件夹将之前下载的4个东西,全部复制进去

2、在 ~/Downloads目录下新建ZCU106文件夹,我是zcu106,所以采用zynqMP模板

输入命令:

mkdir -p ./zcu106/proj1v-1

cd ./zcu106/proj1v-1

mkdir ./hardware

在vivado 2019.1 中生成bit,然后导出hdf文件(2019.2版本之后位xsa文件),在 sdk路径中。将其移动到新建的hardware文件夹下。

输入下面的命令后即可创建以petalinux为名称的zynqMP项目。 

sudo dpkg-reconfigure dash

source /opt/pkg/petalinux/settings.sh

petalinux-create -t project -n petalinux --template zynqMP

3、配置硬件工程

① 将“/home/yangzheng/Downloads/petalinux”路径中的 uboot 2019.1和linux 4.19复制到“/home/yangzheng/Downloads/zcu106/proj1v-1/petalinux”文件夹下。

②将PL侧信息导入配置命令

petalinux-config --get-hw-description ../hardware/

③打开配置界面后,配置linux

将下面这两个都设置为 “ext-local-src”

如果按照我上文路径设置的话,那么uboot和 linux的路径设置为:

/home/yangzheng/Downloads/zcu106/proj1v-1/petalinux/u-boot-xlnx-xilinx-v2019.1

/home/yangzheng/Downloads/zcu106/proj1v-1/petalinux/linux-xlnx-xlnx_rebase_v4.19

 Save后exit

④任然时这个界面,配置Yocto

按下N键,取消网络下载

 配置pre-mirror(一定要加上file://),配置sstate feeds(我是zcu106,所以选择aarch64,zynq选择arm文件夹)

file:///home/yangzheng/Downloads/petalinux/sstate-rel-v2019.1/sstate-rel-v2019.1/downloads

/home/yangzheng/Downloads/petalinux/sstate-rel-v2019.1/sstate-rel-v2019.1/aarch64

⑤再次配置将PL侧信息导入,直接退出即可

petalinux-config --get-hw-description ../hardware/

 ⑥编译,不清楚我的gcc文件夹一直没有权限,所以需要加入

sudo chmod -R 777 linux-xlnx-xlnx_rebase_v4.19_2019.1/

sudo chmod -R 777 linux-xlnx-xlnx_rebase_v4.19_2019.1/scripts/

petalinux-build

出现以下结果则表示编译成功 

注意:出现platform-auto.h and platform-top.h are not getting added in include/configs directory问题,重新配置hdf文件即可,因为这两个头文件是加入hdf文件自动生成的。直接:petalinux-config --get-hw-description ../hardware/

这样,我们在/home/yangzheng/Downloads/zcu106/proj1v-1/petalinux/images/linux 文件夹下可以看到image.ub文件,还缺少一个BOOT.bin文件 

进入/images/linux文件夹输入打包命令:

petalinux-package --boot --u-boot --fpga --force

打包成功可以看到BOOT.bin 

4、将打包后的BOOT.bin与image.ub移动到SD卡中(2019.2版本后还好像还有一个boot.scr文件)

5、上板子实验视频

linux在zcu106运行

----------------------------------------------------------23/11/23 更新--------------------------------------------------

petalinux-config的时候一定要加上这个设置,加上就能联网了。

此外,我们的Vivado工程什么都没有设置,就只有一个IP核 

精彩链接

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。