安装petalinux工具

news2025/1/12 4:03:23

petalinux 并不是一个特殊 Linux 内核,而是一套开发环境配置的工具,降低 uboot、内核、 根文件系统的配置的工作量,可以从 Vivado 的导出硬件信息自动完成相关软件的配置。

petalinux 是赛灵思基于 buildroot 工具链为自家处理器方便适配 Linux 定制的工具集。

在 Xilinx 官方文档 UG1144 中有详细安装方法,如果本教程安装失败,请参考 Xilinx 的 ug1144 文档
进行安装。(https://www.xilinx.com/support/documentation/sw_manuals/xilinx2020_1/ug1144-petalinux-tool s-reference-guide.pdf)
image.png

准备 Linux 操作系统环境

这里使用 PVE 下的 Ubuntu18.04 虚拟机做运行系统环境。
注意:petalinux 对系统版本和设置有严格要求,一定要选择对应版本推荐的系统版本安装。不对应的系统版本可能会出现各种问题。
配置网络可连接外网,安装 ssh 服务端,可 ssh 登录,后面基本在命令行下进行操作。

更新软件列表

sudo apt-get update

#使用本地代理方式
sudo apt -o Acquire::http::proxy="http://192.168.196.112:3142" update

安装基础软件,这里写成了脚本。

#!/bin/bash
set -x
script_dir=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)

# This script sets up a Ubuntu host to be able to create the image by
# installing all of the necessary files. It assumes a host with
# passwordless sudo

# Install a bunch of packages we need

read -d '' PACKAGES <<EOT
iproute2
gcc
g++
net-tools
libncurses5-dev
zlib1g:i386
libssl-dev
flex
bison
libselinux1
xterm
autoconf
libtool
texinfo
zlib1g-dev
gcc-multilib
build-essential
screen
pax
gawk
python3
python3-pexpect
python3-pip
python3-git
python3-jinja2
xz-utils
debianutils
iputils-ping
libegl1-mesa
libsdl1.2-dev
pylint3
cpio
EOT
set -e

sudo apt-get update

if [[ $(lsb_release -rs) == "16.04" ]]; then
    echo "Install packages on Ubuntu 16.04..."
    sudo apt purge -y libgnutls-dev
elif [[ $(lsb_release -rs) == "18.04" ]]; then
    echo "Install packages on Ubuntu 18.04..."
else
    echo "Error: current OS not supported."
    exit 1
fi

sudo dpkg --add-architecture i386 #开启i386体系支持
sudo apt-get update
sudo apt-get install -y $PACKAGES

echo "Now install Vivado, SDK, and Petalinux."
echo "Re-login to  ensure the enviroment is properly set up."

为了加快下载包可以使用代理,另一种脚本如下:

#!/bin/bash
sudo apt-get -o Acquire::http::proxy="http://192.168.196.112:3142" update
sudo dpkg --add-architecture i386 #开启i386体系支持
sudo apt-get -o Acquire::http::proxy="http://192.168.196.112:3142" update
sudo apt-get -o Acquire::http::proxy="http://192.168.196.112:3142" install -y iproute2 gcc g++ net-tools libncurses5-dev zlib1g:i386 libssl-dev flex bison libselinux1 xterm autoconf libtool texinfo zlib1g-dev gcc-multilib build-essential screen pax gawk python3 python3-pexpect python3-pip python3-git python3-jinja2 xz-utils debianutils iputils-ping libegl1-mesa libsdl1.2-dev pylint3 cpio

安装 Petalinux
创建安装目录并设置

sudo -s
mkdir -p /opt/pkg/petalinux
chgrp scilogyhunter /opt/pkg/petalinux
chown scilogyhunter /opt/pkg/petalinux
exit

设置petalinux-v2020.1-final-installer.run 文件可执行权限

