Zedboard – Setting up a ARM development environment in Linux

Well now that you have your Zedboard up and running with Petalinux installed, and your network is configured to talk to the outside world, let’s get some code running on this thing!

First some environmental comments. I am a big fan of Xubuntu. I like it’s feel and it’s ease of use when it comes to installing packages using the apt-get command. I will be writing just about all of these blog posts using Xubuntu as my host OS.

I have installed on a development box Xubuntu 16.04 LTS. The only thing I selected during the install was to install OpenSSH so I could actually interface to the thing. We are going to install just a single additional package to allow us to compile ARM code, and it’s going to be really really simple to do!

Open up a command terminal on the local machine

In the event that you do not have SSH installed and would like it installed then here is the command:
# sudo apt-get install update
# sudo apt-get install openssh-server openssh-client

Now that you are at the prompt either on your local machine or via SSH, we can install the arm gcc tools:

$ sudo apt-get install gcc-arm-linux-gnueabi

Once the package is installed, you now have the ability to compile applications for your Zedboard!

That simple!!!

I am going to go to my home directory and create a folder to do some development in, and then compile a hello world application:

mmphego@4n0m4ly:~$ cd
mmphego@4n0m4ly:~$ mkdir arm-devel
mmphego@4n0m4ly:~$ cd arm-devel/
mmphego@4n0m4ly:~/arm-devel$ touch helloworld.c
mmphego@4n0m4ly:~/arm-devel$ cat > helloworld.c
int main(){
printf("Hello World!\n");
return 0;

So we have our source file, now we need to compile it. The application we will use is arm-linux-gnueabi-gcc.

$ arm-linux-gnueabi-gcc -o helloworld helloworld.c

Ok, so now we have our application written and compiled. But now what? We can’t run it on our development box because it isn’t ARM based. So we need to get it over to our Zedboard. The Zedboard conveniently ships with a SCP running on it! So all we need to do is connect to our Zedboard and drop our file there.

$ scp helloworld root@

On Zedboard:

Cool. So now our our Zedboard in the /home directory we have a file called helloworld. We need to change it’s properties so our shell knows it can be executed. To do this we will use chmod:
$ ssh root@
$ root@avnet-digilent-zedboard-2017_2:~# chmod +x SMV_Pub_Zedboard

You will notice that the helloworld app now has the ability to be executed. Well, what are you waiting for!? let’s do it!

root@avnet-digilent-zedboard-2017_2:~# ./helloworld
Hello World!

Woohoo! How cool is that!?. So now, you are well on your way to application development for the ARM cores running within the Zynq-7000 on you Zedboard.


Configure IPython5 to have IPython3’s readline, tab-completion, (lack-of) syntax highlighting, etc? (self.IPython)

Start by creating a default iPython profile. From your shell, type:

$ ipython profile create

That should give output similar to this:

[ProfileCreate] Generating default config file: u'/home/mmphego/.ipython/profile_default/'
[ProfileCreate] Generating default config file: u'/home/mmphego/.ipython/profile_default/'

Open the newly created file with your favorite text editor, in the above example shown as:

vim /home/mmphego/.ipython/profile_default/

Add the following lines at the bottom:

c.TerminalInteractiveShell.display_completions = 'readlinelike'

Save the file.





Xilinx PetaLinux 2017.2 installation on Ubuntu 16.04.3

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.


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 \

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

/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
export PETADIR=$HOME/.opt/petalinux
sudo mkdir -p $PETADIR
sudo chown $USER:$USER -R $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/

Creating your first project [Board Support Package]

The following is a super simple walk-through of how to use PetaLinux tools.

  1. To create a PetaLinux project with a specific BSP, In my case Zedboard

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 <span 				data-mce-type="bookmark" 				id="mce_SELREST_start" 				data-mce-style="overflow:hidden;line-height:0" 				style="overflow:hidden;line-height:0" 			></span>linux kernel

Move files by date into different directory using CLI

A while back I was unfortunate in such a way that my HDD that I primarily use as photo archive started having mechanical issues, and before It died on my arms I had the opportunity to backup most of my pictures, however most of them were truncated and had to be discarded and the ones I could recover their filenames where overwritten with random filenames and ascii codes.

For over a while I have neglected my pictures and they just piled up in a single and nameless directory, until I took it against myself to clean them up.

And one of the benefits of using Linux OS is the scripting features.

for i in *; 
do d=$(exiftool $i | grep 'Date/Time Original' | cut -f 17 -d ' '); 
newd=`echo ${d//:/-}`; 
echo $i ${newd} ;
mkdir -p ${newd}; 
mv -- ${i} ${newd}; 
  1. write this script to a file named in your old directory.
  2. replace the /your/new/directory with your new directory’s path
  3. make this file executable with chmod +x
  4. then execute this file by ./
  5. voila

Install and configure NFS server on Ubuntu for serving files

When it comes to serving media content within your local network, a NFS share is way better than Samba/CIFS share in terms of speed and resource usage. If you have a XBMC box to watch TV shows and movies from a central server then a Network File System (NFS) share should be the choice for a media source. It only takes a few minutes to install and configure NFS server in Ubuntu, and it is a must have item on my server.

Setup NFS Server on Ubuntu

If you do not have NFS yet, you will have to install NFS server first using the following commands:

sudo apt-get install nfs-kernel-server

That’s the easiest part. It requires just bit more effort to configure NFS server to share files with right permissions.

Configure NFS Server

After installation you can configure NFS server by editing the /etc/exports file. First make a backup copy of the default NFS configuration file:

sudo cp -a /etc/exports /etc/exports.backup

Then open the /etc/exports file using the following command:

sudo nano /etc/exports

Edit and comment out all existing lines by adding a “#” in front the line. Next, setup NFS share for each folder you want to make available to the client devices as shown below.

Setup NFS Share for Media

One of the primary purposes I configure NFS server on Ubuntu server is to share my media to all my Xbian Raspberry Pi HTPC. As I said before, for sharing within a network the performance of NFS is better than SAMBA. If you a media folder on your central Ubuntu server, then add the following line to line to /etc/exports to setup NFS share for it.

#Export media to all IP address under 192.168.1.X

This will make your media folder located under /home/user available to every device in your local network. The options within parenthesis are specifically chosen to improve performance. We are sharing “non-critical” media files and we are making them available only to devices in your home network (192.168.1.X). So we can afford to go lower on security to improve speed and performance.

rw – allows read/write if you want to be able to delete or rename files from XBMC or other devices. On XBMC you write permission to download subtitles.
async – Increases read/write performance. Only to be used for non-critical files.
insecure – Does not mean the files are insecure but rather this setting allow clients (eg. Mac OS X) to use non-reserved ports connect to a NFS server.
no_subtree_check – Improves speed and reliability by eliminating permission checks on parent directories.
nohide – This option allows the client device to see multiple file systems but only works on one host. Since this is rare, you may choose to omit this option as it can potentially cause problems in some cases.

Starting, Stopping, and Restarting NFS Server

Once you have setup NFS server, you can start NFS share using the following command:

sudo exportfs -ra

Any time you make changes to /etc/exports I recommend that you restart your NFS server using the following command:

sudo service nfs-kernel-server restart

On your XBMC just choose Network Filesystem (NFS) when you select the source. Note that NFS does not work on Windows clients but they should work on all Linux-based OSes that run XBMC. For Windows, you will still have to Setup Samba as the file server.

Setup NFS Client on Ubuntu

If you would like to connect to the NFS server on your local computer running Linux – prefferably Ubuntu, Do the following:

sudo apt-get install nfs-common


Check to see if everything works
You should try and mount it now. The basic template you will use is:

sudo mount ServerIP:/folder/already/setup/to/be/shared /home/username/folder/in/your/local/computer

so for example:

sudo mount /home/nerd/music

Mount at startup

Add the following lines in your fstab to mount NFS directories automatically after system reboot.

sudo nano /etc/fstab

This will mount directories on start up after the server reboots.

Server_IP:/home/music /home/nerd/music  /mnt/music   nfs   auto,noatime,nolock,bg,nfsvers=3,intr,tcp,actimeo=1800 0 0

NFS provides a quick and easy way to access remote systems over a network. However, the protocol itself is not encrypted. If you are using this in a production environment, consider routing NFS over SSH or a VPN connection to create a more secure experience.

setting up python-simplegui library

CodeSkulptor is a web-based python compiler/interpreter, That I have been using for the Interactive Python course offered on Coursera .
And being were I am now, which is in Marion Island – our internet can be so slow at times so I resulted on running my python codes on my local machine not needing to go to CodeSkulptor.

I had troubles importing simplegui library, So after vigorous google searches I finally found a way to run codes needing simplegui library

1. Install

 sudo apt-get install python-dev ipython python-numpy python-matplotlib python-scipy python-pygame python-pip python.h python-setuptools

2. Download and install

tar xzvf SimpleGUICS2Pygame-01.07.00.tar.gz
sudo python install

3. run python on CLI

import SimpleGUICS2Pygame.simpleguics2pygame as simplegui

then test it.

import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
message = "Welcome!"

# Handler for mouse click
def click():
global message
message = "Good job!"

# Handler to draw on canvas
def draw(canvas):
canvas.draw_text(message, [50,112], 48, "Red")

# Create a frame and assign callbacks to event handlers
frame = simplegui.create_frame("Home", 300, 200)
frame.add_button("Click me", click)

# Start the frame animation

How to install Gummi(LaTex) on ubuntu

How to install Gummi on ubuntu
This post is trivial since Gummi has recently released an PPA (Personal Package Archive) for Ubuntu.
btw, there are only 3 commands needed to get Gummi up and running:
1- First, add the PPA to your repository:
$sudo add-apt-repository ppa:gummi/gummi

2- Then, update your repository to reflect the new changes:
$sudo apt-get update

3- Everything is now ready to install Gummi:
$sudo apt-get install gummi

Back to top