Dreamplug - How To -

Fix apt/sources.list

The factory supplied /etc/apt/sources.list looks like:

deb http://ftp.us.debian.org/debian/ lenny main contrib non-free
deb http://http.us.debian.org/debian stable main contrib non-free
deb http://security.debian.org lenny/updates main contrib non-free
deb http://www.backports.org/debian lenny-backports main contrib non-free
deb http://10.82.108.51/kedars/sheevaplug_wifi/builds/packages/ binary/

Change this to:

deb http://ftp.us.debian.org/debian/ lenny main contrib non-free
deb http://http.us.debian.org/debian stable main contrib non-free
deb http://security.debian.org lenny/updates main contrib non-free
deb http://www.backports.org/debian lenny-backports main contrib non-free

Faster Boot

The factory supplied u-Boot setup has unnecessary 'pings' during the boot sequence. Removing this will improve the Dreamplug boot time by approx. 1 minute (assuming the pings fail).

Change

bootcmd=setenv ethact egiga0; ${x_bootcmd_ethernet}; setenv ethact egiga1; ${x_bootcmd_ethernet}; ${x_bootcmd_usb}; ${x_bootcmd_kernel}; setenv bootargs ${x_bootargs} ${x_bootargs_root}; bootm 0x6400000;

to

bootcmd=${x_bootcmd_usb}; ${x_bootcmd_kernel}; setenv bootargs ${x_bootargs} ${x_bootargs_root}; bootm 0x6400000;

Boot from SD

To boot from SD rather than the internal Micro SD, one needs to change the u-Boot environment. To change the u-Boot environment (at the moment) you need a JTAG unit, the Dreamplug user guide describes how to connect the JTAG.
We take the approach of setting up u-Boot so that if the SD card is inserted we try to boot from it. If there is no bootable SD card then we try to boot from the micro SD. This provides a dual boot system. You can extend this scheme to include USB sticks. Unfortunately (at the moment) you cannot easily boot from the ESATA connection.

Update the u-Boot environment
The environment we use is created as as follows:
Marvell>> setenv soaddr   0x1600000
Marvell>> setenv loadaddr 0x6400000
Marvell>> setenv dev 1
Marvell>> setenv part 1
Marvell>> setenv kdev '/dev/sdb2'
Marvell>> setenv db_init    'setenv mainlineLinux yes; setenv arcNumber 2659; usb start'
Marvell>> setenv db_arg     'console=ttyS0,115200 rootwait panic=10'
Marvell>> setenv db_setarg  'setenv bootargs ${db_arg} root=${kdev}'
Marvell>> setenv db_load    'mw ${loadaddr} 0 1000; fatload usb ${dev}:${part} ${loadaddr} uImage'
Marvell>> setenv db_runs    'echo executing script; source ${soaddr}'
Marvell>> setenv db_loads   'mw ${soaddr} 0 1000; fatload usb ${dev}:${part} ${soaddr} boot.scr'
Marvell>> setenv db_runas   'echo loading sda script; setenv dev 0; setenv kdev /dev/sda2; run db_loads db_runs'
Marvell>> setenv db_runbs   'echo loading sdb script; setenv dev 1; setenv kdev /dev/sdb2; run db_loads db_runs'
Marvell>> setenv db_bootcmd 'run db_setarg db_load db_bootmem'
Marvell>> setenv db_bootmem 'bootm ${loadaddr}'
Marvell>> setenv bootcmd    'run db_init db_runbs; run db_bootcmd; run db_runas; run db_bootcmd'
Prepare a bootable SD
Use fdisk to (re) partition the SD. The first partition must be FAT16 The first partition needs to be at least 4MB in size, 20 or 30MB adds scope for keeping different kernels on the first partition.
e.g.
# fdisk -lu /dev/sdb
 ...
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1              16        8255        4120    6  FAT16
Format the first partition :
# apt-get install dosfstools
# mkfs.vfat -v -c -n 'dsd-uimage' /dev/sdb1
The subsequent partition(s) should be partiitioned as a Linux partition (Type 83). Format as either ext2 or ext3.
e.g.
# mkfs.ext3 -L 'dsd-fs' /dev/sdb2
or
# mkfs.ext2 -L 'dsd-fs' /dev/sdb2
Download a kernel of your choice from http://plugapps.com/mirror/with-linux or http://sheeva.with-linux.com/sheeva
The first partition needs to contain the kernel uImage Copy the rootfs and kernel modules to the second partition.
Instructions for installing the kernel are in the README at http://sheeva.with-linux.com/sheeva.
You can if you prefer copy the setup from the onboard micro SD.
You can test your new SD by inserting it and rebooting via:
# shutdown -r now
If things do not work out, remove the SD and reset the Dreamplug, it should be back to booting off the micro SD.

VNC to a Dreamplug (via an iPad)

Thanks to Matthew Coburn we have a wonderful description of how to set up VNC to a Dreamplug.If you want a fileserver for your iPad, you need to read this.

Replace the micro SDD

We tested replacing the onboard 2GB micro SD with Integral 4GB and 8GB micro SDs.
See the installation instructions at http://www.newit.co.uk/forum/index.php/topic,1991.msg5532.html#msg5532
The screws for the Dreamplug case are underneath the rubber feet.

Install a new Debian OS

We have tried both upgrading the default install of Debian and installing Debian from scratch. Both work, but a new install of Debian Squeeze or Wheezy frees up some disk space. The choice of which is the best approach will depend on your requirements.
If you use the multiboot system above then testing a new OS is as simple as inserting another SD card.

Automate u-Boot script

The u-Boot on the DreamPlug has the ability to remotely invoke u-Boot commands via the the u-Boot command 'source'. The 'source' command is documented at http://www.denx.de/wiki/view/DULG/UBootCmdGroupExec#Section_5.9.4.1.. Sequences of commands can be loaded into memory using TFTP, Kermit, YMODEM, USB, SD, uSD. We have tested each of the load mechanisms, disk or TFTP is quickest and easiest.
Using the 'source' command enables ypu to package commands to set up your u-Boot environment.

Install mkimage
# apt-get install uboot-mkimage
or
# apt-get install u-boot-tools
How to make the u-Boot script
First create a file with some u-Boot commands. e.g.

# cat test.txt

echo 'Hello world'
bdinfo
version
Now convert this to u-Boot format:
mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "test" -d test.txt test.scr
This should produce a file name test.scr. To run the script from u-Boot we need to place test.scr where it can be accessed by u-Boot. This can be on a TFTP server or on the first partition of the internal micro SD or on a USB stick.
Run the u-Boot script
At the u-Boot prompt
Marvell>> tftp 0x100000 test.scr; source 0x100000
The source scripts can be just as easily loaded via Kermit or YMODEM e.g.
Marvell>> loadb 0x100000 test.scr; source 0x100000
OR
Marvell>> loady 0x100000 test.scr; source 0x100000
Or from USB stick e.g
Marvell>> usb start
Marvell>> fatload usb 2:1 0x100000 test.scr ;  source 0x100000

We use the fatload mechanism in our latest multiboot script. If there is a file named "boot.scr" in the same directory as the uImage we will execute the script prior to loading the uImage kernel.
As an example, this allows a boot.scr on the micro SD to change the kernel rootfs to a ESATA drive.

How to set up unsecured Samba file shares

This details how to use Samba to provide unauthenticated read/write access to the Dreamplug from Windows file shares. The abscence of security is handy for secured home LANs.
You should also read http://plugcomputer.org/plugwiki/index.php/Share_With_Windows_Using_Samba.
The refernce http://www.samba.org/samba/docs/using_samba/ch06.html provides most things you want to know about Samba.
Running Samba enables you to use a Windows workstation to backup components of your plug computer or if you have a SATA or USB drive connected to your plugcomputer, you can use your plug computer storage to back up your workstation.
CAVEAT
The setup listed below will make the DreamPlug attached media readable and writable to everyone who has access to your workgroup. You must decide whether you want to do this.

Install samba
Install samba (if not already installed)
# apt-get install samba
Backup the original samba configuration
# cp /etc/samba/smb.conf /etc/samba/smb.conf.org
Create a default samba user/group
# useradd -d /media -M -p network -s /bin/false -U network
Modify the samba configuration
Modify /etc/samba/smb.conf to match that below:
# vi /etc/samba/smb.conf

[global]
        workgroup = "MYWORKGROUPNAME"
        netbios name = DREAMPLUG
        server string = Linux Samba Server
        log file = /var/log/samba.log
        max log size = 50
# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
        usershare allow guests = yes

        security = share
        guest account = network
        force group = network
        socket options = IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536

        load printers = no
        printing = bsd
        printcap name = /dev/null
        show add printer wizard = no
        disable spoolss = yes

        local master = yes
        os level = 65
        domain master = yes
        dns proxy = no

        deadtime = 1
        keepalive = 0

        log level = 0
        syslog = 0

        username map = /etc/samba/smbusers



[plug-storage]
        comment = The Dreamplug Storage
        path = /media
        browseable = yes
        public = yes
        browseable = yes
        public = yes
        read only = no
        locking = yes
        writable = yes
        create mask = 0755
        directory mask = 0775
Test the samba configuration
Whenever you change the samba configuration you can test your changes with:
# testparm -s /etc/samba/smb.conf
Create a mount point
# mkdir -p /media/test
Insert a USB stick and mount it
# mount /dev/sdc1 /media/test -o ro,noatime
If you now go to a workstation on the same network as your DreamPlug you should see:
> net view \\DREAMPLUG
Shared resources at \\DREAMPLUG

Linux Samba Server

Share name    Type  Used as  Comment

-----------------------------------------------------
plug-storage  Disk  (UNC)    The Dreamplug Storage
The command completed successfully.
In Explorer under "Microsoft Windows Network" you should see a folder under your workgroup named "Dreamplug/plug-storage".
Set authorties
For write access Samba will require that the target folder has a group name of 'network' or the owner is 'network'. Anything that is public read should be accessible.