目录
1. 简介
本博文分享在 VD100 硬件平台上,通过 Petalinux 2024.2 构建 Linux 的过程。
包括:
- Petalinux 2024.2 的下载与安装
- 在 VD100 硬件平台构建 Linux 全过程
- SDT 生成设备树的方法
- SD 卡分区
- 一些常见异常的汇总和分析
2. 下载与安装
2.1 下载 2024.2
2.2 参考手册
2.3 安装准备
1)我的配置(符合要求):
- 32 GB DDR5-5600
- AMD 7940HS
- Ubuntu Desktop 20.04.6 LTS
The PetaLinux tools need to be installed as non-root users.
2)依赖包
sudo apt-get install iproute2 gawk python3 python build-essential gcc git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget git-core diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib automake zlib1g:i386 screen pax gzip cpio python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3
参考:《2024.2_PetaLinux_OS_Package_List.xlsx》
3)dash
Petalinux 工具要求主机系统 /bin/sh 为 bash。
# 检查 /bin/sh 指向哪个 shell:
>> ll /bin/sh
---
lrwxrwxrwx 1 root root 4 12月 20 23:02 /bin/sh -> dash*
更改 /bin/sh:
>> sudo dpkg-reconfigure dash
在弹出的界面中选择 "No" 来将 /bin/sh 链接到 bash。
2.4 安装过程
《Reference Guide (UG1144)》:Installing the PetaLinux Tool
>> chmod 755 ./petalinux-v<petalinux-version>-final-installer.run
>> ./petalinux-v2024.2-11062026-installer.run
可以指定安装目录 :
>> mkdir -p /opt/petalinux/2024.2
>> ./petalinux-v2024.2-11062026-installer.run -d /opt/petalinux/2024.2/
注:chmod 755 使 PetaLinux 安装程序脚本变为可执行文件。
- (7)所有者: 读、写、执行
- (5)所属组: 读、执行
- (5)其他用户: 读、执行
在安装过程中,会两次弹出协议,按 q 退出后,按 y 同意即可,安装成功提示如下:
>> ./petalinux-v2024.2-11062026-installer.run -d /opt/petalinux/2024.2/
---
PetaLinux CMD tools installer version 2024.2
============================================
[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
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] > y
Do you accept Third Party End User License Agreement? [y/N] > y
[INFO] Installing PetaLinux SDK...done
[INFO] Setting it up...done
[INFO] Extracting xsct tarball...done
[INFO] PetaLinux SDK has been successfully set up and is ready to be used.
3. 使用示例
3.1 配置环境
>> source /opt/petalinux/2024.2/settings.sh
第一次 souring 会出现如下提示:
>> source /opt/petalinux/2024.2/settings.sh
---
*************************************************************************************************************************************************
The PetaLinux source code and images provided/generated are for demonstration purposes only.
Please refer to https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/2741928025/Moving+from+PetaLinux+to+Production+Deployment
for more details
*************************************************************************************************************************************************
PetaLinux environment set to '/opt/petalinux/2024.2'
[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 2024.2 PetaLinux Tools Documentation Reference Guide" for its impact and solution
验证工作环境是否已设置:
>> echo $PETALINUX
---
/opt/petalinux/2024.2
3.2 减少构建时间
Petalinux 工程编译时会从网上获取大量的必要资源,编译速度依赖于网速,如果网络不稳定还有可能在等待很久之后编译失败,推荐使用离线镜像。
参考一: