Tools‎ > ‎

DreamPlug

Starting with dreamplug

Where can i find it ?

what is it ?

It's a linux server in a plug not so big (like a desktop power adapter).
I bought mine on http://www.newit.co.uk and i received it one week later, one day from England to France and FIVE days from Orly(airport) to Paris, yes the last twenty km was very hard for the french delivery (La Poste).


I am very interested in this one rather than D2plug because there are 2 ethernets (Gigabits) interfaces, and it's more interesting for making a firewall. In fact there are 3/4 interfaces because we can use wireless network (802.11b/g and 802.15). I think i'll only use wifi, not bluetooth on it.
Don't forget to buy the JTAG, because this is the only way for accessing the boot console (aka BIOS).

JTAG or not JTAG?

First, i thought i will never use JTAG (very old system for accessing hardware). 
The JTAG device have two connectors, UART and JTAG. UART is for accessing the console, boot command and ttyS0, and JTAG for debugging and hardware commands. So i only use UART at first, and thouht JTAG is not for me (i was so naive).
But after i have rebuilt a kernel, and reboot the system, this kernel was not very usefull. Or when i crashed the OS, i have the same conclusion, i can't reset the hardware and must move to my dreamplug, but it s not what i want.




Original system

Nice but not for me, it's an ubuntu 9.04, i am not a huge fan of ubuntu, but it's enought for many things. But ubuntu drop support for this architecture.  That's why we can found the new release on google code. And change to ubuntu again (i am wrong, ubuntu didn't dropped ARM architecture).

I do not modify any bit of the main system, it's only for recover. i will use another system on USB or SD card, at first it's a dump of the main system, and i will use another distrib.

Can i create/use my own distrib ?

Yes, sure. First, we can use the google code distrib on a usb drive.
So on another system (your main computer for example), do these steps.

download dreamplug_debian_v0.2.tar.gz
curl http://dreamplug.googlecode.com/files/dreamplug_debian_v0.2.zip.001 >dreamplug_debian_v0.2.zip
curl http://dreamplug.googlecode.com/files/dreamplug_debian_v0.2.zip.002 >>dreamplug_debian_v0.2.zip
7z x dreamplug_debian_v0.2.zip

Now use a USB key and create a disk label and two partitions (like on the dreamplug) and create the new fs and system.
I suppose that your usb key is on /dev/sdf

create  2 partitions on usb disk
/dev/sdf1 >128M fat16
/dev/sdf2 >2Go ext3/ext4

mkdosfs /dev/sdf1
mkfs.ext3 -L /dream_root /dev/sdf2
mount /dev/sdf2 /mnt
tar xvf dreamplug_debian_v0.2.tar.gz -C /mnt 
edit and make change on /mnt/root/init_setup.sh
umount /mnt
mount /dev/sdf1 /mnt
curl http://dreamplug.googlecode.com/files/uImage >/mnt/uImage-2.6
cp /mnt/uImage-2.6 /mnt/uImage-2.6.orig
umount /mnt

Now plug the USB key on the device and you must use UART/JTAG connector for accessing uboot parameters.
For now we can test and not save parameters that our distrib and kernel are correct. Start the DP and stop the boot proccess (hit a key)
I saved the boot image twice, uImage-2.6 and uImage-2.6.orig. This kernel is a valid kernel and we can allways recover with this kernel in future when a problem on the file (wrong update, rm,...)

Marvell>> usb start
Marvell>> fatls usb 2
Marvell>> fatload usb 2 0x6400000 uImage-2.6
Marvell>> setenv bootargs console=ttyS0,115200 root=/dev/sdc2 rootdelay=10
Marvell>> bootm 0x6400000

Now you can login with root/nosoup4u, and you can make many flavours of this distro.

In boot parameters i'll allways use uImage-2.6 and when i'll upgrade the kernel i have to update this file on the FAT partition of my usb key.

The boot command and parameters

The original boot command is starting network, try to boot from DHCP and  USB and try to boot on it. So i prefer a simpler way, just start usb.

Marvell>> setenv x_bootcmd_usb usb start
Marvell>> setenv x_bootcmd_kernel fatload usb 2 0x6400000 uImage-2.6
Marvell>> setenv x_bootargs root=/dev/sdc2 rootdelay=10 console=ttyS0,115200
Marvell>> setenv bootcmd ${x_bootcmd_usb}; ${x_bootcmd_kernel};setenv bootargs ${x_bootargs};bootm 0x6400000;
Marvell>> saveenv

debootstrap for debian

Same as before, plug a new USB key in your DP, and use debootstrap/cdebootstrap for making your distro.
First install debootstrap or cdebootstrap on your DP or another computer if you have an ARM crossdev or emulator.

you can find the last pre-compiled kernel at sheeva kernel site.

