Initial VPS setup

27 November, 2008

Initial VPS setup

    - Add normal user account
        - adduser <username>
        - Generate ssh keys
            - ssh-keygen
        - Add other ssh keys to ~/.ssh/authorized_keys
            - change permissions chmod go-rw authorized_keys
    - Disable root login
        - /etc/ssh/sshd_config
            - PermitRootLogin no
    - Add the bzr ppa to /etc/apt/sources.list
        - #bzr
        - deb http://ppa.launchpad.net/bzr/ubuntu hardy main
        - deb-src http://ppa.launchpad.net/bzr/ubuntu hardy main
    - In order to install the latest and greatest bzr 1.9 at the time of writing the updates repo needs to be added also.
        - deb http://archive.ubuntu.com/ubuntu hardy-updates main
    - Install bzr
        - mkdir vc
        - cd vc
        - bzr init-repo bzr
    - To give bzr a little more room to breath create another swapfile and activate it
        - dd if=/dev/zero of=/swapfile bs=1024 count=196608
        - mkswap /swapfile
        - swapon /swapfile
        - Add the following to the fstab file so that the swapfile will be available after a reboot
            - /swapfile       none           swap     sw                         0 0            
    - Fix the locale problem (i386)
        - apt-get install language-pack-en
    - Edit the sudoers file by adding the following line
        - <username> ALL=(ALL) ALL


Building Liquid State Machine on Centos 4 64-bit

12 November, 2008

download the lsm toolbox from here:

unpack it to your working directory

Before trying to build the lsm toolbox you need to check that you have access to the gcc4 compiler from within your working environment, you can check this by:

$gcc -v

Which should return something similar to this

Using built-in specs.

Target: x86_64-redhat-linux

Configured with: ../configure –prefix=/usr –mandir=/usr/share/man –infodir=/usr/share/info –enable-shared –enable-threads=posix –enable-checking=release –with-system-zlib –enable-__cxa_atexit –disable-libunwind-exceptions –with-gxx-include-dir=/usr/include/c++/3.4.3 –enable-libgcj-multifile –enable-languages=c,c++,java,f95 –enable-java-awt=gtk –disable-dssi –with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre –with-cpu=generic –host=x86_64-redhat-linux

Thread model: posix

gcc version 4.1.2 20070626 (Red Hat 4.1.2-14)

Should you not have the gcc4 complier installed you need to install the package gcc4-4.1.2-14.EL4 and usually create a sim link in your ~/bin folder to ensure that the version 4 compiler will be picked up first.

cd ~/bin
ln -s /usr/bin/gcc4 gcc
export PATH=/home/<username>/bin:$PATH

Now that the build environment is sorted out its onto the actual process of building the lsm toolbox. So, edit the Makefile in lsm/csim/src change the default build rule to

default: version.i filepermissions csim.mexga64 install.m

The default build rule should be around line 135 in the Makefile. Depending on where matlab is installed the file paths which are hardcoded in the build file may need to be changed. In this example using the vim regular_expression to change the path from /usr/local/matlab to /opt/matlab/ins

:%s/\/usr\/local\/matlab/\/opt\/matlab\/ins/g

Now move to the csim directory and run the make command as normal.

Should an error similiar to the quote below occur,

