Archive for the ‘Sheevaplug’ Category

Sheevaplug

2, January 2011

Ok so I’ve had my Sheevaplug since January 2009 and have now bricked it at least 3 times trying to be too clever by half! As it’s getting to be a rugular thing and it always takes me hours to work out what to do, here are my instructions.

I have used the same info. from the page below and added/changed it to reflect my process, please read both to make sure you understand what you are doing! as I take no reponsibility for errors blah, blah etc.etc.

I found the “instructions”, script & packages on this site

SheevaPlug Installer Page;

http://plugcomputer.org/plugwiki/index.php/SheevaPlug_Installer

but to be honest they are a bit difficult to follow for a bit of a noob so I’ve adapted them a bit.

The installer will reflash a bricked plug & can be used to install another distro [I’ve used Debian Squeeze this time] but if you just want it back to “factory settings” use the packages as they are.

My plug is the BFLS one supplied with Ubuntu Jaunty on the internal flash card and the PC I will use to reflash it has Ubuntu Jaunty on it so although the scipt includes Windows support I won’t mention it here, see the above page for details.

Note::
The runme.php would not run on Ubuntu 10.10 as the version of python on Ubuntu 10.10 has depreciated some terms. I got round this at the time by installing the old 32 bit Karmic Ubuntu and using that but since then I have found the possible answers in this post

http://plugapps.com/forum/viewtopic.php?f=20&t=428#p3178

but not tested the solution yet although I have saved copies of the files it talks about for future use, contact me if you need them.

If you can get onto the plug then backup your stuff as this script will delete the lot, be Warned

First Download the tarball from

http://www.plugcomputer.org/index.php/us/resources/downloads?func=select&id=5

This includes all the files you need to re flash your sheevaplug with the default install of Ubuntu Jaunty. Check out this post http://plugcomputer.org/plugforum/index.php?topic=878.0 if you want to Install a Debian system, you can either download the pre-built Lenny or Squeeze rootfs.tar.gz files or use the script that mgillespie has created.

You now need to add the following packages to your host PC, cu, php5-cli, and libftdi1, so install with the following commands in a [Terminal];

$ sudo apt-get install cu

$ sudo apt-get install php5-cli

and

$ sudo apt-get install libftdi1

adding libftdi1 fixes the error message “openocd/openocd: error while loading shared libraries: libftdi.so.1: cannot open shared object file: No such file or directory” latter on.

You now connect the Sheevaplug to your PC with the USB lead [supplied] and issue this command in a [Terminal];

$ cu -s 115200 -l /dev/ttyUSB1

Note: [you may need to try cu -s 115200 -l /dev/ttyUSB0 my plug seemed to use either!]

If you get any sort of error message along the lines of

cu: open (/dev/ttyUSB1): No such file or directory
cu: /dev/ttyUSB1: Line in use

you need to issue the following commands in a [Terminal] to remove then add the driver support and re try.

$ sudo rmmod ftdi_sio

followed by

$ sudo modprobe ftdi_sio vendor=0x9e88 product=0x9e8f

If you now get on then you can proceed to the task at hand, if not it’s time to Google!. However I found that I could not get onto the plug sometimes and then realised that the plug end connection of the usb PC to plug cable was working itself out socket in the plug.

Installation

1. Prepare an empty USB stick that is FAT16/32 formatted. [Note: the 2 USB sticks I used were not detected by the plug even though I had used 1 of then before to unbrick my plug, be warned]. Re formatting and unplugging safely etc.etc did not help.

2. Extract the tarball you downloaded earlier into a folder on your PC (for example: ~/plug)

3. Edit the ~/plug/uboot/uboot-env/uboot-mmc-custom.txt or uboot-nand-custom.txt file to the correct MAC address according to the MAC address on the back of the Plug (default set to ethaddr 00:50:43:01:c1:e6). If your system is to boot from the internal flash then it’s the nand file you change, if it boots from a flash card in the side slot it’s the mmc file you change.

4. Copy all the files from ~/plug/installer to the USB stick.
NOTE: that the files should be written to the root directory of the USB stick. For example:

