Difference between revisions of "Elphel Software Kit for Ubuntu"

From ElphelWiki
Jump to: navigation, search
(Install sources of Elphel camera)
(Installing Xilinx WebPack (to be moved to a separate page, just link here))
Line 168: Line 168:
 
  sudo exportfs -a
 
  sudo exportfs -a
  
== Installing Xilinx WebPack (to be moved to a separate page, just link here)==
+
== Installing Xilinx WebPack (to be moved to a separate page, just a link here)==
 
If you plan to compile the FPGA code from the source code you will need to install appropriate software from the FPGA manufacturer web site. This is proprietary (and non-free) software provided by [http://www.xilinx.com Xilinx] free of charge. This software is called the [http://www.xilinx.com/tools/webpack.htm ISE WebPACK] and you may download it (currently some 2.2GB) after registering at Xilinx web site. Currently tested version is 10.1.03, we'll try to update our code when Xilinx will release the new version of their software.
 
If you plan to compile the FPGA code from the source code you will need to install appropriate software from the FPGA manufacturer web site. This is proprietary (and non-free) software provided by [http://www.xilinx.com Xilinx] free of charge. This software is called the [http://www.xilinx.com/tools/webpack.htm ISE WebPACK] and you may download it (currently some 2.2GB) after registering at Xilinx web site. Currently tested version is 10.1.03, we'll try to update our code when Xilinx will release the new version of their software.
  

Revision as of 01:42, 24 May 2009

About

This page is a simple howto for running Elphel software on Ubuntu GNU/Linux.

Our software kit is tested on Ubuntu 8.04.1 and is starting to be tested with Ubuntu 8.10 (Intrepid)

You can download this GNU/Linux distribution freely from http://www.ubuntu.com/


If you are new to GNU / Linux

Many forums and wikis are available in many languages to help you to install and use Ubuntu. Ex: http://www.google.com/search?q=forum+ubuntu (you can add "&hl=fr" or any language code to the URL)

Most instructions below are commands that you need to enter in the in the terminal window. For the lines that do not end with "\" sign you just copy them one-by-one and paste in the terminal window (in KDE it is Konsole in the "System" menu). For pasting you can not use <cntrl-V> - you need to right-click in the terminal window and select "Paste" from the drop-down context menu. Alternatively you can use the middle mouse button to both copy (drag while middle mouse pressed) and paste - click it in the console window.

Character "\" at the end of the line means continuation, so you can copy the whole block of text where each line but the very last ends with "\" and paste them together.

Many of the commands start with "sudo" - first time system will ask you for your user password that you enter without any starts (provided you have administrative privileges).

If you get some problems it is very useful to copy the error message that system outputs (avoiding anything specific to your particular installation - like user directories names) and paste them into the search box of you browser.

User software

Some software need to be patched and recompiled even if they exist in Ubuntu software repositories, some softwares are not yet packaged in Ubuntu, so you have to compile them from sources also. We try to push our software patches to the mainstream applications, but it take time and is not always possible.


Mplayer

As for now MPlayer have to be patched and recompiled we document here the most simple way to do it on an Ubuntu or Debian based workstation.

First install some compilation dependencies, mainly libraries...


sudo apt-get install build-essential debhelper libncurses5-dev libesd0-dev liblircclient-dev libgtk2.0-dev \
libvorbis-dev libsdl1.2-dev sharutils libasound2-dev liblzo-dev gawk libjpeg62-dev libaudiofile-dev \
libsmbclient-dev libxv-dev libpng12-dev libgif-dev libcdparanoia-dev libxvidcore4-dev libdv4-dev \
liblivemedia-dev libfreetype6-dev em8300-headers libgl1-mesa-dev libdvdread-dev libdts-dev libtheora-dev \
libglu1-mesa-dev libfontconfig-dev libxxf86dga-dev libxinerama-dev libxxf86vm-dev \
libxvmc-dev libggi2-dev libmpcdec-dev libspeex-dev libfribidi-dev libfaac-dev  libaa1-dev libcaca-dev \
libx264-dev  libpulse-dev libmad0-dev ladspa-sdk libdbus-glib-1-dev libaudio-dev liblzo2-dev libdvdnav-dev \
libopenal-dev libjack-dev libtwolame-dev libsvga1-dev libenca-dev libmp3lame-dev


Current MPlayer code is capable of working with full resolution video produced by Elphel cameras. That is not yet true for the MPlayer packages in Ubuntu repositories, so you'll have to obtain the source code from MPlayer recommended source - their Subversion (SVN) source. First you need to install Subversion itself:

sudo apt-get install subversion

Now create a download directory and get MPlayer source:

mkdir download; cd download
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

Configure, compile and prepare Debian package from that source (will take some time):

cd mplayer
sudo dpkg  --install mplayer_1.0~rc2-0ubuntu*.deb

Now install the created package

cd ..
sudo dpkg  --install mplayer_1.0svn*.deb

You should be able now to play videos with up to 5MB frames (highest quality 5MPix images are around 1 MB) as a multicast or unicast video stream. (the streamer in the camera should be ENABLED)

mplayer rtsp://192.168.0.9:554 -vo x11 -fs -zoom

For developers

Adding universe and multiverse sources

Please follow this howto for adding universe and multiverse sources.

https://help.ubuntu.com/community/Repositories/Ubuntu

or

https://help.ubuntu.com/community/Repositories/Kubuntu

Install needed packages

Minimal packages:

sudo apt-get install cvs build-essential autoconf flex byacc bison libglib2.0-dev tcl gettext libncurses5-dev patch zlib1g-dev nfs-kernel-server bash xutils-dev

Suggested packages:

sudo apt-get install kinfocenter minicom firefox graphviz doxygen kdevelop ctags cervisia php5 php5-cli gecko-mediaplayer xchat ssh kompare # gecko-mediaplayer should be installed before mplayer as it installes the unpatched one

Download and install Cris-GCC compiler. It is needed to compile C and C++ programs for the CPU used in Elphel cameras - Axis ETRAX FS :

cd ~/download ; mkdir axis ; cd axis
wget http://www.axis.com/ftp/pub/axis/tools/cris/compiler-kit/cris-dist-linux-headers-1.64.tar.gz   
wget http://www.axis.com/ftp/pub/axis/tools/cris/compiler-kit/cris-dist-linux-headersv32-1.64.tar.gz  
wget http://www.axis.com/ftp/pub/axis/tools/cris/compiler-kit/cris-dist-glibc-1.64.tar.gz 
wget http://www.axis.com/ftp/pub/axis/tools/cris/compiler-kit/cris-dist-1.64.tar.gz
tar zxvf cris-dist-1.64.tar.gz
cd cris-dist-1.64/
tar zxvf ../cris-dist-linux-headers-1.64.tar.gz                                 
tar zxvf ../cris-dist-linux-headersv32-1.64.tar.gz                             
tar zxvf ../cris-dist-glibc-1.64.tar.gz

Unfortunately CRIS compiler does not compile with GCC 4.3.x and the only know working solution would be to temporary downgrade the compiler. You'll rather upgrade it back to the current one after gcc-cris is built:

sudo apt-get remove gcc

See what other packages are removed as being dependent on GCC. You may copy that list an re-install them later with "sudo apt-get install list of removed packages

sudo apt-get install gcc-4.2 g++-4.2 \
sudo ln -sf /usr/bin/gcc-4.2 /usr/bin/gcc \
sudo ln -sf /usr/bin/g++-4.2 /usr/bin/g++ \
sudo ln -sf /usr/bin/gcc-4.2 /usr/bin/cc

You may verify the current GCC version (make sure it is 4.2.x) with the following command:

gcc --version

Now you may proceed with compiling gcc-cris (takes some time):

sudo ./install-cris-tools

answer by default (enter, enter, ...)

If everything finished OK you may reinstall the GCC back (and add other packages you may have removed):

sudo apt-get install build-essential g++ gcc

Install Icarus Verilog and GTKWave

(If you plan to develop FPGA code or at least look how it works)

GTKWave is OK from repository:

sudo apt-get install gtkwave

But unfortunately Icarus Verilog (package verilog) is compiled without needed support for compressed output format, so you'll have to compile it

wget "ftp://ftp.icarus.com/pub/eda/verilog/snapshots/verilog-20081118.tar.gz"
tar zxvf verilog-20081118.tar.gz
cd verilog-20081118/
./configure
make
sudo make install

Configure your NFS server

Let's say you want to configure an NFS server on your machine and your IP address is 192.168.0.15.

Modify the configuration file:

kdesudo kate /etc/exports

Add at the end of the file:

/nfs            192.168.0.0/255.255.0.0(rw,sync,no_root_squash)

save the file.

If it does not yet exist make /nfs directory and make it world writable to make it possible to write logs from the camera.

sudo mkdir /nfs
sudo chmod 777 -R /nfs

And finally export the filesystem.

sudo exportfs -a

Installing Xilinx WebPack (to be moved to a separate page, just a link here)

If you plan to compile the FPGA code from the source code you will need to install appropriate software from the FPGA manufacturer web site. This is proprietary (and non-free) software provided by Xilinx free of charge. This software is called the ISE WebPACK and you may download it (currently some 2.2GB) after registering at Xilinx web site. Currently tested version is 10.1.03, we'll try to update our code when Xilinx will release the new version of their software.

You will also need that software if you would like to simulate the FPGA functionality. Elphel camera FPGA code (written in Verilog HDL) is licensed under GNU GPLv3, simulator and waveform viewer (see below) are also Free Software, but there are a few Verilog models of some primitives of Xilinx FPGA that are not and can be only obtained from Xilinx as a part of their unisims library. For simulation we use small subset of the unisims library components and only for functional simulation so it will probably make sense to re-write those primitives models so the 2.2 GB distribution will not be needed to extract just few kilobytes of required source code.

Such independent re-implementation will help us to solve another problem - we have to patch the Xilinx library components to make them work correctly with our code and the simulator we use and currently each Xilinx library update breaks our patches

This command line detects if you are running on 64 bit version of GNU/Linux and conditionally installs ia64-libs. That library is needed if you'll install Xilinx WebPack software (Xilinx does not allow to use 64-bit programs in their free for download software and the provided installation script does not install 32-bit version on its own). There is another trick you'll need to be aware of if you are using 32-bit Xilinx WebPack on a 64-bit GNU/Linux system.

if [ `uname -m` = "x86_64" ] ; then sudo apt-get install ia32-libs ; fi

Install sources of Elphel camera

CVS

Get elphel353_80_install_from_cvs.sh open archive that contains the shell script and execute it. It is recommended that you create subdirectory in your home directory, i.e. "elphel_projects", move and execute elphel353_80_install_from_cvs.sh script there. Directory "distfiles" will be created there and used as a cache for software archives that will be downloaded during installation.

Release

http://sourceforge.net/projects/elphel

  • get one of the elphel353-7.1 or elphel353-8.0 releases
  • decompress the archive
  • execute the ./install_elphel script
./install_elphel


In Ubuntu 8.10 there can be an error like (update - solved with installation xutils-dev for 'makedep' utility at 8.10):

*** No rule to make target `../../include/openssl/idea.h', needed by `hmac.o'.

The solution is to create a link:

cd /cvs_sync/elphel353-7.1.8/elphel353-7.1/apps/crypto/openssl-IR0_9_7f-3/openssl/include/openssl
ln -s ../../crypto/idea/idea.h

Elphel SDK

We provide our clients with a complete SDK to develop software, FPGA code and even to redesign the hardware.

PHP

KDevelop IDE

FPGA Development in Elphel cameras

EeeBox (K)Ubuntu 8.10 installation

ACPI configuration

EeeBox will suspend and freeze after some time w/o any activity on it, so it's better to turn off suspend. Run this script at this new folder with root privileges (for example, put text to go file, make that file executable chmod a+x go, and run with sudo sudo ./go):

 #!/bin/sh
 
 # patch ACPI config to turn off suspend
 
 patch -N /etc/default/acpi-support << 'EOP'
 --- a   2008-12-31 00:40:41.000000000 +0200
 +++ acpi-support        2008-12-31 00:40:08.000000000 +0200
 @@ -56,7 +56,7 @@
  # Please specify a space separated list of options. The recommended value is
  # "dbus pm-utils"
  #
 -SUSPEND_METHODS="dbus-pm dbus-hal pm-utils"
 +SUSPEND_METHODS=""
 
 
 
 @@ -69,10 +69,10 @@
  #
 
  # Comment the next line to disable ACPI suspend to RAM
 -ACPI_SLEEP=true
 +#ACPI_SLEEP=true
 
  # Comment the next line to disable suspend to disk
 -ACPI_HIBERNATE=true
 +#ACPI_HIBERNATE=true
 
  # Change the following to "standby" to use ACPI S1 sleep, rather than S3.
  # This will save less power, but may work on more machines
 EOP
 
 # and apply changes
 /etc/init.d/acpi-support restart
 /etc/init.d/acpid restart

Network configuration

Please, someone, have a look how to configure network at Kubuntu 8.10 - I have bad luck with that. The main idea is: setup WiFi for internet, and local interface for local network to work with camera. Possible problem: Oleg told me what with POE adapter, not POE switch (as I do) local network will not work - network manager shut down eth0 every time when contact is lost, for example, when cable disconnected from the camera for reflash with button (this used with prod353 system).

GCC-CRIS cross-compiler installation

Make a directory where you will build cross-compiler and store sources of it, and run this script at this new folder with root privileges (for example, put text to go file, make that file executable chmod a+x go, and run with sudo sudo ./go):

 #!/bin/sh
 
 # install packages to build cross-compiler
 apt-get install build-essential gcc-4.2 g++-4.2 xutils-dev libncurses5-dev autoconf automake byacc bison zlib1g-dev patch cvs gettext
 
 # create links to GCC-4.2
 rm /usr/bin/gcc
 rm /usr/bin/g++
 ln -s /usr/bin/gcc-4.2 /usr/bin/gcc
 ln -s /usr/bin/g++-4.2 /usr/bin/g++
 
 # download sources - if links are broken, check developer.axis.com
 wget -c http://www.axis.com/ftp/pub/axis/tools/cris/compiler-kit/old/cris-dist-1.64.tar.gz
 wget -c http://www.axis.com/ftp/pub/axis/tools/cris/compiler-kit/old/cris-dist-glibc-1.64.tar.gz
 wget -c http://www.axis.com/ftp/pub/axis/tools/cris/compiler-kit/old/cris-dist-linux-headers-1.64.tar.gz
 wget -c http://www.axis.com/ftp/pub/axis/tools/cris/compiler-kit/old/cris-dist-linux-headersv32-1.64.tar.gz
 
 # unarch that
 tar -xvf cris-dist-1.64.tar.gz
 cd cris-dist-1.64
 cp ../cris-dist-glibc-1.64.tar.gz ./
 tar -xvf cris-dist-glibc-1.64.tar.gz
 cp ../cris-dist-linux-* ./
 tar -xvf cris-dist-linux-headers-1.64.tar.gz
 tar -xvf cris-dist-linux-headersv32-1.64.tar.gz
 
 # build and install - agree with all questions, at the finish also
 ./install-cris-tools
 
 # delete build directory - we don't need it anymore
 cd ..
 rm -R cris-dist-1.64
 
 # restore host GCC links - out of the box, Ubuntu 8.10 use GCC-4.3 as default
 rm /usr/bin/gcc
 rm /usr/bin/g++
 ln -s /usr/bin/gcc-4.3 /usr/bin/gcc
 ln -s /usr/bin/g++-4.3 /usr/bin/g++
 
 # it's all, cross-compiler was installed; but while we still root, install packages needed to build firmware here
 apt-get install libglib2.0-dev pkg-config flex gettext tcl8.5

NFS installation and configuration

Before firmware build, we should install and configure NFS, because firmware build process will put firmware images in to it for remote (and local) camera reflashing.

 sudo apt-get install nfs-kernel-server
 sudo mkdir /nfs
 # mkdir /nfs/elphel353-2.10 # not used in 8.0
 sudo chmod -R a+r /nfs
 sudo chmod -R a+w /nfs
 sudo echo "/nfs 192.168.0.0/24(rw,async)" >> /etc/exports
 sudo /etc/init.d/nfs-kernel-server restart

build firmware

other steps

...to be continued - network setup, Firefox,KDeveloper,MPlayer installation...