zynq操作系统:petalinux的环境搭建

简介: Petalinux 工具是 Xilinx 公司推出的嵌入式 Linux 开发套件,包括了 u-boot、 Linux,Kernel、 device-tree、 rootfs 等源码和库,以及 Yocto recipes,可以让客户很方便的生成、配置、编译及自定义 Linux 系统。 Petalinux 支持 Versal 、 Zynq UltraScale+ MPSoC、Zynq-7000 SoC 以及 MicroBlaze,可与 Xilinx 硬件设计工具 Vivado 协同工作,大大简化了Linux 系统的开发工作。

简介:

 Petalinux 工具是 Xilinx 公司推出的嵌入式 Linux 开发套件,包括了 u-boot、 Linux,Kernel、 device-tree、 rootfs 等源码和库,以及 Yocto recipes,可以让客户很方便的生成、配置、编译及自定义 Linux 系统。 Petalinux 支持 Versal 、 Zynq UltraScale+ MPSoC、Zynq-7000 SoC 以及 MicroBlaze,可与 Xilinx 硬件设计工具 Vivado 协同工作,大大简化了Linux 系统的开发工作。个人使用感觉上,相比于一般的交叉编译工具,上手很快很容易就可以参考官方1144手册就能搭建起来最小系统,petalinux 确实比较智能,它能够根据 hdf 文件记录的信息自动配置,例如一些时钟频率、外设时钟、环境变量偏移量等,操作也就几个常用指令,前期及其方便。即便到了后期要更为灵活的单独对uboot或者内核进行开发时,也是需要petalinux工具参与的 。 具体的介绍可访问 Petalinux 工具网站:

https://china.xilinx.com/products/design-tools/embedded-software/petalinuxsdk.html

安装:

0.准备:

petalinux 的安装包文件比较大,有 7G 左右可以到 Xilinx 的官方网站

https://china.xilinx.com/进行下载,在官方网站中点击“技术支持”,在弹出来的选项中点击“下载与许可”如下图所示(注:需要注册账号才能下载) :

20210404180820529.png

一定一定要与vivado版本一致下载完成之后就获得了 petalinux 的安装文件 petalinux-v2018.2-finalinstaller.run。

可以通过设置虚拟机的共享文件夹来存放安装包

1.安装依赖库

在安装 Petalinux 之前我们需要为 Ubuntu 系统安装一些必要的运行软件以及依赖库,所以需要确保 Ubuntu 能够正常上网,打开 Ubuntu Terminal 终端执行以下命令:

sudo apt-get install tofrodos iproute2 gawk gcc g++ git make net-tools libncurses5-dev
tftpd zlib1g:i386 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 screen pax gzip automake

这里需要等待大概 1-2 分钟, 等待软件以及库安装完成之后即可进入下一步。

2.正式安装

安装 Petalinux 就要考虑安装位置了,对于 Petalinux 这种体积庞大的工具,我们将其放在/opt 目录下。在/opt 目录下新建专门存放 Petalinux 的文件夹,如/opt/pkg/petalinux/2018.2,在终端输入以下命令即可

sudo chown -R $ 无空格USER:$USER /opt
mkdir -p /opt/pkg/petalinux/2018.2

chown 命令将/opt 目录的属主和属组更改为当前的用户名,如笔者的 Ubuntu 用户名为zynq,执行的 chown 命令就相当于“ sudo chown -R zynq:zynq /opt”, 然后通过 mkdir 创建安装目录。 现在我们将 petalinux 安装在/opt/pkg/petalinux/2018.3 目录下, 在终端中输入如下命令:

./petalinux-v2018.2-final-installer.run /opt/pkg/petalinux/2018.2

运行上述命令后,需要等待一段时间,当出现“ Press Enter to display the licenseagreements”字样的时候,如下所示

PetaLinux SDK contains software from a number of sources. Please review the following licenses and indicate your acceptance of each to continue.
You do not have to accept the licenses, however if you do not then you may not use petalinux SDK.
Use PgUp/PgDn to navigate the license viewer, and press 'q' to close
Press Enter to display the license agreements

从显示的意思可以知道,让我们按下回车键显示软件许可协议,那就按下呗。