scilogyhunter@ubuntu1804:~/petalinux$
scilogyhunter@ubuntu1804:~/petalinux$ ls -al
total 48758708
drwxrwxr-x  2 scilogyhunter scilogyhunter        4096 520 17:48 .
drwxr-xr-x 16 scilogyhunter scilogyhunter        4096 520 16:28 ..
-rw-rw-r--  1 scilogyhunter scilogyhunter 35509900839 520 16:35 downloads_2020.1.tar.gz
-rwxrwxrwx  1 scilogyhunter scilogyhunter        1123 520 16:29 host_env_setup.sh
-rw-rw-r--  1 scilogyhunter scilogyhunter        1207 520 17:38 host_env_setup.shes
-rw-rw-r--  1 scilogyhunter scilogyhunter   213906986 520 16:39 linux-xlnx-xilinx-v2020.1.zip
-rw-rw-r--  1 scilogyhunter scilogyhunter  1315548907 520 16:29 petalinux-v2020.1-final-installer.run
-rw-rw-r--  1 scilogyhunter scilogyhunter        1237 520 17:48 setup_proxy.sh
-rw-rw-r--  1 scilogyhunter scilogyhunter 12870640734 520 16:38 sstate_aarch64_2020.1.tar.gz
-rw-rw-r--  1 scilogyhunter scilogyhunter         598 520 16:39 sstate_rel_2020.1_README.tar.gz
-rw-rw-r--  1 scilogyhunter scilogyhunter    18868392 520 16:39 u-boot-xlnx-xilinx-v2020.1.tar.gz
-rw-rw-r--  1 scilogyhunter scilogyhunter        1231 520 17:42 yes
scilogyhunter@ubuntu1804:~/petalinux$ chmod +x petalinux-v2020.1-final-installer.run
scilogyhunter@ubuntu1804:~/petalinux$ ls -al
total 48758708
drwxrwxr-x  2 scilogyhunter scilogyhunter        4096 520 17:48 .
drwxr-xr-x 16 scilogyhunter scilogyhunter        4096 520 16:28 ..
-rw-rw-r--  1 scilogyhunter scilogyhunter 35509900839 520 16:35 downloads_2020.1.tar.gz
-rwxrwxrwx  1 scilogyhunter scilogyhunter        1123 520 16:29 host_env_setup.sh
-rw-rw-r--  1 scilogyhunter scilogyhunter        1207 520 17:38 host_env_setup.shes
-rw-rw-r--  1 scilogyhunter scilogyhunter   213906986 520 16:39 linux-xlnx-xilinx-v2020.1.zip
-rwxrwxr-x  1 scilogyhunter scilogyhunter  1315548907 520 16:29 petalinux-v2020.1-final-installer.run
-rw-rw-r--  1 scilogyhunter scilogyhunter        1237 520 17:48 setup_proxy.sh
-rw-rw-r--  1 scilogyhunter scilogyhunter 12870640734 520 16:38 sstate_aarch64_2020.1.tar.gz
-rw-rw-r--  1 scilogyhunter scilogyhunter         598 520 16:39 sstate_rel_2020.1_README.tar.gz
-rw-rw-r--  1 scilogyhunter scilogyhunter    18868392 520 16:39 u-boot-xlnx-xilinx-v2020.1.tar.gz
-rw-rw-r--  1 scilogyhunter scilogyhunter        1231 520 17:42 yes
scilogyhunter@ubuntu1804:~/petalinux$
scilogyhunter@ubuntu1804:~/petalinux$./petalinux-v2020.1-final-installer.run -d /opt/pkg/petalinux

开始安装

scilogyhunter@ubuntu1804:~/petalinux$ ./petalinux-v2020.1-final-installer.run -d /opt/pkg/petalinux
INFO: Checking installation environment requirements...
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
WARNING: No tftp server found - please refer to "UG1144  PetaLinux Tools Documentation Reference Guide" for its impact and solution
INFO: Checking installer checksum...
INFO: Extracting PetaLinux installer...

LICENSE AGREEMENTS

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
Do you accept Xilinx End User License Agreement? [y/N] > Do you accept Xilinx End User License Agreement? [y/N] >
Do you accept Xilinx End User License Agreement? [y/N] > y
Do you accept Webtalk Terms and Conditions? [y/N] > Do you accept Webtalk Terms and Conditions? [y/N] > y
Do you accept Third Party End User License Agreement? [y/N] > Do you accept Third Party End User License Agreement? [y/N] >
Do you accept Third Party End User License Agreement? [y/N] > y
INFO: Installing PetaLinux...
INFO: Checking PetaLinux installer integrity...
INFO: Installing PetaLinux SDK to "/opt/pkg/petalinux/."
INFO: Installing buildtools in /opt/pkg/petalinux/./components/yocto/buildtools
INFO: PetaLinux SDK has been installed to /opt/pkg/petalinux/.
scilogyhunter@ubuntu1804:~/petalinux$

安装过程中需要回车查看授权协议,按 q 退出。后面还有多次需要同意协议内容,按 y 同意。

安装目录生成内容

scilogyhunter@ubuntu1804:~/petalinux$ ls /opt/pkg/petalinux/
components  doc  etc  settings.csh  settings.sh  tools
scilogyhunter@ubuntu1804:~/petalinux$

安装过程的当前目录下还会生成petalinux_installation_log 文件,记录安装日志。

scilogyhunter@ubuntu1804:~/petalinux$ ls
downloads_2020.1.tar.gz  linux-xlnx-xilinx-v2020.1.zip          setup_proxy.sh                   u-boot-xlnx-xilinx-v2020.1.tar.gz
host_env_setup.sh        petalinux_installation_log             sstate_aarch64_2020.1.tar.gz
host_env_setup.shes      petalinux-v2020.1-final-installer.run  sstate_rel_2020.1_README.tar.gz
scilogyhunter@ubuntu1804:~/petalinux$ rm setup_proxy.sh
scilogyhunter@ubuntu1804:~/petalinux$ cat petalinux_installation_log

INFO: Checking installation environment requirements...
INFO: Checking installer checksum...
INFO: Extracting PetaLinux installer...
INFO: Installing PetaLinux...
INFO: Checking PetaLinux installer integrity...
INFO: Installing PetaLinux SDK to "/opt/pkg/petalinux/."
.......................................................INFO: Installing buildtools in /opt/pkg/petalinux/./components/yocto/buildtools
Build tools installer version 2020.1
====================================
You are about to install the SDK to "/opt/pkg/petalinux/components/yocto/buildtools". Proceed [Y/n]? Y
Extracting SDK..........................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /opt/pkg/petalinux/components/yocto/buildtools/environment-setup-x86_64-petalinux-linux
INFO: PetaLinux SDK has been installed to /opt/pkg/petalinux/.
scilogyhunter@ubuntu1804:~/petalinux$

设置环境变量

设置 petalinux 环境变量,运行下面命令 (环境变量只在当前打开的终端中有效,后面和
petalinux 相关的命令都要在当前终端中输入,如果关闭了当前终端则需要重新运行这条命
令) 。

scilogyhunter@ubuntu1804:~/petalinux$ source /opt/pkg/petalinux/settings.sh
PetaLinux environment set to '/opt/pkg/petalinux'
WARNING: /bin/sh is not bash!
bash is PetaLinux recommended shell. Please set your default shell to bash.
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
WARNING: No tftp server found - please refer to "UG1144 2020.1 PetaLinux Tools Documentation Reference Guide" for its impact and solution
scilogyhunter@ubuntu1804:~/petalinux$

验证petalinux

使用 petalinux-create -h 命令验证 petalinux 安装可用。

scilogyhunter@ubuntu1804:~/petalinux$ petalinux-create -h
petalinux-create             (c) 2005-2020 Xilinx, Inc.

This command creates a new PetaLinux Project or component

