E02-petalinux&Ubuntu_installation.md

E02-petalinux&Ubuntu_installation.md

社蕙 389 2022-08-28

在Ubuntu上安装petalinux指南

Ubuntu Ver:Ubuntu 16.04 (64 bit)
petalinux Ver:petalinux 2019.2

1. 安装流程

1.1. Ubuntu

1.1.1. 安装

Vmware与Ubuntu的安装过程略过,Ubuntu 16.04,在Vmware上安装16.04非常的方便。

1.1.2. 配置镜像服务器

参考[SOLVED] HOw to fix "Failed to Fetch" error

change to a faster/closer/different mirror:

SOFTWARE SOURCES
On the Ubuntu Software tab, select the drop down for "Download From"
Select Other
Choose your country then click on "Choose best server"....This will ping all the mirror sites for the best ping and then it will select the better server.
And once done, update from the Software Center.

简而言之,就是在设置的Software里面配置下载源,自动选择的话不出意外会选择交大的源,建议在配置源之前不要做任何包更新,会非常慢,甚至抓不到包卡死。

1.1.3. 配置语言

参考ubuntu16.04安装中文输入法并设置显示中文,配置中文语言。

不要按照这个配置输入法iBus框架输入法,至少我用不了;
并且切记切记不要听他的sudo apt-get remove ibus,Ubuntu会崩溃救不回来。

参考Ubuntu 16.04 中最好的中文拼音输入法,配置Fcitx框架下的输入法。

1.2. petalinux

petalinux的指导性文件应该是UG144

1.2.1. 下载依赖

参考ZYNQ学习之路——PetaLinux开发环境搭建

sudo apt-get install tofrodos iproute2 gawk xvfb gcc git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget diffstat chrpath socat xterm autoconf libtool tar unzip texinfo gcc-multilib build-essential libsdl1.2-dev libglib2.0-dev libssl-dev screen pax gzip

作者采用的petalinux版本不是2019.2,因此这个安装不是完整的,但是问题不是很大,后面petalinux会提醒你,手动补装就可以了。

1.2.2. 修改sh命令的dash为bash

参考Ubuntu切换默认sh为bash或者dash,这个教程好就好在它的修改是可逆的。

$ ls -l /bin/sh
/bin/sh -> dash

说明Ubuntu默认是dash,接下来修改:

$ sudo dpkg-reconfigure dash
# then choose no

dash换为bash只需要重复上述指令在UI里选yes即可。

1.2.3. petalinux本体下载

Xilinx官网下载,可以把东西拖进虚拟机,也可以共享文件夹,如果虚拟机不能与主机交互,见其他问题。

1.2.4. 安装petalinux

mkdir -p /opt/pkg/petalinux 
sudo chmod 755 /opt/pkg/petalinux 
./petalinux-v2018.2-final-installer.run /opt/pkg/petalinux

安装petalinux是不能用sudo的,所以文件夹权限是个大问题。

参考Ubuntu上安装xilinx PetaLinux工具的注意事项,可能配置安装路径的权限为755是有问题的,应该是777。

1.2.5. 检查是否正确安装

设置petalinux:

$ source /opt/pkg/petalinux/settings.sh
PetaLinux environment set to '/opt/pkg/petalinux'
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services

$ echo $PETALINUX
/opt/pkg/petalinux

1.3. 开机自动添加petalinux的环境配置

将设置环境的命令添加到ubuntu自启动脚本中。用root权限打开~/.bashrc文件,在文件最后添加设置命令:

source /opt/pkg/petalinux/settings.sh

坏处是每次bash启动会慢。

2. 其他问题

2.1. Vmware不能与主机交互

2.1.1. 文件不能拖动

基本上是Vmtool没有正确安装。可以参考重新安装VMware Tools灰色+安装VMware Tools,但是不一定能成,这个很麻烦。推荐重装Ubuntu,重装大概率恢复正常。

2.1.2. 共享文件夹不能访问

sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o nonempty

参考vmware ubuntu /mnt/hgfs 没有权限查看 找不到共享文件夹无法显示 open-vm-tools

3. 其他参考

  1. [UG1144] PetaLinux Tools Documentation: Reference Guide
  2. INSTALLING PETALINUX 2018.2 ON UBUNTU 16.04 LTS