目录
1,更换apt-get源
2,安装petalinux的依赖库
3,修改/bin/sh
4,安装petalinux2017.4
已经在上一篇中成功安装了Ubuntu16.04.1,终于可以开始安装petalinux了。。。
petalinux版本 2017.4
安装包:petalinux-v2017.4-final-installer.run
更换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
根据UG1144的列表,安装petalinux的依赖库
$ 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可能会警告:
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:*
因为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 bash #修改,弹出的对话框选择“否”
$ ls -al /bin/sh #查看修改后的/bin/sh
lrwxrwxrwx 1 root root 4 5月 30 15:14 /bin/sh -> bash
上面修改完成,终于可以安装petalinux2017.4了。注意:petalinux必须在普通用户权限下安装!!!
$ mkdir -p /home/zhpy/petalinux
$ chmod 755 /home/zhupy/petalinux
直接将安装包(petalinux-v2017.4-final-installer.run)拖拽到linux下,我直接拖到了桌面
$ cd ~/Desktop/
$ ./petalinux-v2017.4-final-installer.run /home/zhupy/petalinux/
INFO: Checking installer checksum...
INFO: Extracting PetaLinux installer...
......... #开始安装
安装过程中,需要查看证书等,直接回车+:q+y 一共重复3次,再继续等。。。。直到安装成功
验证是否安装成功
$ source /home/zhupy/petalinux/settings.sh #首先要设置petalinux的环境变量
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
$ echo $PETALINUX
/home/zhupy/petalinux #安装成功
但是这样有一个问题,就是每次重新启动系统后都需要重新执行:
$ source /home/zhupy/petalinux/settings.sh
作为一个强迫症患者,怎么能容忍这么low的操作,因此,修改~/.bashrc文件
这个.bashrc 是终端的初始化配置脚本,每次打开新的终端的时候,都会执行这个脚本,把环境变量配置脚本加在里面,就能在打开的时候自动配置了。
$ gedit ~/.bashrc
#在最后一行增加
source /home/zhupy/petalinux/settings.sh
关闭终端,再打开
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
设置完成!!!
关闭petalinux的webtalk功能(个人喜好)
$ petalinux-util --webtalk off
INFO: Turn off webtalk feature!
另外:一旦petalinux安装完成,程序文件夹是不能进行复制和移动的。