Usage:
  petalinux-create [options] <-t|--type <TYPE> <-n|--name <COMPONENT_NAME>

Required:
  -t, --type <TYPE>                     Available type:
                                          * project : PetaLinux project
                                          * apps    : Linux user application
                                          * modules : Linux user module
  -n, --name <COMPONENT_NAME>           specify a name for the component or
                                        project. It is OPTIONAL to create a
                                        PROJECT. If you specify source BSP when
                                        you create a project, you are not
                                        required to specify the name.
Options:
  -p, --project <PROJECT>               specify full path to a PetaLinux project
                                        this option is NOT USED for PROJECT CREATION.
                                        default is the working project.
  --force                               force overwriting an existing component
                                        directory.
  -h, --help                            show function usage
  --enable                              this option applies to all types except
                                        project.
                                        enable the created component
  --srcuri                              this option is to specify the source files
                                        from outside project.This will copy specified
                                        files into recipe files directory and add to
                                        SRC_URI variable in .bb file.
                                        Specify the multiple files with space.

Options for project:
  --template <TEMPLATE>                 versal|zynqMP|zynq|microblaze
                                        user needs specify which template to use.
  -s|--source <SOURCE>                  specify a PetaLinux BSP as a project
                                        source.

Options for apps:
  --template <TEMPLATE>                 <c|c++|autoconf|install>
                                        c   : c user application(default)
                                        c++ : c++ user application
                                        autoconf: autoconf user application
                                        install: install data only
                                        fpgamanager: autoload .dtbo and .bin files
                                            Enable 'FPGA Manager' to build the fpgamanager apps.
  -s, --source <SOURCE>                 valid source name format:
                                          *.tar.gz, *.tgz, *.tar.bz2, *.tar,
                                          *.zip, app source directory

Options for modules: (No specific options for modules)

EXAMPLES:

Create project from PetaLinux Project BSP:
  $ petalinux-create -t project -s <PATH_TO_PETALINUX_PROJECT_BSP>

Create project from template:
For microblaze project,
  $ petalinux-create -t project -n <PROJECT> --template microblaze
For zynq project,
  $ petalinux-create -t project -n <PROJECT> --template zynq
For zynqMP project,
  $ petalinux-create -t project -n <PROJECT> --template zynqMP
For versal project,
  $ petalinux-create -t project -n <PROJECT> --template versal


Create an app and enable it:
  $ petalinux-create -t apps -n myapp --enable
The application "myapp" will be created with c template in:
  <PROJECT>/project-spec/meta-user/recipes-apps/myapp

Create an app with remote sources:
  $ petalinux-create -t apps -n myapp --enable --srcuri http://example.tar.gz
  $ petalinux-create -t apps -n myapp --enable --srcuri git://example.git\;protocol=https
  $ petalinux-create -t apps -n myapp --enable --srcuri https://example.tar.gz

Create a FPGAmanager application to load .dtsi and .bit/.pdi
  $ petalinux-create -t apps --template fpgamanager -n gpio --enable
The application "gpio" will be created with the fpgamanager class
include to build .dtbo and .bin files which will load on target
boot time(default).
NOTE: Make sure you have enabled the 'FPGA manager' in petalinux-config

Create an app with local source files:
  $ petalinux-create -t apps --template fpgamanager -n gpio --enable --srcuri \
        "<path>/pl.dtsi <path>/system.bit"
This will create "gpio" application with pl.dtsi and system.bit added
to SRC_URI and copied to files directory.


Create an module and enable it:
  $ petalinux-create -t modules -n mymodule --enable
The module "mymodule" will be created with template in:
  <PROJECT>/project-spec/meta-user/recipes-modules/mymodule

Create an module with source files:
  $ petalinux-create -t modules -n mymodule --enable --srcuri "<path>/mymoudle.c <path>/Makefile"

scilogyhunter@ubuntu1804:~/petalinux$

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1686456.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

每周刷题第三期

个人主页&#xff1a;星纭-CSDN博客 系列文章专栏&#xff1a;Python 踏上取经路&#xff0c;比抵达灵山更重要&#xff01;一起努力一起进步&#xff01; 目录 题目一&#xff1a;环形链表 题目二&#xff1a;删除有序数组中的重复项 题目三&#xff1a;有效的括号 题…

spring-boot-starter-mail 发送带附件的邮件信息

背景 项目使用的事ruoyi低代码开发平台ruoyi中有常见的web端下载excel的方式&#xff0c;但是这种方式是直接把输出流写到一个response中&#xff0c;而不是给一个outputstream&#xff0c;如果是给一个outputstream的话&#xff0c;就可以写入到一个固定的文件中去了 解决思路…

P2. 配置MySQL和用户注册登录模块

P2. 配置MySQL和用户注册登录模块 0 概述Tips1 预备知识1.1 SpringBoot 常用模块1.2 pojo层的实现1.3 mapper层的实现1.4 controller层调试CRUD 2 Spring Security2.1 Spring Security 介绍2.2 Spring Security 对接数据库2.3 密码的加密 3 Jwt验证3.1 传统Session验证方式3.2 …

Langchain-Chatchat的markdownHeaderTextSplitter使用

文章目录 背景排查步骤官方issue排查测试正常对话测试官方默认知识库Debug排查vscode配置launch.json命令行自动启动condadebug知识库搜索测试更换ChineseRecursiveTextSplitter分词器 结论 关于markdownHeaderTextSplitter的探索标准的markdown测试集Langchain区分head1和head…

小白跟做江科大32单片机之学习准备

1.安装好51MDK之后&#xff0c;出现不能正常安装支持包的情况 在线安装支持包——>在keil5软件下点击这个&#xff0c;即可进入更新支持包界面 进去之后找这个 国产的可以找和这个 最后有这个就可以了

【人工智能项目】小车障碍物识别与模型训练(完整工程资料源码)

实物演示效果: 一、绪论: 1.1 设计背景 小车障碍物识别与模型训练的设计背景通常涉及以下几个方面: 随着自动驾驶技术的发展,小车(如无人驾驶汽车、机器人等)需要能够在复杂的环境中自主导航。障碍物识别是实现这一目标的关键技术之一,它允许小车检测并避开路上的障碍物…

JavaScript 动态网页实例 —— 表格处理

表格是网页设计中必不可少的内容之一。本章首先介绍HTML中普通表格的组成结构,然后,在此基础上,介绍如何使用JavaScript设置表格的属性。随后,更具体地介绍操作表格元素的一般方法,主要是对表格行、列的动态增删操作。有了这些基础,在本章的最后介绍对表元的操作,即如何…

C语言 | Leetcode C语言题解之第108题将有序数组转换为二叉搜索树

题目&#xff1a; 题解&#xff1a; struct TreeNode* helper(int* nums, int left, int right) {if (left > right) {return NULL;}// 选择任意一个中间位置数字作为根节点int mid (left right rand() % 2) / 2;struct TreeNode* root (struct TreeNode*)malloc(sizeo…

生产制造边角料核算说明及ODOO演示

今天群里有伙伴提到边角料的处理问题&#xff0c;我们梳理了一下&#xff0c;在生产过程中&#xff0c;如果产生了边角料&#xff0c;核算产成品的投料成本时需要考虑边角料的价值&#xff0c;以确保成本核算的准确性。以下是注意的几点&#xff1a; 一、边角料的入账价值 在生…

poi操作word模板,对原有的word修改

