目录
前言
官方的软件安装指南:
《UG1144 - PetaLinux Tools Documentation: Reference Guide (ver 2018.2)》
下载链接:
博客主体转载自下文,并在此基础上进行适当修改
https://blog.csdn.net/zhupingyang/article/details/80509199
一、安装文件与要求:
1、安装包:petalinux-v2017.4-final-installer.run,可在xilinx官方下载,下载链接:https://china.xilinx.com/support/download/index.html/content/xilinx/zh/downloadNav/embedded-design-tools/2017-4.html
2、安装环境要求:
8 GB RAM (recommended minimum for Xilinx tools)
2 GHz CPU clock or equivalent (minimum of 8 cores)
100 GB free HDD space
Supported OS:
- RHEL 7.2/7.3 (64-bit)
- CentOS 7.2/7.3 (64-bit)
- Ubuntu 16.04.1 (64-bit)
二、安装流程(linux环境下):
1、更换apt-get源(也可保持不变)
$ su
# cd /etc/apt
# cp sources.list sources.list.bak
# gedit sources.list
将文件里的内容更换成:
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
save并退出,开始update
# apt-get update
2、安装petalinux的依赖库
为了方便依赖库的一次性安装,新建脚本文件lib.sh,将以下命令拷贝至lib.sh后运行,运行结束即可。
$ sudo apt-get install tofrodos
$ sudo apt-get install iproute
$ sudo apt-get install gawk
$ sudo apt-get install xvfb
$ sudo apt-get install git
$ sudo apt-get install make
$ sudo apt-get install net-tools
$ sudo apt-get install libncurses5-dev
$ sudo apt-get install tftpd
$ sudo apt-get install zlib1g:i386
$ sudo apt-get install libssl-dev
$ sudo apt-get install flex
$ sudo apt-get install bison
$ sudo apt-get install libselinux1
$ sudo apt-get install gnupg
$ sudo apt-get install wget
$ sudo apt-get install diffstat
$ sudo apt-get install chrpath
$ sudo apt-get install socat
$ sudo apt-get install xterm
$ sudo apt-get install autoconf
$ sudo apt-get install libtool
$ sudo apt-get install tar
$ sudo apt-get install unzip
$ sudo apt-get install texinfo
$ sudo apt-get install zlib1g-dev
$ sudo apt-get install gcc-multilib
$ sudo apt-get install build-essential
$ sudo apt-get install libsdl1.2-dev
$ sudo apt-get install libglib2.0-dev
$ sudo apt-get install screen
$ sudo apt-get install pax
$ sudo apt-get install gzip
注意:在官方依赖库列表中的python3.4不需要安装,ubtunu16.04中同时安装了python2和python3(两者不兼容),ubuntu默认的是python2,保持不变,petalinux可正常使用(如果更改成python3反而会导致后面的安装出现失败)。
3、设置安装环境
(1)避免警告
在安装petalinux可能会出现如下警告:
No tftp server found - please refer to "PetaLinux SDK Installation Guide" for its impact and solution
需要预先安装下面的库文件:
$ sudo apt-get install tftp
$ sudo apt-get install openbsd-inetd
$ sudo gedit /etc/inted.conf
#在文件中增加以下内容:
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot
#保存并退出
$ sudo mkdir /tftpboot
$ sudo chmod 777 /tftpboot #修改文件夹权限
$ /etc/init.d/openbsd-inetd restart
$ netstat -an | more | grep udp
#看到有如下输出,表示tftp安装成功
udp 0 0 0.0.0.0:69 0.0.0.0:*
(2)修改/bin/sh
ubuntu默认的“/bin/sh”是dash,安装需要修改成bash。
$ ls -al /bin/sh #查看未修改之前的/bin/sh
lrwxrwxrwx 1 root root 4 5月 29 16:40 /bin/sh -> dash
$ sudo dpkg-reconfigure dash #修改,弹出的对话框选择“否”
$ ls -al /bin/sh #查看修改后的/bin/sh
lrwxrwxrwx 1 root root 4 5月 30 15:14 /bin/sh -> bash
(3)设置安装目录的权限:
petalinux必须在普通用户权限下安装,因此安装目录的权限也需要修改:将petalinux-v2017.4-final-installer.run安装包所在的目录(包括父目录)权限修改为755。
(我的安装目录:/home/ petalinux,则包括home在内的两个目录都需要修改权限)
$ mkdir -p /home/ petalinux
$ sudo chmod 755 /home /home/petalinux
4、完成安装(普通用户操作)
将安装包(petalinux-v2017.4-final-installer.run)拷贝到Ubuntu的home桌面下:
$ cd ~/Desktop/
$ ./petalinux-v2017.4-final-installer.run /home/petalinux/
INFO: Checking installer checksum...
INFO: Extracting PetaLinux installer...
.........
安装过程中,需要查看证书,共三次
操作:entry—>输入退出命令 :q—>点确定:y
指导安装完成。
5、验证安装成功
#首先要设置petalinux的环境变量(注意:每次使用petalinux前都要先进行设置)
$ source /home/petalinux/settings.sh
PetaLinux environment set to '/home/petalinux'
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
#验证
$ echo $PETALINUX
/home /petalinux
6、设置自启动设置
(1)方法:修改~/.bashrc文件:.bashrc 是终端的初始化配置脚本,每次打开新的终端的时候,都会执行这个脚本,把环境变量配置脚本加在里面,就能在打开的时候完成自动配置。
$ gedit ~/.bashrc
#在最后一行增加
source /home/petalinux/settings.sh
#保存并退出。
(2)关闭终端,再打开
PetaLinux environment set to '/home/zhupy/petalinux'
INFO: Checking free disk space
INFO: Checking installed tools
INFO: Checking installed development libraries
INFO: Checking network and other services
即设置完成!