Invalid MEX-file ‘/home/<username>/<working directory>/lsm/csim/csim.mexa64′: /opt/matlab_sp3_64/ins/bin/glnxa64/../../sys/os/glnxa64/libgcc_s.so.1: version `GCC_4.2.0′ not found (required by /usr/lib64/libstdc++.so.6).

The solution to seems to be to move the libgcc_s.so.1 file out of the way so that matlab will use the system one first. The file can be moved via the normal unix command ‘mv’ as shown below.

mv libgcc_s.so.1 libgcc_s.so.1.orig


Book Meme

11 November, 2008

Jumping on the meme train:

“HeadFirst: Does that mean you can refer to only one dog” Head First Java

  1. Grab the nearest book.
  2. Open it to page 56.
  3. Find the fifth sentence.
  4. Post the text of the sentence in your journal along with these instructions.
  5. Don’t dig for your favourite book, the cool book, or the intellectual one: pick the CLOSEST.

Building bzr on RHEL AS 4

13 September, 2008

In order to use the bzr distributed version control system on Redhat Enterprise Linux 4 (RHEL) you first have to build python 2.4+ (and some additional modules) as RHEL shipped with 2.3.* of python which isn’t supported by bzr. In this article I will be building python 2.4.5 and the addional modules required for bzr 1.6.1 into a folder in my home directory so as not upset any of the applications that rely on the RHEL supported version of python. So lets get started;

First get python 2.4.5 using wget as the downloader

patrickd tmp $ wget -c http://www.python.org/ftp/python/2.4.5/Python-2.4.5.tar.bz2

Now lets use tar to decompress it.

patrickd tmp $ tar xfjv Python-2.4.5.tar.bz2

Python-2.4.5/
Python-2.4.5/Include/
Python-2.4.5/Include/pymem.h
Python-2.4.5/Include/compile.h
Python-2.4.5/Include/pgenheaders.h
Python-2.4.5/Include/complexobject.h
Python-2.4.5/Include/objimpl.h
Python-2.4.5/Include/setobject.h
Python-2.4.5/Include/enumobject.h
[  ................  ]

Enter the directory that tar just decompressed it to and configure it, so that it will be installed into the directory ‘/home/patrickd/apps/python’

patrickd Python-2.4.5 $ cd Python-2.4.5

patrickd Python-2.4.5 $ ./configure –prefix=/home/patrickd/apps/python

checking MACHDEP… linux2
checking EXTRAPLATDIR…
checking for –without-gcc… no

[ ......... ]

creating Setup
creating Setup.local
creating Makefile

Once, python is configured. It is time to build it using the ‘make’ command, then create the directory that we intend to install python to and then finally install python into the preconfigured directory.

patrickd Python-2.4.5 $ mkdir -p /home/patrickd/apps/python

patrickd Python-2.4.5 $ make

[  ......  ]

patrickd Python-2.4.5 $ make install

[ ......  ]

After python has been installed, it now time to setup some environment variables. That will enable the new 2.4 version of python to be used as the default python rather than the redhat compilied version of python.

patrickd Python-2.4.5 $ export PATH=$HOME/apps/python/bin:$PATH

patrickd Python-2.4.5 $ export PYTHONPATH=/home/patrickd/apps/python/lib/python;

Check to make sure that the environment variables are correctly set by calling python and checking the version number.

patrickd Python-2.4.5 $ python -V
Python 2.4.5

Now we need to get some additional python modules that are used by bzr.

patrickd tmp $ wget http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/Pyrex-0.9.8.5.tar.gz

patrickd tmp $ wget http://effbot.org/media/downloads/cElementTree-1.0.5-20051216.tar.gz

patrickd tmp $ wget http://www.lag.net/paramiko/download/paramiko-1.7.4.tar.gz

As before decompress them,

patrickd tmp $ tar xfzv Pyrex-0.9.8.5.tar.gz

patrickd tmp $ tar xfzv cElementTree-1.0.5-20051216.tar.gz

patrickd tmp $ tar xfzv paramiko-1.7.4.tar.gz

Now build and install each of them in turn.

patrickd tmp $ cd Pyrex-0.9.8.5/

patrickd Pyrex-0.9.8.5 $ python setup.py install

patrickd Pyrex-0.9.8.5 $ cd ..

patrickd tmp $ cd cElementTree-1.0.5-20051216/

patrickd cElementTree-1.0.5-20051216 $ python setup.py install

[ ............ ]

patrickd cElementTree-1.0.5-20051216 $ cd ..

patrickd tmp $ cd paramiko-1.7.4/

patrickd paramiko-1.7.4 $ python setup.py install

[ ......... ]

patrickd paramiko-1.7.4 $ cd ..

Finally its time to get the bzr source code and install it into the new 2.4.5 python installation.

patrickd tmp $ wget https://launchpadlibrarian.net/17315400/bzr-1.6.1.tar.gz

patrickd tmp $ tar xfzv bzr-1.6.1.tar.gz

patrickd tmp $ cd bzr-1.6.1

patrickd bzr-1.6.1 $ python setup.py install –home /home/patrickd/apps/python/

patrickd bzr-1.6.1 $ cd ~

After building and installing bzr its now time to check that bzr is correctly installed.

patrickd ~ $ bzr version
Bazaar (bzr) 1.6.1
Python interpreter: /home/patrickd/apps/python/bin/python 2.4.5
Python standard library: /home/patrickd/apps/python/lib/python2.4
bzrlib: /home/patrickd/apps/python/lib/python/bzrlib
Bazaar configuration: /home/patrickd/.bazaar
Bazaar log file: /home/patrickd/.bzr.log

Copyright 2005, 2006, 2007, 2008 Canonical Ltd.
http://bazaar-vcs.org/

bzr comes with ABSOLUTELY NO WARRANTY.  bzr is free software, and
you may use, modify and redistribute it under the terms of the GNU
General Public License version 2 or later.

Now that you have finished installing bzr, I would suggest your next point of call should be bzr user guide and then the main bzr documentation page.


Booting problem after upgrading to ubuntu hardy (8.04)

28 May, 2008

I’ve been running 8.04 beta for a while now, with kernel 2.6.22-14 the system boots and runs just fine. However, with the recent updates to the kernel 2.6.24-15 and then to 2.6.24-16 the system fails to boot and “hangs” at the “loading” screen with the blue progress bar just moving back and forward. In the trimmed menu.lst only the last option boots.

patrickd@ubuntu:/media$ lsb_release -rd
Description: Ubuntu 8.04
Release: 8.04

===File:/boot/grub/menu.lst===
title Ubuntu 8.04, kernel 2.6.24-16-generic
root (hd0,5)
kernel /boot/vmlinuz-2.6.24-16-generic root=UUID=761e8f2c-dd8d-4042-a5bb-2ead0c26c54e ro quiet splash
initrd /boot/initrd.img-2.6.24-16-generic
quiet

title Ubuntu 8.04, kernel 2.6.24-15-generic
root (hd0,5)
kernel /boot/vmlinuz-2.6.24-15-generic root=UUID=761e8f2c-dd8d-4042-a5bb-2ead0c26c54e ro quiet splash
initrd /boot/initrd.img-2.6.24-15-generic
quiet

title Ubuntu 8.04, kernel 2.6.22-14-generic
root (hd0,5)
kernel /boot/vmlinuz-2.6.22-14-generic root=UUID=761e8f2c-dd8d-4042-a5bb-2ead0c26c54e ro quiet splash
initrd /boot/initrd.img-2.6.22-14-generic
quiet

After some back and forth with the ubuntu developers it using this bug report on launchpad, It appeared that the newer versions of the kernel where unable to mount my root partition. Then after some digging about in one of my old note books I discovered that I’d come across the same problem with another distro and at the time the solution was to add “pci=nomsi” to the kernel boot options and thankfully that seemed to have solved the problem this time to.

This workaround enabled my system to boot with the ubuntu 2.4.26-16-generic kernel.

patrickd@ubuntu:~$ uname -a
Linux ubuntu 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686 GNU/Linux

The workaround for me was to add “pci=nomsi” to the kernel boot options, so the entry in fstab now looks like;

kernel /boot/vmlinuz-2.6.24-16-generic root=UUID=761e8f2c-dd8d-4042-a5bb-2ead0c26c54e ro quiet pci=nomsi splash


Pingus and Pulseaudio on Hardy

30 April, 2008

After installing pingus on ubuntu hardy (8.04) I discovered that the sound only worked when no other applications where using the sound card, which is a bit of a pain. When trying to start pingus from a gnome terminal the following message appeared;

patrickd@battlestar:~$ pingus
Welcome to Pingus 0.7.2!
========================
data path: /usr/games/../share/games/pingus/data/
language: English (en)
font encoding: iso-8859-1
sound support: enabled
music support: enabled
resolution: 800×600
fullscreen: disabled

Unable to initialize SDL_Mixer: No available audio device
Pingus: Unknown throw caught!

The interesting thing about this error is that it doesn’t appear to be pingus specific instead a generic SDL type problem. So, once again after some googling the solution that I came up with is shown below, I had tried a couple of other ones like “$ padsp pingus”, padsp appears to be a wrapper for pulseaudio (which is the default backend for hardy) and “export SDL_AUDIODRIVER=esd et” but this didn’t work either. I even found a post which suggested using “export SDL_AUDIODRIVER=pulse” but again this didn’t work for me. In the end I installed the pulseaudio “driver” for libsdl kind of obvious when you think about it :) ;

patrickd@battlestar:~$ apt-cache search libsdl | grep sdl
libsdl-image1.2 – image loading library for Simple DirectMedia Layer 1.2
libsdl-image1.2-dev – development files for SDL 1.2 image loading libray
libsdl-mixer1.2 – mixer library for Simple DirectMedia Layer 1.2
libsdl-mixer1.2-dev – development files for SDL1.2 mixer library
libsdl-pango-dev – text rendering with Pango in SDL applications (development)
libsdl-pango1 – text rendering with Pango in SDL applications (shared library)
libsdl-ttf2.0-0 – ttf library for Simple DirectMedia Layer with FreeType 2 support
libsdl-ttf2.0-dev – development files for SDL ttf library (version 2.0)
libsdl1.2-dev – Simple DirectMedia Layer development files
libsdl1.2debian – Simple DirectMedia Layer
libsdl1.2debian-all – Simple DirectMedia Layer (with all available options)
libsdl1.2debian-alsa – Simple DirectMedia Layer (with X11 and ALSA options)
libsdl1.2debian-esd – Simple DirectMedia Layer (with X11 and esound options)
libsdl1.2debian-oss – Simple DirectMedia Layer (with X11 and OSS options)
libsdl-console – console that can be added to any SDL application
libsdl-console-dev – development files for libsdl-console
libsdl-erlang – Erlang bindings to the Simple Direct Media Library
libsdl-gfx1.2-4 – drawing and graphical effects extension for SDL
libsdl-gfx1.2-dev – development files for SDL_gfx
libsdl-net1.2 – network library for Simple DirectMedia Layer
libsdl-net1.2-dev – Development files for SDL network library
libsdl-ocaml – OCaml bindings for SDL – runtime files
libsdl-ocaml-dev – OCaml bindings for SDL – development files
libsdl-perl – SDL bindings for the Perl language
libsdl-ruby1.8 – Ruby/SDL interface for Ruby
libsdl-sge – extension of graphic functions for the SDL multimedia library
libsdl-sge-dev – development files for libsdl-sge
libsdl-sound1.2 – Decoder of several sound file formats for SDL
libsdl-sound1.2-dev – Development files for SDL_sound
libsdl-stretch-0-2 – stretch functions for Simple DirectMedia Layer
libsdl-stretch-dev – development files for SDL_stretch library
libsdl1.2debian-arts – Simple DirectMedia Layer (with X11 and aRts options)
libsdl1.2debian-nas – Simple DirectMedia Layer (with X11 and NAS options)
libsdl1.2debian-pulseaudio – Simple DirectMedia Layer (with X11 and PulseAudio options)

patrickd@battlestar:~$ sudo apt-get install libsdl1.2debian-pulseaudio

Now I can happily run amarok and pingus :) I suspect this will probably work for other SDL based games like frozen-bubble.


Missing Matlab menu’s with ubuntu

30 April, 2008

After installing matlab 7.4.0 on ubuntu hardy (8.04), I got the following stack trace on the gnome output console;

patrickd@battlestar:~$ Locking assertion failure. Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0xb5ac0767]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_unlock+0×31) [0xb5ac08b1]
#2 /usr/lib/libX11.so.6(_XReply+0xfd) [0xb5e2c1bd]
#3 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/libmawt.so [0xa090826a]
#4 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/libmawt.so [0xa08ee352]
#5 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/libmawt.so [0xa08ee599]
#6 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/libmawt.so(Java_sun_awt_X11GraphicsEnvironment_initDisplay+0×24) [0xa08ee7a4]
#7 [0xadcbdb8b]
#8 [0xadcb7a7b]
#9 [0xadcb7a7b]
#10 [0xadcb5157]
#11 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/libjvm.so [0xb294f8ec]
#12 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/libjvm.so [0xb2a3e378]
#13 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/libjvm.so [0xb294f71f]
#14 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/libjvm.so(JVM_DoPrivileged+0×2db) [0xb29a7ebb]
#15 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/libjava.so(Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0×3d) [0xb2f422cd]
#16 [0xadcbd43b]
#17 [0xadcb79a4]
#18 [0xadcb5157]
#19 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/libjvm.so [0xb294f8ec]
Locking assertion failure. Backtrace:
#0 /usr/lib/libxcb-xlib.so.0 [0xb5ac0767]
#1 /usr/lib/libxcb-xlib.so.0(xcb_xlib_lock+0×2e) [0xb5ac081e]
#2 /usr/lib/libX11.so.6 [0xb5e2b518]
#3 /usr/lib/libX11.so.6(XGetVisualInfo+0×26) [0xb5e220a6]
#4 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/libmawt.so [0xa08ed227]
#5 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/libmawt.so [0xa08ed4b8]
#6 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/libmawt.so [0xa08ee6e0]
#7 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/xawt/libmawt.so(Java_sun_awt_X11GraphicsEnvironment_initDisplay+0×24) [0xa08ee7a4]
#8 [0xadcbdb8b]
#9 [0xadcb7a7b]
#10 [0xadcb7a7b]
#11 [0xadcb5157]
#12 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/libjvm.so [0xb294f8ec]
#13 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/libjvm.so [0xb2a3e378]
#14 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/libjvm.so [0xb294f71f]
#15 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/client/libjvm.so(JVM_DoPrivileged+0×2db) [0xb29a7ebb]
#16 /opt/matlab/sys/java/jre/glnx86/jre1.5.0/lib/i386/libjava.so(Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0×3d) [0xb2f422cd]
#17 [0xadcbd43b]
#18 [0xadcb79a4]
#19 [0xadcb5157]

Which appears to be causing the standard menus in matlab not to display, after trying various solutions found around the great wide inter web, the one that finally worked for me was to edit the matlab startup script at <$matlab_home>/bin/matlab and insert the following at the top of the file;

export AWT_TOOLKIT=MToolkit

After editing the matlab startup script it now looks like;

patrickd@battlestar:~$ head /opt/matlab/bin/matlab
#!/bin/sh
export AWT_TOOLKIT=MToolkit
#
# Name:
# matlab script file for invoking MATLAB
#
# Usage:
# matlab [-h|-help] | [-n | -e]

Note: This doesn’t actually appear to stop the error message above from appearing in the terminal window, it does however allow the menus to display which for now is all I need to fix. If I later discover that the error message is causing something else not to work in Matlab then I ‘ll update this post.


Google toolbar bookmarks with Firefox-2 on Ubuntu Hardy (8.04)

30 April, 2008

After upgrading to ubuntu hardy (8.04) and trying to use Firefox 3b5 for a couple of days. I’ve decided to go back to using the Firefox 2.* series for browsing the web, as a lot of the extensions that I use day to day still aren’t supported in ff 3b5. So, I installed firefox 2 with the following command;

$ sudo apt-get install firefox-2

After installing firefox 2, I then tried to install google toolbar and got an error that the toolbar couldn’t be installed, after searching around the web. The solution that worked for me was to shutdown Firefox 2 and remove the preferences directory using;

$ rm -rf ~/.mozilla

When I restarted Firefox I was now able to install google toolbar. Unfortunately, after installing it and signing in using my gmail account, I was unable to access my bookmarks as I was just getting “downloading bookmarks” displayed when trying to access Bookmarks on the toolbar. No problem I thought I’ll just restart Firefox and hopefully that will fix it. Alas, this didn’t fix it. A little while later and a lot of forum searching and I finally happened upon a solution that worked for me, it involved installing the libstdc++5 library;

$sudo apt-get install libstdc++5

Then starting Firefox and disabling the google toolbar extension, restarting firefox and then enabling google toolbar extension and hey presto everything worked as expected.


Using Xilinx USB cable on LinuxMint / Ubuntu without windvr

8 April, 2008

This post is based on information found at the Xilinx JTAG information page . Using the Xilinx JTAG usb programmer without using the proprietary windvr.o (which no longer seems to work with modern kernel’s) kernel module requires that we use the open source libusb driver. There are a number of ways to obtain the driver but I prefer to install from source. The source can be obtained by using the command shown below and as the cable driver will be installed into the /opt/xilinx directory which my normal account (patrickd) doesn’t have write permissions to (/opt/xilinx must be written to using the sudo command or I could sudo to root and install from there, I could also allow write access to the /opt/xilinx but patrickd account but I prefer not to).

patrickd@patrickd-desktop:/opt/xilinx$ sudo git clone git://git.zerfleddert.de/usb-driver

Which generates the following error because git isn’t installed yet;

sudo: git: command not found

To install the Git source control system, run the following command;

patrickd@patrickd-desktop:/opt/xilinx$ sudo apt-get install gitk git-gui
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
nautilus-actions
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
git-core libdigest-sha1-perl liberror-perl tcl8.4 tk8.4
Suggested packages:
git-arch git-cvs git-svn git-email git-daemon-run gitweb cogito tclreadline
Recommended packages:
git-doc curl
The following NEW packages will be installed
git-core git-gui gitk libdigest-sha1-perl liberror-perl tcl8.4 tk8.4
0 upgraded, 7 newly installed, 0 to remove and 2 not upgraded.
Need to get 6206kB of archives.
After unpacking 14.6MB of additional disk space will be used.
Do you want to continue [Y/n]?

Once git is installed its time to try and reinstall the libusb driver, by running the previous command;

patrickd@patrickd-desktop:/opt/xilinx$ sudo git clone git://git.zerfleddert.de/usb-driver

Which will generate the following output although the actual values may differ;

Initialized empty Git repository in /opt/xilinx/usb-driver/.git/
remote: Counting objects: 551, done.
remote: Compressing objects: 100% (325/325), done.
Indexing 551 objects…
remote: Total 551 (delta 315), reused 417 (delta 226)
100% (551/551) done
Resolving 315 deltas…
100% (315/315) done

Change into the lib usb-driver directory then read the README file and attempt to ‘make’ or build the libusb driver;

patrickd@patrickd-desktop:/opt/xilinx$ cd usb-driver/
patrickd@patrickd-desktop:/opt/xilinx/usb-driver$ gedit README
patrickd@patrickd-desktop:/opt/xilinx/usb-driver$ sudo make

Unfortunately this will generate the following set of errors;

patrickd@patrickd-desktop:/opt/xilinx/usb-driver$ make
cc -Wall -fPIC -DUSB_DRIVER_VERSION=”\”2008-04-08 22:39:18\”" usb-driver.c parport.c config.c jtagmon.c -o libusb-driver.so -ldl -lusb -lpthread -shared
usb-driver.c:26:19: error: dlfcn.h: No such file or directory
usb-driver.c:28:20: error: stdlib.h: No such file or directory
usb-driver.c:29:20: error: string.h: No such file or directory
usb-driver.c:30:20: error: unistd.h: No such file or directory
usb-driver.c:31:19: error: fcntl.h: No such file or directory
usb-driver.c:32:23: error: sys/types.h: No such file or directory
usb-driver.c:33:22: error: sys/stat.h: No such file or directory
usb-driver.c:34:22: error: sys/time.h: No such file or directory
usb-driver.c:35:19: error: stdio.h: No such file or directory
usb-driver.c:36:17: error: usb.h: No such file or directory
usb-driver.c:37:20: error: signal.h: No such file or directory
usb-driver.c:38:21: error: pthread.h: No such file or directory
usb-driver.c:39:19: error: errno.h: No such file or directory
usb-driver.c:40:22: error: inttypes.h: No such file or directory
usb-driver.c:41:23: error: sys/ioctl.h: No such file or directory
usb-driver.c:42:25: error: sys/utsname.h: No such file or directory
usb-driver.c:43:27: error: bits/wordsize.h: No such file or directory
In file included from usb-driver.c:44:
usb-driver.h:253: error: expected specifier-qualifier-list before ‘uint32_t’
usb-driver.c:47: error: ‘NULL’ undeclared here (not in a function)
usb-driver.c:52: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
usb-driver.c:53: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
usb-driver.c:58: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
usb-driver.c:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int_wait’
usb-driver.c: In function ‘hexdump’:
usb-driver.c:70: warning: implicit declaration of function ‘fprintf’
usb-driver.c:70: warning: incompatible implicit declaration of built-in function ‘fprintf’
usb-driver.c:70: error: ‘stderr’ undeclared (first use in this function)
usb-driver.c:70: error: (Each undeclared identifier is reported only once
usb-driver.c:70: error: for each function it appears in.)
usb-driver.c:74: warning: incompatible implicit declaration of built-in function ‘fprintf’

In order to build the libusb driver, the libusb-dev files are required. Fortunately these files are currently available in the Debian archives and can be installed via the following command;

patrickd@patrickd-desktop:/opt/xilinx/usb-driver$ sudo apt-get install libusb-dev
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
nautilus-actions
Use ‘apt-get autoremove’ to remove them.
The following extra packages will be installed:
libc6-dev linux-libc-dev
Suggested packages:
glibc-doc manpages-dev
The following NEW packages will be installed
libc6-dev libusb-dev linux-libc-dev
0 upgraded, 3 newly installed, 0 to remove and 2 not upgraded.
Need to get 3978kB of archives.
After unpacking 17.6MB of additional disk space will be used.
Do you want to continue [Y/n]?

Now to re-run the ‘make’ command;

patrickd@patrickd-desktop:/opt/xilinx/usb-driver$ sudo make
cc -Wall -fPIC -DUSB_DRIVER_VERSION=”\”2008-04-08 22:39:18\”" usb-driver.c parport.c config.c jtagmon.c -o libusb-driver.so -ldl -lusb -lpthread -shared
cc -DDEBUG -Wall -fPIC -DUSB_DRIVER_VERSION=”\”2008-04-08 22:39:18\”" usb-driver.c parport.c config.c jtagmon.c -o libusb-driver-DEBUG.so -ldl -lusb -lpthread -shared

Once the driver has been build it must be added to the environment variables, this is done by adding the following to .bashrc;

export LD_PRELOAD=/opt/xilinx/usb-driver/libusb-driver.so

Once this step has been completed the final step is to add the USB driver to the udev rules set, this is achieved by (taken from http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/archive/2007/03/msg00101.html );

5) Make a new udev rule set file
$ sudo vi /etc/udev/rules.d/50-xilinx-usb-pav.rules # a new file with
arbitrary name (“50″ is recommended)
6) paste the following into this file, and save it
ACTION==”add”, BUS==”usb”, SYSFS{idVendor}==”03fd”, MODE=”666″
7) restart udev with:
$ /etc/init.d/udev restart


Installing ISE / EDK 8.2 on LinuxMint / Ubuntu

8 April, 2008

Once LinuxMint is installed its time to get down to actually using Linux for day to day tasks, but before I can do that I need to install Xilinx ISE and EDK v9.2. In this post I will detail all the steps required to install it within the LinuxMint environment, so here goes.

First copy the installation DVD to a temp folder and change the files so that they are all executable this is required as on most distributions the setup file isn’t executable. I could have just changed the execution bit for the “setup” file but as this file calls into other scripts in the directory tree it was just easier change the whole tree.

patrickd@patrickd-desktop:~/temp$ cp -R /mnt/cdrom ~/temp/ise

patrickd@patrickd-desktop:~/temp$ chmod -R u+x *

As I typically prefer not to install applications in my home directory, preferring instead to install custom applications (non-distro packaged) under the /opt tree, I need to start the setup script using the sudo command.

patrickd@patrickd-desktop:~/temp$ sudo ./setup

[sudo] password for patrickd:

And finally we have installed ISE as can be seen from the output of in the terminal window where the installation was started from.

************ setup done! ***************

At this stage the ISE environment is installed but before project navigator can be used so environment variables need to be configured fortunately xilinx provides a script to do this.

patrickd@patrickd-desktop:~/temp$ . /opt/xilinx/ise82/settings.sh
patrickd@patrickd-desktop:~/temp$ ise

In order to make things a little easier I’ve decided to add this script to my .bashrc, to edit the .bashrc script using gedit type the following;

patrickd@patrickd-desktop:~/temp$ gedit ~/.bashrc

and then add this to the bottom of the file

# Added the ISE settings script to the environment
. /opt/xilinx/ise82/settings.sh

EDK Installation

The procedure for installing the EDK is the same as that outlined above except instead of installing EDK into /opt/xilinx/ise82 the EDK software is installed into /opt/xilinx/edk82. In order to added the correct environment variables for EDK into the environment shell .bashrc should be edited as below,

# Added the EDK settings script to the environment
. /opt/xilinx/edk82/settings.sh