/*** 化工园区调查表** param templatePath* param outPath* param parkInterview*/public static String getDocx(String templatePath, String outPath, ParkInterview parkInterview){File file new File(templatePath);File file1 new File(outPath);if(!file1.exists()…

初识C语言——第二十五天

函数的嵌套调用和链式访问 函数不可以嵌套定义&#xff0c;但可以嵌套调用 链式访问&#xff1a;把一个函数的返回值作为另外一个函数的参数 #define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h>//写一个函数&#xff0c;每调用一次这个函数&#xff0c;就会 将num…

ArcGIS批量更改所有符号的格式

这期谈一下&#xff0c;如何修改所有符号的样式。 比如&#xff0c;我们需要更改下图的面符号位无轮廓的 该如何批量修改的呢&#xff1f; 视频教学吧&#xff1a; ArcGIS批量更改所有符号的格式 ArcGIS全系列实战视频教程——9个单一课程组合系列直播回放-CSDN博客文章浏览阅…

OracleDG原理

一、DataGuard架构介绍 1、基本介绍 在DG环境中&#xff0c;至少会有两个数据库&#xff0c;一个数据库处于Open状态&#xff0c;对外提供服务&#xff0c;这个数据库叫做primary Database。第二个数据库处于恢复状态&#xff0c;叫做Standby Database。运行时Primay Databas…

C# 正则表达式使用小计

此文档用于记录平时使用正则表达式的心得&#xff0c;不定期更新 基础 实例 替换实例一 //这里匹配以 “( 开头,以 )” 结尾的字符串 private static Regex REGEX_ARG_CONTENT new Regex("""(.*?)""");//此方法用于在匹配到的结果前添加字符…

TG5032CGN TCXO 超高稳定10pin端子型适用于汽车动力转向控制器

TG5032CGN TCXO / VC-TCXO是一款应用广泛的晶振&#xff0c;具有超高稳定性&#xff0c;CMOS输出和使用晶体基振的削波正弦波输出形式。且有低相位噪声优势&#xff0c;是温补晶体振荡器(TCXO)和压控晶体振荡器(VCXO)结合的产物&#xff0c;具有TCXO和VCXO的共同优点&#xff0…

微网群如何协调控制?基于目标级联法的微网群多主体分布式优化调度程序代码!

前言 微电网将分布式电源(distributed generation&#xff0c;DG)与负荷组成有机整体&#xff0c;通过控制策略降低了分布式电源直接并网对大电网的影响&#xff0c;是分布式电源友好并网的有效手段。随着微电网的不断发展&#xff0c;局部范围内的多个微电网互相联结形成微网…

学习记录16-反电动势

一、反电动势公式 在负载下反电势和端电压的关系式为&#xff1a;&#x1d448;&#x1d43c;&#x1d445;&#x1d43f;*&#xff08;&#x1d451;&#x1d456; / &#x1d451;&#x1d461;&#xff09;&#x1d438; E为线圈电动势、 &#x1d713; 为磁链、f为频率、N…

大语言模型预训练新前沿:「最佳适配打包」重塑文档处理标准

源自&#xff1a;机器之心 “人工智能技术与咨询” 发布 声明:公众号转载的文章及图片出于非商业性的教育和科研目的供大家参考和探讨&#xff0c;并不意味着支持其观点或证实其内容的真实性。版权归原作者所有&#xff0c;如转载稿涉及版权等问题&#xff0c;请立即联系我们…

颠覆传统编码,零基础也能飞的工具!

YDUIbuilder以其低代码的设计理念&#xff0c;通过简单的拖拽操作&#xff0c;即使是编程新手也能快速构建出专业的用户界面。这不再是一个遥不可及的梦想&#xff0c;而是一个触手可及的现实。 组件化世界&#xff0c;创意无限&#xff1a;构建梦想中的界面 在YDUIbuilder的组…

java项目之人事系统源码(springboot+vue+mysql)

风定落花生&#xff0c;歌声逐流水&#xff0c;大家好我是风歌&#xff0c;混迹在java圈的辛苦码农。今天要和大家聊的是一款基于springboot的人事系统。项目源码以及部署相关请联系风歌&#xff0c;文末附上联系信息 。 项目简介&#xff1a; 基于vue的人事系统的主要使用者…