WARNING: You MUST have docker use experiences. If not, be familiar with docker, or go ahead and check installing petalinux on local machine.
WARNING: You can’t use docker on Windows for petalinux. Because petalinux will generate some files that only can be read in Unix, and Vitis requires these files. You MUST use docker in Unix-like system, or just use an OS listed below.
INFO: This installation guide is also suitable for installing petalinux-2020.1 on local machine, only if your OS is one of them:
- 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)
For local installation, you should ignore some docker commands and add sudo prefix to some commands.
ubuntu:bionic-20180426 is Ubuntu 18.04 image.
1
| docker pull ubuntu:bionic-20180426
|
1
| docker run -it --name petalinux-2020.1 ubuntu:bionic-20180426
|
1
2
| apt update
apt install vim ca-certificates sudo rsync locales
|
1
| sudo locale-gen en_US.UTF-8
|
Change apt source to USTC for Chinese users:
1
| cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
Change the contents of /etc/apt/sources.list to:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| # 默认注释了源码仓库,如有需要可自行取消注释
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
|
Petalinux cannot run in sudo mode, for local installation instead of using docker, just ignore creating the new user.
1
2
3
| useradd -m petalinux
passwd petalinux
adduser petalinux sudo
|
1
2
| su -- petalinux
/bin/bash
|
1
2
| sudo dpkg-reconfigure dash
# choose no
|
1
2
| sudo dpkg --add-architecture i386
sudo apt update
|
These are prerequisites for installing petalinux-2020.1.
1
| 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 cpio
|
Install Petalinux-2020.1
We are in half way. Now we turn the petalinux-2020.1 container to petalinux-2020.1 image.
1
2
| docker commit petalinux-2020.1 petalinux-2020.1
docker rm petalinux-2020.1
|
We create a share folder.
1
2
| mkdir ~/petalinux-share
cp ~/Downloads/petalinux-v2020.1-final-installer.run ~/petalinux-share/
|
1
2
3
4
5
| docker run -it \
--user petalinux \
--workdir /home/petalinux \
--name petalinux-2020.1 \
--volume ~/petalinux-share:/home/petalinux/petalinux-share petalinux-2020.1
|
Now we’ve created a new container called petalinux-2020.1 from petalinux-2020.1 image. If you are confused, just check the docker documentation :D.
1
2
3
| sudo mkdir -p /opt/petalinux/2020.1
sudo chown -R petalinux:petalinux /opt/petalinux/2020.1/
sudo chmod 775 /opt/petalinux/2020.1
|
1
2
| chmod +x ./petalinux-share/petalinux-v2020.1-final-installer.run
./petalinux-share/petalinux-v2020.1-final-installer.run -d /opt/petalinux/2020.1/
|
1
| echo 'source /opt/petalinux/2020.1/settings.sh' >> ~/.bashrc
|
Now we finish the installation. Just type exit multiple times to exit the container.
Launch Petalinux-2020.1 container
If you want to launch petalinux-2020.1 container, just type:
1
| docker start petalinux-2020.1
|
Now the container has started. You can type docker ps to check all active containers.
To enter the container in bash:
1
| docker exec -it petalinux-2020.1 /bin/bash
|
Just type the above exec command in another terminal, you will get another bash in the same container!