安装petalinux下载petalinux https://www.xilinx.com/support/download
下载zcu102 ZCU102 BSP
安装petaLinux
把shell设置成bash(这一步看不懂的话可以忽略,因为有些人喜欢把shell设置为dash),具体设置方法是$ sudo dpkg-reconfigure dash
安装一些库(参考ug1144文档,下面为shell command)
apt install build-essential vim tofrodos
apt install iproute2 gawk gcc git make net-tools zlib1g-dev
apt install libssl-dev flex bison libselinux1 libncurses5-dev
apt install lib32stdc++6 xvfb chrpath socat autoconf libtool
apt install texinfo gcc-multilib libsdl1.2-dev libglib2.0-dev zlib1g:i386
cd到petalinux-v2018.3-final-installer.run所在目录,或者下面命令在其前面加上其所在目录。shell行输入:
./petalinux-v2018.3-final-installer.run ./petalinux
等待,安装到一半的时候,提醒查看许可,按回车查看,按q退出,退出后输入y,回车,如此重复三次,才开始正式安装(这个步骤要很小心,如果没有输入y,就回车,就要重新了)
运行petalinux shell行输入:source /home/li/petalinux/settings.sh
(petalinux安装目录)
搭建petalinux工程
方法(一):利用zcu102BSP官方包
下面为shell行输入:
首先打开petalinux工具:
: source /home/li/petalinux/settings.sh
: cd /home/user
: petalinux-create -t project -s
: cd Xilinx_*/
: petalinux-build
: petalinux-package --boot --format BIN --fsbl images/linux/zynqmp_fsbl.elf --u-boot images/linux/u-boot.elf --pmufw images/linux/pmufw.elf --fpga images/linux/system.bit –force
方法(二):独自设计硬件描述
利用vavido工具,生成.hdf文件(参考ug1209)
点击Create Block Design,如出现上图,
点击Run Block Automation
然后双击zynq_ultrascale如下图所示
点击PS-PL Configuration
取消AXI HPM0 FPD和AXI HPM1 FPD的√
点击OK保存。
右击选择(validate
design)
然后在source里选择design_1,右击选择Create
HDL Wrapper
在source里选择design_1,右击选择Generate
Output Products
点击Generate
Bitstream
点击file选择ExprotExprot Hardware
.经Vivado综合,实现后,在Vivado中导出硬件,输出PetaLinux所需要的硬件描述文件
输出的文件就在“/(工程文件夹)/(工程名).sdk”这个文件夹下,这个文件夹下的design_wrapper.hdf待用.
建立petalinux工程
找到存放工程的目录
根据petalinux安装的路径启动shell:source
/home/mm/petalinux/settings.sh
创建工程
shell:petalinux-create
--type project --template zynqMP --name zcu102_linux_01
解析硬件描述文件
把之前导出的硬件描述文件design_wrapper.hdf拷贝到计算机中的zcu102_linux_01工程文件夹下,输入下面命令:
shell: petalinux-config --get-hw-description=/home/(该工程目录路径)
会进入一个配置界面,在里面可以配置一些系统设置
选择image packaging configuration
->Root filesystem type
选择SD card,保存exit。
shell : petalinux-config -c rootfs
shell:
petalinux-build #生成image.ub
再重新编译:petelinux-build
shell:
petalinux-package --boot --format BIN --fsbl images/linux/zynqmp_fsbl.elf --u-boot images/linux/u-boot.elf --pmufw images/linux/pmufw.elf --fpga images/linux/system.bit --force #生成BOOI.BIN文件
生成的文件在/iamge/linux/下
这俩文件为LINUX系统启动文件
(参考Ubuntu移植redhat到zynqMP)
需要petalinux工具生成启动文件image.ub和BOOT.BIN
下载Ubuntu根目录文件系统包
https://rcn-ee.com/rootfs/eewiki/minfs/
https://rcn-ee.com/rootfs/eewiki/minfs/ubuntu-16.04.2-minimal-armhf-2017-05-11.tar.xz
将启动文件image.ub和BOOT.BIN文件拷贝到sd卡中的BOOT分区
进入petalLinux工程目录下,打开终端,输入下面命令:
cp images/linux/image.ub /media/l/BOOT/
cp images/linux/BOOT.BIN /media/l/BOOT/
将下载下来的Ubuntu根目录文件系统包解压到sd卡的rootfs分区
shell:
cd到该目录下,或者在该目录下打开终端
sudo tar xvf ubuntu-16.04.2-minimal-armhf-2017-05-11.tar.xz -C /media/l/rootfs
cd ubuntu-16.04.2-minimal-armhf-2017-05-11
sudo tar xvf armhr-rootfs-ubuntu-xenial.tar -C /media/l/rootfs
启动系统:
弹出sd卡
插入开发板
在主机打开终端
shell:
sudo apt install minicom
minicom
接通开发板电源
等待串口打印Linux启动信息
输入log:ubuntu
password:temppwd
进入Ubuntu系统: