Archive for June, 2011

Getting Started with GuruPlug Plus (almost)

Tuesday, June 7th, 2011

A few months ago I came across the embedded platform SheevaPlug and its brother GuruPlug. I was basically looking to move my Asterisk setup from my main server to a separate box as I’ve been unable to avoid some of the latency issues I’ve reported in previous posts and think it is likely to be related to other software running on the server.

I was thus looking for a small size computer which I could tuck out of the way and hopefully have a nice simple working configuration. I also wanted to move over to FreeSwitch if I had time later.

So I bought myself a GuruPlug Plus. The hardware itself is very tiny and it comes with only 500MB of built-in storage but does have space for a MicroSD card and also external e-SATA/USB drives. It looked economical and a good option.

However, to get it working for my intended use I needed to install more than the sample version of Debian that’s provided with the box, so decided to try and install a larger Debian install on a 8GB MicroSD card. That’s enough for the single application I want to run.

The blog http://bzed.de/posts/2010/05/installing_debian_on_the_guruplug_server_plus/ seemed to have some good pointers as to how to install Debian and exactly on the hardware I was using.

So once I had uboot upgraded I followed the instructions. I checked I could see my MicoSD card:


Marvell>> usb tree

Device Tree:
1 Hub (480MBit/s, 0mA)
| Marvell EHCI
|
+-2 Hub (480MBit/s, 100mA)
| USB2.0 Hub
|
+-3 Mass Storage (480MBit/s, 500mA)
USB Storage 000000009909 <=====

I had decided to use the latest debian version (Squeeze). I also wanted to use LVM as this makes it easier to adjust partition sizes later and also it was an option provided by the installer. I followed the instructions on the website but failed to make the plug bootable. The reason after a bit of looking around is the uInitrd image was bigger than the 0×600000 size given as an example. It would have been helpful if not only the commands but also the uboot output had been shown as this would have made it clearer. I took out the MicroSD card and on a normal Ubuntu server checked the device which was recognised fine:


/dev/sdb1 is ext2 ( this is /boot )

LVM shows:

root@ubuntu:~# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb5 guruplug lvm2 a- 7.23g 0

root@ubuntu:~# lvs
LV VG Attr LSize Origin Snap% Move Log Copy% Convert
home guruplug -wi--- 2.54g
root guruplug -wi--- 264.00m
swap_1 guruplug -wi--- 436.00m
tmp guruplug -wi--- 224.00m
usr guruplug -wi--- 2.57g
var guruplug -wi--- 1.22g

 

root@ubuntu:/mnt# ls -la
total 16584
drwxr-xr-x 3 root root 1024 2011-06-06 09:46 .
drwxr-xr-x 22 root root 4096 2011-06-03 14:34 ..
-rw-r--r-- 1 root root 84094 2011-05-19 23:58 config-2.6.32-5-kirkwood
lrwxrwxrwx 1 root root 28 2011-06-06 08:48 initrd.img -> initrd.img-2.6.32-5-kirkwood
-rw-r--r-- 1 root root 6465845 2011-06-06 09:45 initrd.img-2.6.32-5-kirkwood
drwxr-xr-x 2 root root 12288 2011-06-06 08:12 lost+found
-rw-r--r-- 1 root root 1003125 2011-05-19 23:58 System.map-2.6.32-5-kirkwood
-rw-r--r-- 1 root root 1433984 2011-06-06 09:46 uImage
-rw-r--r-- 1 root root 6465909 2011-06-06 09:46 uInitrd <<============ larger than 0x600000 !
lrwxrwxrwx 1 root root 25 2011-06-06 08:48 vmlinuz -> vmlinuz-2.6.32-5-kirkwood
-rw-r--r-- 1 root root 1433920 2011-05-19 23:57 vmlinuz-2.6.32-5-kirkwood

So I modified the steps in the other blog and did the following:


Marvell>> usb start
(Re)start USB...
USB: scanning bus for devices... 3 USB Device(s) found
Waiting for storage device(s) to settle before scanning...
Device NOT ready
Request Sense returned 02 3A 00
1 Storage Device(s) found
Marvell>> usb tree

Device Tree:
1 Hub (480MBit/s, 0mA)
| Marvell EHCI
|
+-2 Hub (480MBit/s, 100mA)
| USB2.0 Hub
|
+-3 Mass Storage (480MBit/s, 500mA)
USB Storage 000000009909

Marvell>> tftp 0x6400000 uImage
Using egiga0 device
TFTP from server 192.168.a.xx; our IP address is 192.168.a.yy
Filename 'uImage'.
Load address: 0x6400000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#####################
done
Bytes transferred = 1433984 (15e180 hex)
Marvell>> nand erase 0x100000 0x400000

NAND erase: device 0 offset 0x100000, size 0x400000
Erasing at 0x4e0000 -- 100% complete.
OK
Marvell>> nand write.e 0x6400000 0x100000 0x400000

NAND write: device 0 offset 0x100000, size 0x400000

Writing data at 0x4ff800 -- 100% complete.
4194304 bytes written: OK
Marvell>> tftp 0x6400000 uInitrd
Using egiga0 device
TFTP from server 192.168.a.xx; our IP address is 192.168.a.yy
Filename 'uInitrd'.
Load address: 0x6400000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
############################
done
Bytes transferred = 6465909 (62a975 hex)
Marvell>> nand erase 0x500000 0x1fb00000

NAND erase: device 0 offset 0x500000, size 0x1fb00000
Skipping bad block at 0x17920000
Skipping bad block at 0x19e60000
Erasing at 0x1ffe0000 -- 100% complete.
OK
Marvell>> nand write.e 0x6400000 0x500000 0x700000

NAND write: device 0 offset 0x500000, size 0x700000

 

Writing data at 0xbff800 -- 100% complete.
7340032 bytes written: OK
Marvell>> setenv bootargs_debian 'console=ttyS0,115200 root=/dev/guruplug/root'
Marvell>> setenv bootcmd_nand 'nand start; nand read.e 0x00800000 0x100000 0x400000; nand read.e 0x01100000 0x500000 0x700000'
Marvell>> setenv bootcmd 'setenv bootargs $(bootargs_debian); run bootcmd_nand; bootm 0x00800000 0x01100000'
Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Marvell>>

Now Debian does start the boot process but I see this:


[ 1.998201] hub 1-0:1.0: 1 port detected
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... [ 2.077782] device-mapper: uevent: version 1.0.3
[ 2.084521] device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
Volume group "guruplug" not found
Skipping volume group guruplug
Unable to find LVM volume guruplug/swap_1
done.
Begin: Waiting for root file system ... [ 2.316249] usb 1-1: new high speed USB device using orion-ehci and address 2
[ 2.467658] usb 1-1: New USB device found, idVendor=05e3, idProduct=0608
[ 2.474392] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 2.481574] usb 1-1: Product: USB2.0 Hub
[ 2.486833] usb 1-1: configuration #1 chosen from 1 choice
[ 2.495535] hub 1-1:1.0: USB hub found
[ 2.499665] hub 1-1:1.0: 4 ports detected
[ 2.776575] usb 1-1.1: new high speed USB device using orion-ehci and address 3
[ 2.908157] usb 1-1.1: New USB device found, idVendor=05e3, idProduct=0726
[ 2.915067] usb 1-1.1: New USB device strings: Mfr=0, Product=1, SerialNumber=2
[ 2.922428] usb 1-1.1: Product: USB Storage
[ 2.926663] usb 1-1.1: SerialNumber: 000000009909
[ 2.932740] usb 1-1.1: configuration #1 chosen from 1 choice
[ 3.023159] SCSI subsystem initialized
[ 3.051611] Initializing USB Mass Storage driver...
[ 3.056811] scsi0 : SCSI emulation for USB Mass Storage devices
[ 3.063457] usbcore: registered new interface driver usb-storage
[ 3.070152] USB Mass Storage support registered.
[ 8.087371] scsi 0:0:0:0: Direct-Access Generic STORAGE DEVICE 9909 PQ: 0 ANSI: 0
[ 8.096094] scsi 0:0:0:1: Direct-Access Generic STORAGE DEVICE 9909 PQ: 0 ANSI: 0
[ 8.143441] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 8.149561] sd 0:0:0:1: [sdb] 15661056 512-byte logical blocks: (8.01 GB/7.46 GiB)
[ 8.157925] sd 0:0:0:1: [sdb] Write Protect is off
[ 8.162745] sd 0:0:0:1: [sdb] Assuming drive cache: write through
[ 8.171549] sd 0:0:0:1: [sdb] Assuming drive cache: write through
[ 8.177695] sdb: sdb1 sdb2 < sdb5 >
[ 8.187177] sd 0:0:0:1: [sdb] Assuming drive cache: write through
[ 8.193308] sd 0:0:0:1: [sdb] Attached SCSI removable disk
done.
Gave up waiting for root device. Common problems:
- Boot args (cat /proc/cmdline)
- Check rootdelay= (did the system wait long enough?)
- Check root= (did the system wait for the right device?)
- Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/guruplug/root does not exist. Dropping to a shell!

BusyBox v1.17.1 (Debian 1:1.17.1-8) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
(initramfs)

It seems the device mapper is not being started at the right time, and hence the root partition can not be found.

I tried to extend the rootdelay. That changes the error slightly but it seems the real problem is the device mapper is started too early or the lvm commands are not used again to enable swap/root partitions to be seen.

 

 

Marvell> setenv bootargs_debian 'console=ttyS0,115200 root=/dev/guruplug/root rootdelay=10'
Marvell> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Marvell>>

However, that still doesn’t seem to help.


...
[ 29.596839] sd 0:0:0:0: [sda] Attached SCSI removable disk
[ 29.602959] sd 0:0:0:1: [sdb] 15661056 512-byte logical blocks: (8.01 GB/7.46 GiB)
[ 29.611323] sd 0:0:0:1: [sdb] Write Protect is off
[ 29.616150] sd 0:0:0:1: [sdb] Assuming drive cache: write through
[ 29.624947] sd 0:0:0:1: [sdb] Assuming drive cache: write through
[ 29.631091] sdb: sdb1 sdb2 < sdb5 >
[ 29.640449] sd 0:0:0:1: [sdb] Assuming drive cache: write through
[ 29.646601] sd 0:0:0:1: [sdb] Attached SCSI removable disk
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... [ 33.555674] device-mapper: uevent: version 1.0.3
[ 33.562475] device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
done.
Begin: Waiting for root file system ... done.
Gave up waiting for root device. Common problems:
- Boot args (cat /proc/cmdline)
- Check rootdelay= (did the system wait long enough?)
- Check root= (did the system wait for the right device?)
- Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/guruplug/root does not exist. Dropping to a shell!

BusyBox v1.17.1 (Debian 1:1.17.1-8) built-in shell (ash)
Enter 'help' for a list of built-in commands.

 

/bin/sh: can't access tty; job control turned off
(initramfs)

So if anyone has any ideas, I’d be delighted to hear from you.