"Xilinx" means Xilinx, Inc., a Delaware corporation, with a place of business at 2100 iLogic Drive  SAn Jose, 95124.  
"xilinx Device" means a silicon device manufactured and marketed by or for xilinx.
2.  RESERVED. 
License Grants.
3.
(a) Xilinx Licenses. subject to the terms and conditions of this Agreement, xilinx hereby grants to Licensee the fo 
ublicensable licenses(under xilinxintellectual property rights as embodied in the applicable Software):
(1) Use. Licensee may install and use the Software for the sole purposes of developing, synthesizing, testin  
(2) RESERVED  
(3) Distributable Components License. 
A.  Certain Definitions."DistributableComponent(s)"means those files supplied by xilinx that are  
xilinx in such tool or its associated documentation as either(a) an Ip core (or a LogicoRE product), which is designed for use eafter a "core"), or (b) a software driver (or a device driver), which is designed for use in enabling a xilinx Device to interop an operating system as well as middleware, board support package(BSP) or other application software (collectively hereafter a " ilinx in either(y) source code form, such as a core provided in VHoL or Verilog form or a Driver provided in c language source than source code. such as a core provided in netlist form or encrypted netlist form or a Driver provided in complied obiect con clarity,a"core"as used herein includes only a"core"provided by xilinx in the software tools listed above at no additional c licensed separately under other agreements.
6.
Modification Rights. For Distributable Components supplied by xilinx in Modifiable Form License
/tmp/tmp.vX31uGy0V9/Petalinux_EULA.txt

这些内容没多大用想看可以看,直接按下 Q 键退出,回到之前的界面之后会出现一个选择项,询问我们是否接受 xilinx 最终用户协议。

这个显然是必须接受,否则无法进行下面的安装;输入 Y 按回车接受。除了xilinx 最终用户协议之外,还有两个协议也需要大家接受,会依次显示在终端上,同理也是输入 Y 按下回车接受。

Press Enter to display the license agreements
Do you accept xilinx End User License Agreement? [y/N] > y Do you accept webtalk Terms and conditions? [y/N] > y
Press Enter to display the license agreements
Do you accept xilinx End User License Agreement? [y/N] > y Do you accept webtalk Terms and Conditions? [y/N] >y
Do you accept Third party End User License Agreement? [y/N] > y INFO: Installing PetaLinux...

接受所有协议之后便会进行下面的安装步骤了,直到安装完成。进入安装目录后会有以下几个文件

O→ls
components doc etc settings.csh settings.sh tools

3修改bash

安装完成之后,我们还需要进行最后一个设置, petalinux 工具需要主机系统的/bin/sh是 bash,而 Ubuntu 默认的/bin/sh 是 dash,所以这里需要进行更改,运行 sudo dpkgreconfigure dash 命令,如下:

sudo dpkg-reconfigure dash
Configuring dash
The system shell is the default command interpreter for shell scripts.
Using dash as the system shell will improve the system's overall
performance. It does not alter the shell presented to interactive users.
Use dash as the default system shell (/bin/sh)?
<Yes> <No>  
Hx--1024

选择no,然后返回就可以了

4.配置环境变量

在正式使用前,每次打开终端都需要先运行安装目下的settings.sh 脚本文件设置 petalinux 工作环境, settings.sh 脚本用于 bash,还有一个 settings.csh 用于C shell,

在这里推荐使用别名来进行这个每次都要进行的复杂操作,上一步不是已经进入安装目录了,直接执行下面指令就可以了

echo “alias sptl=‘source $PETALINUX/settings.sh’” >> ~/.bashrc


相关实践学习
CentOS 7迁移Anolis OS 7
龙蜥操作系统Anolis OS的体验。Anolis OS 7生态上和依赖管理上保持跟CentOS 7.x兼容,一键式迁移脚本centos2anolis.py。本文为您介绍如何通过AOMS迁移工具实现CentOS 7.x到Anolis OS 7的迁移。
相关文章
|
4月前
|
运维 Linux Shell
day02-Linux运维-系统介绍与环境搭建_硬件 系统核心 解释器shell 外围操作系统
day02-Linux运维-系统介绍与环境搭建_硬件 系统核心 解释器shell 外围操作系统
|
11月前
|
安全 Unix Linux
初识操作系统以及Linux环境搭建
初识操作系统以及Linux环境搭建
52 0
|
机器学习/深度学习 机器人 中间件
ubuntu16.04下ROS操作系统学习笔记(五)gazebo物理仿真环境搭建、加载服务端模型数据减少报错
ubuntu16.04下ROS操作系统学习笔记(五)gazebo物理仿真环境搭建、加载服务端模型数据减少报错
174 0
|
Linux 测试技术 API
zynq操作系统: Linux下异步通知的应用
在使用阻塞或者非阻塞的方式来读取驱动中某些值都是应用程序主动读取的,对于非阻塞方式来说还需要应用程序通过 poll 函数不断的轮询。最好的方式就是驱动程序能主动向应用程序发出通知,报告自己可以访问,然后应用程序在从驱动程序中读取或写入数据。 Linux 提供了异步通知这个机制来完成此功能
214 0
|
存储 Ubuntu 安全
|
Linux
zynq操作系统: Linux驱动开发串口波特率 非标准波特率 10mb
zynq操作系统: Linux驱动开发串口波特率 非标准波特率 10mb
465 0
zynq操作系统: Linux驱动开发串口波特率 非标准波特率 10mb
|
内存技术
zynq操作系统:DDR带宽测试
个别时候,嵌入式设备的DDR除了常规的遍历读写和压力测试外,会有提供读写带宽的需求,下面介绍一种没有精确要求的测法,参考自http://github.com/raas/mbw
489 0
|
存储 内存技术
zynq操作系统: jffs2文件系统的错误异常
JFFS2的全名为JournallingFlashFileSystemVersion2(闪存日志型文件系统第2版),其功能就是管理在MTD设备上实现的日志型文件系统。与其他的存储设备存储方案相比,JFFS2并不准备提供让传统文件系统也可以使用此类设备的转换层。它只会直接在MTD设备上实现日志结构的文件系统。JFFS2会在安装的时候,扫描MTD设备的日志内容,并在RAM中重新建立文件系统结构本身。
641 0
|
Linux
zynq操作系统: Linux下Misc设备的添加应用
Misc 的意思是混合、杂项的,因此misc设备也叫做杂项设备(杂散设备)
162 0
|
Linux 测试技术 芯片

热门文章

最新文章