PetaLinux安装详解(Xilinx , linux, zynq, zynqMP)

1 概述

PetaLinux 工具提供在 Xilinx 处理系统上定制、构建和调配嵌入式 Linux 解决方案所需的所有组件。该解决方案旨在提升设计生产力,可与 Xilinx 硬件设计工具配合使用,以简化针对 Versal、Zynq™ UltraScale+™ MPSoC、Zynq™ 7000 SoC、和 MicroBlaze™ 的 Linux 系统开发。

PetaLinux 工具可帮助简化基于 Linux 产品的开发;您可以使用下列工具来完成从系统启动到执行的所有操作:

  • 命令行接口
  • 应用、器件驱动程序、库生成器以及开发模板
  • 可引导的系统映像生成器
  • 调试代理程序
  • GCC 工具
  • 集成的 QEMU 全系统仿真器
  • 自动化工具
  • 支持系统调试器

嵌入式软件与生态系统:
嵌入式软件与生态系统
使用这些工具,开发人员可以定制引导载入程序、Linux 内核或 Linux 应用。他们可以通过网络或 JTAG 在随附的全系统仿真器 (QEMU) 或物理硬件上添加新的内核、器件驱动程序、应用和库,以及启动并测试软件协议栈。

2 安装

本次安装软件版本是petalinux-v2020.1-final-installer.run

2.1 软硬件需求

2.1.1 硬件需求

硬件需求
硬件最小需求:

  • 8GB 内存
  • 2 GHZ CPU时钟
  • 100GB 系统硬盘

支持操作系统:

  • Red Hat Enterprise Workstation/Server 7.4,7.5,7.6,7.7(64-bit)
  • Centos Workstation/Server 7.4,7.5,7.6,7.7(64-bit)
  • Ubuntu Linux Workstation/Server 16.04.5,16.04.6,18.04.1,18.04.2,18.04.3,18.04.4 (64-bit)

这里选择操作系统Ubuntu 18.04

2.2.1 软件需求

在这里插入图片描述

  • 安装依赖软件
sudo dpkg --add-architecture i386
sudo apt-get update

sudo dpkg-reconfigure dash

sudo localedef -v -c -i en_US -f UTF-8 en_US.UTF-8

sudo apt install \
    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 \
	rsync \
    cpio
  • 安装tftp
install tftp
$ sudo apt-get install tftp-hpa tftpd-hpa

$ mkdir ~/tftpboot

$ chmod 777 ~/tftpboot/

$ sudo gedit /etc/default/tftpd-hpa

    # /etc/default/tftpd-hpa 
     
    TFTP_USERNAME="tftp"
    TFTP_DIRECTORY="/home/james/tftpboot"    //tftpboot绝对路径
    TFTP_ADDRESS=":69"
    TFTP_OPTIONS="--secure  -l -c -s"


$ service tftpd-hpa restart

2.2 安装

安装命令:

$ ./petalinux-v2020.1-final-installer.run

安装过程中选择默认就可以了

3 使用

3.1 启动环境配置

james@james-desktop:~$ source /opt/xilinx/petalinux/2020.1/settings.sh
PetaLinux environment set to '/opt/xilinx/petalinux/2020.1'
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
james@james-desktop:~$

3.2 使用

调用petalinux-create命令有如下输出,说明安装成功了。

james@james-desktop:~$ petalinux-create 
ERROR: No type is specified!
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"

james@james-desktop:~$ 

参考文档:

  • 19
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
更换 PetaLinuxzynqmp.dtsi 文件需要以下步骤: 1. 编辑新的 zynqmp.dtsi 文件。可以在 PetaLinux 工程目录下执行以下命令来获取原始的 zynqmp.dtsi 文件: ``` petalinux-config -c kernel ``` 在 kernel 配置菜单中选择 Device Tree ,然后选择 View DTS Source File 选项。将生成的文件保存到本地。 2. 将编辑好的 zynqmp.dtsi 文件复制到 PetaLinux 工程目录下,例如 $PETALINUX_PROJECT_DIR/project-spec/meta-user/recipes-bsp/device-tree/files/。 3. 更新 PetaLinux 工程的配置,以包含新的 zynqmp.dtsi 文件。在 PetaLinux 工程目录下执行以下命令: ``` petalinux-config ``` 在 PetaLinux 配置菜单中选择 Device Tree ,然后选择 User Overlays 选项。将新的 zynqmp.dtsi 文件添加到用户重叠列表中。 4. 重新生成 PetaLinux 工程的设备树文件。在 PetaLinux 工程目录下执行以下命令: ``` petalinux-build -c device-tree ``` 5. 重新生成 PetaLinux 工程的镜像文件。在 PetaLinux 工程目录下执行以下命令: ``` petalinux-build ``` 或者只重新生成镜像文件而不重新构建整个工程: ``` petalinux-package --boot --fsbl image/linux/zynqmp_fsbl.elf --fpga images/linux/your_fpga.bit --u-boot --force ``` 其中,your_fpga.bit 替换为您实际使用的 FPGA 位流文件名。 6. 在目标设备上刷写新生成的 PetaLinux 镜像文件。 如果一切顺利,您的 PetaLinux 工程现在应该已经使用了新的 zynqmp.dtsi 文件。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

flysnow010

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值