Firstly, we will to the Xilinx Downloads page to obtain the installer. Select version 2017.2 on the left sidebar. Choose “PetaLinux 2017.2 Installer”. It is a single-file executable that is 7.54GB large.
Note: you have to be a registered user to download it.
Installation
Firstly we need enable i386 architecture (if running Ubuntu x64):
sudo dpkg --add-architecture i386
Before you proceed, make sure all the prerequisites are satisfied:
sudo apt install chrpath socat texinfo gcc-multilib libsdl1.2-dev xinetd tofrodos iproute \
gawk gcc git-core make net-tools ncurses-dev libncurses5-dev zlib1g-dev flex bison lib32z1 \
lib32ncurses5 lib32stdc++6 libselinux1 xvfb autoconf libtool libbz2-1.0 xinetd tftpd tftp \
lib32stdc++6 libgtk2.0-0:i386 libfontconfig1:i386 libx11-6:i386 libxext6:i386 libxrender1:i386 libsm6:i386 libssl-dev
libqtgui4:i386
for a successful installation, we need to configure tftp
sudo nano /etc/xinetd.d/tftp
service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /tftpboot
disable = no
}
Create a directory /tftpboot
(this should match whatever you gave in server_args.)
sudo mkdir /tftpboot
sudo chmod -R 777 /tftpboot
sudo chown -R nobody /tftpboot
Restart tftp service
sudo /etc/init.d/xinetd stop
sudo /etc/init.d/xinetd start
Change /bin/sh
to bash
sudo dpkg-reconfigure dash
# --> Select Yes
Now install PetaLinux into the directory/opt/petaLinux
. The installer is a shell script that runs in the terminal.
chmod a+x petalinux-v2017.2-final-installer.run
export PETADIR=$HOME/.opt/petalinux
sudo mkdir -p $PETADIR
sudo chown $USER:$USER -R $PETADIR
./petalinux-v2017.2-final-installer.run $PETADIR
Press 'ENTER' to see the licenses, q to quit reading the licenses, and y + ENTER to accept the licenses. The installation should last for about 15-30 mins.
Every time you want to use PetaLinux tools, remember to source the “settings” script to have the right environment variables:
source $HOME/.opt/petalinux/settings.sh
Creating your first project [Board Support Package]
The following is a super simple walk-through of how to use PetaLinux tools.
Once you have the BSP of your choosing downloaded (and extracted if it was a zip file), go to your terminal and change directory to where you would like to create your new PetaLinux project directory and enter the following command.
In my case it would be:
$ cd $HOME/Documents/Xilinx/EmbeddedLinux/Petalinux/Projects
Then run the petalinux-create command on terminal:
$ petalinux-create -t project -s avnet-digilent-zedboard-v2017.2-final.bsp
Rebuilding the reference design system
In order to rebuild the system run petalinux-build
$ petalinux-build -v
This step usually takes 15-30min depending on the performance of your system, the step generated a device tree 'DTB' file, the FSBL(First Stage Bootloader), U-Boot, Linux Kernel and the root file-system images
After the build is complete you can test it in a simulated environment.
Pre-built Petalinux image test with QEMU
Petalinux provide QEMU support to enable testing the image-built in a simulated environment.
$ petalinux-boot --qemu --prebuilt 3
# The --qemu option test petalinux-boot to boot in QEMU instead of real hardware,
# and --prebuilt 3 boots the pre-built linux kernel