$ sudo cp -a ~/plug/installer/* /media/usb-pen/

5. You should now have a copy of the following;

  1. Init ramdisk (initrd)
  2. Kernel modules (modules.tar.gz)
  3. README.txt
  4. Root file-system (rootfs.tar.gz) Note if you are installing Debian, replace this file with the Debian version you have either downloaded or created with the mgillespie’s script.
  5. ubuntu-sheevaplug.sh
  6. Kernel (uImage)

6. Copy the uboot image (named uboot.bin) to the ~/plug/uboot/ directory, if it’s not there, mine was.

7. Safely remove the USB stick from the host PC, power off the plug and plug the USB stick into the Plug’s USB host interface (not via a USB HUB I disconnected all other periferals also!)

8. Connect the Plug to your PC with it’s USB cable.

9. On your PC in a [Terminal] again change to the working directory

$ cd ~/plug

and run the runme.php file with the command;

sudo php runme.php and either nand or mmc, nand if your system is on the internal flash mmc if on an external card, in my case;

$ sudo php runme.php nand

If you get an error message along these lines of;

Error: unable to open ftdi device: device not found
Runtime error, file “command.c”, line 469:
****    openocd FAILED
****    Is the mini USB cable connected?
****    Try powering down, then replugging the Sheevaplug

then try issuing these commands in a [Terminal] to delete and reload the driver, then retry;

$ sudo rmmod ftdi_sio
$ sudo modprobe ftdi_sio vendor=0x9e88 product=0x9e8f

[and make sure the USB cable at the plug end is firmly in]

If all goes well the process should start and end a couple of minutes later with a “beep” to indicate that the uboot install process has finished with the following message. [no beep on my plug]

****   U-boot should be up and running now. Open your console …

Now, open another Terminal  and log with this command

$ cu -s 115200 -l /dev/ttyUSB1

if you get this message;

## Booting image at 00800000 …
Bad Magic Number

as I did when using the first USB stick, then the process probably has not found the USB Stick and not loaded the o/s. You could try running the command;

run recover1

but in my case it just did not like the USB stick and I had to use another

If all goes well you should now see the o/s being installed with the final lines being..

* Starting kernel log daemon…
Ubuntu 9.04 ubuntu ttyS0

ubuntu login:                                                          [ OK ]
* Starting OpenBSD Secure Shell server sshd         [ OK ]
* Starting periodic command scheduler crond        [ OK ]
* Restarting OpenBSD Secure Shell server sshd     [ OK ]

with just an unhelpful flashing curser, in the centre of the last line!

After pressing [Enter] you get:

Ubuntu 9.04 ubuntu ttyS0

ubuntu login:

Just login with the default user root and password nosoup4u

done!!

Sheevaplug – automount USB drive at boot

17, February 2010

The problem with the Sheevaplug is that it boots too damn fast and the USB drive is too slow to be available for the fstab mount.

The solution, see here for my post on setting up the fstab file to mount your USB drive. When you edit the fstab on the Sheeva you will find it empty but you should end up with an entry similar to this.

# UNCONFIGURED FSTAB FOR BASE SYSTEM
/dev/sda1 /mnt/usbdrive ext3 auto,user,rw,exec 0 0

My usb drive is mounted at /dev/sda1 and I created a mount point called /mnt/usbdrive, the drive is formatted as ext3 but you can replace this with the format of your drive or just replace with the word auto for it to check.

Once you have your fstab in place you need to create a script which will slow down the boot for the USB drive to start. Thanks to restamp on the plugcomputer.org forum see here for the solution.
First navigate to the init.d folder, in a [Terminal] issue the command;

cd /etc/init.d

then using whatever text editor you have installed [I added nano], open a file called wait4usbdrive with;

nano wait4usbdrive

then copy into it restarts script;

#!/bin/sh
#
# If /etc/fstab has been configured to mount a USB drive, pause to give
# the USB drive devices time to show up in /dev. If this is not done,
# checkfs.sh will fail, requiring manual intervention…
#
case "$1" in
start)
grep -q ^/dev/sda /etc/fstab &&
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do
[ -b /dev/sda ] && exit 0
sleep 1
done
exit 1
;;
stop)
;;
esac

Then make it executable with;

chmod +x wait4usbdrive

Then link it to the rcS.d folder with this command;

ln -s ../init.d/wait4usbdrive /etc/rcS.d/S25wait4usbdrive

Now you can shutdown and restart the plug and the USB drive should now auto-mount. My USB drive is a 1.5 TB iomega with it’s own power supply.

Sheevaplug – install get_iplayer

10, February 2010

With help of Percival P Plugsley’s post here

I managed to get get_iplayer working on my Sheevaplug with Ubuntu jaunty installed on it’s internal flash memory.

You need to visit the download page at linuxcentre.net and download the get_iplayer perl script to a folder of your choice i.e c/root/

As you cannot get the mplayer app in the Sheevaplug repositories you need flvstreamer from, here which you will need to compile for the Sheevaplugs ARM architecture. First download the flvstreamer source flvstreamer-1.9.tar.gz from http://mirrors.aixtools.net/sv/flvstreamer/source/ and save it to the Sheevaplug unpacking it into a directory of your choice i.e. /root/flvtemp

Now we need some other packages installed, in a [Terminal]

sudo apt-get install build-essential
sudo apt-get install ffmpeg
sudo apt-get install lame
sudo apt-get install perl
sudo apt-get install libwww-perl

I like to use nano rather than vi, so I also added;
sudo apt-get install nano

now move to the directory you saved the source to;

cd /root/flvtemp

create a new file called MakefileARM

sudo touch MakefileARM
now open it with
nano makefileARM
Then add the following to the file;

############## start #######################
CC=gcc
CXX=g++
LD=ld

CFLAGS=-Wall -D_FILE_OFFSET_BITS=64
CXXFLAGS=-Wall -D_FILE_OFFSET_BITS=64
LDFLAGS=-Wall -D_FILE_OFFSET_BITS=64

CXXFLAGS=
LDFLAGS=-Wl,-rpath=/opt/lib

all: flvstreamer

clean:
< TAB >rm -f *.o

streams: bytes.o log.o rtmp.o AMFObject.o rtmppacket.o streams.o parseurl.o
< TAB >$(CXX) $(LDFLAGS) $(ARMFLAGS) $^ -o $@_arm -lpthread

flvstreamer: bytes.o log.o rtmp.o AMFObject.o rtmppacket.o flvstreamer.o parseurl.o
< TAB >$(CXX) $(LDFLAGS) $(ARMFLAGS) $^ -o $@_arm

bytes.o: bytes.c bytes.h Makefile
log.o: log.c log.h Makefile
rtmp.o: rtmp.cpp rtmp.h log.h AMFObject.h Makefile
AMFObject.o: AMFObject.cpp AMFObject.h log.h rtmp.h Makefile
rtmppacket.o: rtmppacket.cpp rtmppacket.h log.h Makefile
flvstreamer.o: flvstreamer.cpp rtmp.h log.h AMFObject.h Makefile
parseurl.o: parseurl.c parseurl.h log.h Makefile
streams.o: streams.cpp log.h Makefile
############### end ######################

remove the texted called < TAB > and replace them with a TAB as copying the text and pasting it into a document often replaces the TAB with a space and you will get an error message when you compile it similar to;

Makefile:15: *** missing separator. Stop.

save the file and now run the command;

sudo make -f MakefileARM flvstreamer

This will create a file in the same directory called flvstreamer_arm, create a directory to store it in;

sudo mkdir /root/flvstreamer

move flvstreamer to it;

cp /root/flvtemp/flvstreamer_arm /root/flvstreamer

now move to the directory;

cd /root/flvstreamer

and make the file executable with;

chmod +x flvstreamer_arm

now test all is working with;

./flvstreamer_arm –help

If that works then you can move on to get_iplayer

create a directory for get_iplayer and copy the perl script you downloaded to it

sudo mkdir /root/get_iplayer
sudo chmod 755 get_iplayer
cp /root/get_iplayer /root/get_iplayer/

move to the Directory and run get_iplayer
cd /root/get_iplayer
./get_iplayer

The first time you run it get_iplayer should update itself and end, the second time it will download the current BBC listings.

Now add the following prefs;

./get_iplayer –prefs-add –flvstreamer=”/root/flvstreamer/flvstreamer_arm”
./get_iplayer –prefs-add –ffmpeg=”/usr/bin/ffmpeg”
./get_iplayer –prefs-add –lame=”/usr/bin/lame”
./get_iplayer –prefs-add –output=”/PATH/To/Your/Download/Directory”

Check for a program;

./get_iplayer –type=radio “News”

check out the 5 digit index code of one of the programs and download it as follows

./get_iplayer –get 13119

Hope this helps