# CHROOT="/data/DebianDream"
# PKG="openssh-server,curl,rsync,localepurge,ntp,ntpdate,sudo,lsb-core"
# mkdir -p $CHROOT
# cd $CHROOT
# cdebootstrap --flavour=standard --include=$PKG squeeze $CHROOT
# sed -i 's/^#T0/T0/' $CHROOT/etc/inittab
# sed -i 's/squeeze main$/squeeze main non-free/' $CHROOT/etc/apt/sources.list
# chroot $CHROOT aptitude install libertas-firmware
# chroot $CHROOT passwd
# cp /usr/bin/uaputl $CHROOT/usr/bin/uaputl
# curl -O $CHROOT/boot/uImage-2.6 http://sheeva.with-linux.com/sheeva/2.6.39/2.6.39.2/dream-2.6.39.2-uImage
# curl -O /tmp/modules.tar.gz http://sheeva.with-linux.com/sheeva/2.6.39/2.6.39.2/sheeva-2.6.39.2-Modules.tar.gz
# tar xvf /tmp/modules.tar.gz -C $CHROOT
# rm /tmp/modules.tar.gz


Now you can use this new distrib. /data/DebianDream can be a mount point of a new partition./device. or an archive for next release, and you can dump/restore to another device.

And now for Gentoo

As usual you can create a cross dev environment or start from your DP.

# CHROOT="/data/GentooDream"
# mkdir -p $CHROOT
# wget -O /tmp/gentoo.stage3.tar.bz2 http://mirrors.kernel.org/gentoo/releases/arm/autobuilds/current-stage3-armv5tel/stage3-armv5tel-20110624.tar.bz2
# tar xvf /tmp/gentoo.stage3.tar.bz2 -C $CHROOT
# wget -O /tmp/portage.tar.bz2 http://mirrors.kernel.org/gentoo/releases/snapshots/current/portage-latest.tar.bz2
# tar xvf /tmp/portage.tar.bz2 -C $CHROOT/usr
# rm /tmp/gentoo.stage3.tar.bz2 /tmp/portage.tar.bz2
# curl -O $CHROOT/boot/uImage-2.6 http://sheeva.with-linux.com/sheeva/2.6.39/2.6.39.2/dream-2.6.39.2-uImage
# curl -O /tmp/modules.tar.gz http://sheeva.with-linux.com/sheeva/2.6.39/2.6.39.2/sheeva-2.6.39.2-Modules.tar.gz
# tar xvf /tmp/modules.tar.gz -C $CHROOT
# rm /tmp/modules.tar.gz
# rc-config add net.eth0
# rc-config add sshd
# sed -i 's/\(^s0.*\) \([0-9]*\)/\1 115200/ /etc/inittab
# passwd

Now you can use this new distrib. /data/GentooDream can be a mount point of a new partition./device. or an archive for next release, and you can dump/restore to another device

For JTAG users

openocd is your friend

Firs install openocd on your computer, the one connected to the JTAG device by USB cable.

# echo dev-embedded/openocd ftdi usb >/etc/portage/package.use/jtag
# echo dev-embedded/openocd >/etc/portage/package.keywords/jtag
# emerge openocd

After, you must select and create a valid config file and start the openocd server

# cat /usr/share/openocd/scripts/interface/sheevaplug.cfg >/etc/openocd.cfg
# cat /usr/share/openocd/scripts/board/sheevaplug.cfg >>/etc/openocd.cfg
# openocd -f /etc/openocd.cfg

some basics use of JTAG

On another terminal, conect to the localhost port 4444

# telnet 127.0.0.1 4444
> reset halt

With this command you can reset and halt to Marvell>> prompt at the UART console. Very usefull on crash or hang system.

Playing with kernel

Initrd and uInitrd

Now we want to boot on a new type of File System like btrfs or ext4, so we must or we want to use initrd image.

Create an initramfs/initrd file

# uname -r
2.6.39.2
# update-initramfs -c -k 2.6.39.2
update-initramfs: Generating /boot/initrd.img-2.6.39.2
# mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n "Debian ramdisk 2.6.39.2" -d /boot/initrd.img-2.6.39.2 /media/usb2/uInitrd-2.6

Add boot prameters

Marvell>> setenv x_bootcmd_initrd fatload usb 2 0x6900000 uinitrd-2.6
Marvell>> setenv bootcmd ${x_bootcmd_usb}; ${x_bootcmd_kernel}; ${x_bootcmd_initrd}; setenv bootargs ${x_bootargs} ${x_bootargs_root}; bootm 0x6400000 0x6900000;

Create a New kernel

The first time, get the sources

Get the kernel via git on the kernel.org site and compile with the actual config.
You must download the patch libertas AP from marvell, and apply.

# git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
# mkdir Patches
# cd linux
# export PatchList="linux-3.0-SDIO-micro-AP 0002-Driver-for-Marvell-Libertas-8688-SDIO-micro-AP-suppo-3.2 0003-Initial-defconfig linux-3.0.4-LIBERTAS-WEXT_PRIV mvsdio-1-2.6.30 mvsdio-2 sheeva-3-leds"
#
# for P in $PatchList;do
#   wget -O ../Patches/${P}.patch http://sheeva.with-linux.com/sheeva/3/3.2/3.2/source/${P}.patch
    patch -p1 < ../Patches/${P}.patch
# done
#

The version of patches must be changed to suit yours.

Config and compile

To start, you can use the actual config from /proc, and modify some parameters.

# cd linux
# zcat /proc/config.gz >.config
# make menuconfig
# make uImage
# make modules
# make modules_install
# cp arch/arm/boot/uImage /boot

And now you can use it and it works very well.

# uname -a
Linux sheevaplug-debian 3.0.0-rc5-dirty #3 PREEMPT Sun Jul 3 00:29:23 UTC 2011 armv5tel GNU/Linux





Comments