Close

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.

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

/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.

  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
Advertisements

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}; 
done
  1. write this script to a file named mvByDate.sh in your old directory.
  2. replace the /your/new/directory with your new directory’s path
  3. make this file executable with chmod +x mvByDate.sh
  4. then execute this file by ./mvByDate.sh
  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
/home/user/media   192.168.1.0/24(rw,async,insecure,no_subtree_check,nohide)

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

Mounts

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 192.168.1.42:/home/music /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

Conclusion
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

wget https://pypi.python.org/packages/source/S/SimpleGUICS2Pygame/SimpleGUICS2Pygame-01.07.00.tar.gz
tar xzvf SimpleGUICS2Pygame-01.07.00.tar.gz
sudo python setup.py 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)
frame.set_draw_handler(draw)

# Start the frame animation
frame.start()

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

Installing Latex on Ubuntu

Latex is a document markup language for the Tex typesetting program. Due to its high quality typesetting capability, {\LaTeX}/TeX system is popularly used in academia and research communities to prepare professional looking documentations and research papers.

    To install/upgrade to TeX Live 2014:

    Open a terminal with Ctrl+Alt+T

    Add the texlive-backports PPA by typing the below (enter your password when prompted):

    $ sudo add-apt-repository ppa:texlive-backports/ppa 
    $ sudo apt-get update 
    

    Installation: If you are installing TeX Live for the first time,
    type:

     
    $ sudo apt-get install texlive
    $ sudo apt-get install --no-install-recommends texlive-latex-extra
    $ sudo apt-get install --no-install-recommends texlive-fonts-extra
    

    If you already have TeX Live installed and are upgrading, type: sudo apt-get upgrade Warning: this will also upgrade all other packages on your Ubuntu system for which upgrades are available. If you do not wish to do this,
    please use the previous:

    $ sudo apt-get install texlive-base
    
Back to top