EIB/KNX on Sheeva Plug using a clean GNU/Debian Lenny system on the NAND flash

Cleaning the house; installing GNU/Debian Lenny on the NAND flash

Introduction

The Sheeva Plug is an excellent platform to do all kinds of applications. Combined with its' small form factor and low power consumption for a very decent performance, it is a perfect tool for running control applications on.

Unfortunately, there are a number of flaws in the out of the box firmware that incite us to replace it with a cleaner and better alternative. The main problems are:

For these reasons, we'll upgrade the bootloader, the kernel and the filesystem.

I wrote down a quick HOWTO on PlugComputer. Note that, even though it is possible to use the shipped distribution, it is better to change the JFFS2 with UbiFS before relying on the device. I'll add the specifics here.

Getting started

There are a number of ways to replace the filesystem on the SheevaPlug, in no particular order

Booting from NFS and booting from MMC require that the USB connection is used for serial access in order to change U-Boot environment parameters. The first for loading the root over NFS (and a NFS server is required, something that is probably not that common for Windows users, the second for loading the Debian installer into memory and changing the final boot sequence.

The fastest way is probably just using OpenOCD and JTAG to write the flash with the required images. Note that this part can be skipped and the bootloader can simply be replaced from a serial console with access to the bootloader. However, JTAG is the last fallback in case your Plug got bricked.

Flashing the system from the bootloader

Make certain that a serial console is attached to your plug and stop the prompt at the bootloader.

Download the archive and extract it to a USB stick. The files u-boot.bin, uImage and ubi.img should be in the top directory. Connect the USB stick to your plug and:

Initialise the attached USB drive. Note that I did this with a USB disk that contains a partition, I don't know if the bootloader will recoginise one that does not have a partition


nand device 0
usb start

1. write u-boot. This is not really required, but heavily suggested to have better USB support wrt the standard firmware. After writing the bootloader, press reset and let it use the new bootloader.


nand erase 0x0 0xa0000
fatload usb 0:1 0x8000000 /u-boot.bin
nand write.e 0x8000000 0x0 0xa0000
reset

2. write the kernel to the NAND flash


nand erase 0x100000 0x400000
fatload usb 0:1 0x8000000 /uImage
nand write.e 0x8000000 0x100000 0x400000

Finally, write the UbiFS root filesystem:


nand erase 0x500000 0x1fb00000
fatload usb 0:1 0x8000000 /ubi.img
nand write.e 0x8000000 0x500000 0x1fb00000

Booting in the final system

Wrapping up, we signal our bootloader to start our system by default, we also need to set that we're booting a mainline kernel.


setenv mainlineLinux yes
setenv arcNumber 2097
setenv bootargs 'console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs'
setenv boot_nand 'nand read.e 0x2000000 0x100000 0x400000'
setenv bootcmd 'run boot_nand; bootm 0x2000000'
saveenv
reset

If all works out, the following output shoud appear:



__ __ _ _
| \/ | __ _ _ ____ _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| | | | (_| | | \ V / __/ | |
|_| |_|\__,_|_| \_/ \___|_|_|
_ _ ____ _
| | | | | __ ) ___ ___ | |_
| | | |___| _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
\___/ |____/ \___/ \___/ \__|
** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Sep 14 2009 - 15:36:37) Marvell version: 3.4.19

U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CFB00

Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000 size 256MB
DRAM CS[1] base 0x10000000 size 256MB
DRAM Total size 512MB 16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB
Flash: 0 kB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net: egiga0 [PRIME], egiga1
Hit any key to stop autoboot: 0
Marvell>>
Marvell>>
Marvell>> nand device 0
Device 0: NAND 512MB 3,3V 8-bit... is now current device
Marvell>> nand erase 0x0 0xa0000

NAND erase: device 0 offset 0x0, size 0xa0000
Erasing at 0x80000 -- 100% complete.
OK
Marvell>> usb start
(Re)start USB...
USB: scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... 1 Storage Device(s) found
Marvell>> fatload usb 0:1 0x8000000 /u-boot.bin
reading /u-boot.bin
..............................................

474008 bytes read
Marvell>> nand write.e 0x8000000 0x0 0xa0000

NAND write: device 0 offset 0x0, size 0xa0000

Writing data at 0x9f800 -- 100% complete.
655360 bytes written: OK
Marvell>> nand erase 0x100000 0x400000

NAND erase: device 0 offset 0x100000, size 0x400000
Erasing at 0x4e0000 -- 100% complete.
OK
Marvell>> fatload usb 0:1 0x8000000 /uImage
reading /uImage
.............................................................................................................................................................................................................................................

2770856 bytes read
Marvell>> nand write.e 0x8000000 0x100000 0x400000

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

Writing data at 0x4ff800 -- 100% complete.
4194304 bytes written: OK
Marvell>> nand erase 0x500000 0x1fb00000

NAND erase: device 0 offset 0x500000, size 0x1fb00000
Skipping bad block at 0x12f60000
Erasing at 0x1ffe0000 -- 100% complete.
OK
Marvell>> fatload usb 0:1 0x8000000 /ubi.img
reading /ubi.img
.............................................................................................................................................................................................................................................
.............................................................................................................................................................................................................................................
.............................................................................................................................................................................................................................................

177209344 bytes read
Marvell>> nand write.e 0x8000000 0x500000 0x1fb00000

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

Bad block at 0x12f60000 in erase block from 0x12f60000 will be skipped
Writing data at 0x1fb0e000 -- 99% complete.
Data did not fit into device, due to bad blocks
531628032 bytes written: ERROR
Marvell>>
Marvell>> reset

__ __ _ _
| \/ | __ _ _ ____ _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| | | | (_| | | \ V / __/ | |
|_| |_|\__,_|_| \_/ \___|_|_|
_ _ ____ _
| | | | | __ ) ___ ___ | |_
| | | |___| _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
\___/ |____/ \___/ \___/ \__|
** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Sep 14 2009 - 15:36:37) Marvell version: 3.4.19

U-Boot code: 00600000 -> 0067FFF0 BSS: -> 006CFB00

Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000 size 256MB
DRAM CS[1] base 0x10000000 size 256MB
DRAM Total size 512MB 16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB
Flash: 0 kB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net: egiga0 [PRIME], egiga1
Hit any key to stop autoboot: 0

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

Reading data from 0x4ff800 -- 100% complete.
4194304 bytes read: OK
## Booting image at 02000000 ...
Image Name: Linux-2.6.31.5
Created: 2009-10-23 3:32:35 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2770792 Bytes = 2.6 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing
Linux......................................................................................................................................................................................
done, booting the kernel.
Linux version 2.6.31.5 (kelly@speedy) (gcc version 4.2.1) #1 PREEMPT Thu Oct
22 21:32:29 MDT 2009
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
CPU: VIVT data cache, VIVT instruction cache
Machine: Marvell SheevaPlug Reference Board
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
Kernel command line: console=ttyS0,115200 ubi.mtd=2 root=ubi0:rootfs
rootfstype=ubifs
PID hash table entries: 2048 (order: 11, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 256MB 256MB = 512MB total
Memory: 513024KB available (5056K code, 1024K data, 144K init, 0K highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:114
Console: colour dummy device 80x30
Calibrating delay loop... 1192.75 BogoMIPS (lpj=5963776)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
Kirkwood: MV88F6281-A0, TCLK=200000000.
Feroceon L2: Enabling L2
Feroceon L2: Cache support initialised.
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Using static regulatory domain info
cfg80211: Regulatory domain: US
(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
(2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
(5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
cfg80211: Calling CRDA for country: US
NET: Registered protocol family 2
IP route cache hash table entries: 16384 (order: 4, 65536 bytes)
TCP established hash table entries: 65536 (order: 7, 524288 bytes)
TCP bind hash table entries: 65536 (order: 6, 262144 bytes)
TCP: Hash tables configured (established 65536 bind 65536)
TCP reno registered
NET: Registered protocol family 1
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
JFS: nTxBlock = 4009, nTxLock = 32077
msgmni has been set to 1002
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
console [ttyS0] enabled
brd: module loaded
loop: module loaded
MV-643xx 10/100/1000 ethernet driver version 1.4
mv643xx_eth smi: probed
net eth0: port 0 with MAC address 00:50:43:01:65:0e
libertas_sdio: Libertas SDIO driver
libertas_sdio: Copyright Pierre Ossman
NAND device: Manufacturer ID: 0xad, Chip ID: 0xdc (Hynix NAND 512MiB 3,3V
8-bit)
Scanning device for bad blocks
Bad eraseblock 2427 at 0x000012f60000
Creating 3 MTD partitions on "orion_nand":
0x000000000000-0x000000100000 : "u-boot"
0x000000100000-0x000000500000 : "uImage"
0x000000500000-0x000020000000 : "root"
UBI: attaching mtd2 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: volume 0 ("rootfs") re-sized from 2081 to 4011 LEBs
UBI: attached mtd2 to ubi0
UBI: MTD device name: "root"
UBI: MTD device size: 507 MiB
UBI: number of good PEBs: 4055
UBI: number of bad PEBs: 1
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 1
UBI: available PEBs: 0
UBI: total number of reserved PEBs: 4055
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 1/0
UBI: image sequence number: 0
UBI: background thread "ubi_bgt0d" started, PID 455
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
orion-ehci orion-ehci.0: Marvell Orion EHCI
orion-ehci orion-ehci.0: new USB bus registered, assigned bus number 1
orion-ehci orion-ehci.0: irq 19, io mem 0xf1050000
orion-ehci orion-ehci.0: USB 2.0 started, EHCI 1.00
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver ums-datafab
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
mice: PS/2 mouse device common for all mice
rtc-mv rtc-mv: rtc core: registered rtc-mv as rtc0
i2c /dev entries driver
cpuidle: using governor ladder
cpuidle: using governor menu
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
mmc0: mvsdio driver initialized, lacking card detect (fall back to polling)
Registered led device: plug:green:health
usb 1-1: new high speed USB device using orion-ehci and address 2
mv_xor_shared mv_xor_shared.0: Marvell shared XOR driver
mv_xor_shared mv_xor_shared.1: Marvell shared XOR driver
mv_xor mv_xor.0: Marvell XOR: ( xor cpy )
mv_xor mv_xor.1: Marvell XOR: ( xor fill cpy )
usb 1-1: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
mv_xor mv_xor.2: Marvell XOR: ( xor cpy )
mv_xor mv_xor.3: Marvell XOR: ( xor fill cpy )
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
oprofile: using timer interrupt.
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
lib80211: common routines for IEEE802.11 drivers
rtc-mv rtc-mv: setting system clock to 2066-11-22 16:31:01 UTC (3057669061)
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size: 516096000 bytes (504000 KiB, 492 MiB, 4000 LEBs)
UBIFS: journal size: 9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: zlib
UBIFS: reserved for root: 0 bytes (0 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:12.
Freeing init memory: 144K
INIT: version 2.86 booting
Starting the hotplug events dispatcher: udevd.
Synthesizing the initial hotplug events...done.
Waiting for /dev to be fully populated...scsi 0:0:0:0: Direct-Access USB
2.0 Flash Disk 2.00 PQ: 0 ANSI: 2
sd 0:0:0:0: Attached scsi generic sg0 type 0
sd 0:0:0:0: [sda] 501760 512-byte logical blocks: (256 MB/245 MiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Assuming drive cache: write through
sda: sda1
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Attached SCSI removable disk
done.
Setting the system clock.
The Hardware Clock does not contain a valid time, so we cannot set the System
Time from it.
Unable to set system clock.
Unable to set System Clock to: Fri Oct 17 10:02:54 UTC 1930 (warning).
Activating swap...done.
Setting the system clock.
The Hardware Clock does not contain a valid time, so we cannot set the System
Time from it.
Unable to set system clock.
Unable to set System Clock to: Fri Oct 17 10:02:55 UTC 1930 (warning).
Cleaning up ifupdown....
Loading kernel modules...done.
Assembling MD arrays...done (no arrays found in config file or automatically).
Checking file systems...fsck 1.41.3 (12-Oct-2008)
done.
Setting kernel variables (/etc/sysctl.conf)...done.
Mounting local filesystems...done.
Activating swapfile swap...done.
Setting up networking....
Configuring network interfaces...done.
Starting portmap daemon....
Starting NFS common utilities: statd.
Setting console screen modes and fonts.
chown: failed to get attributes of `/var/log/dmesg': No such file or directory
chmod: failed to get attributes of `/var/log/dmesg': No such file or directory
INIT: Entering runlevel: 2
Starting enhanced syslogd: rsyslogd.
Starting OpenBSD Secure Shell server: sshdNET: Registered protocol family 10
ADDRCONF(NETDEV_UP): eth0: link is not ready
.
Starting MTA:eth0: link up, 100 Mb/s, full duplex, flow control disabled
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
exim4.
Starting NFS common utilities: statd.
Not starting internet superserver: no services enabled.
Starting MD monitoring service: mdadm --monitor.
Starting deferred execution scheduler: atd.
Starting periodic command scheduler: crond.
chown: invalid user: `knx.nogroup'

Debian GNU/Linux 5.0 debian ttyS0

debian login: root
Password:
Linux debian 2.6.31.5 #1 PREEMPT Thu Oct 22 21:32:29 MDT 2009 armv5tel

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
debian:~#

The password is root/root, change it and re-generated the ssh keys


rm /etc/ssh/ssh_host*
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""

Since you're now running your system from NAND flash; you don't need a kernel stored in flash, execute:


apt-get remove flash-kernel linux-image-kirkwood

The system is now prepared with a GNU/Debian Lenny system to install the remainder of the software on.


Customising the system to run KNX/EIB

Preparing our KNX/EIB System.

Firstly, add the scorpius repository to your sources.list


deb http://scorpius.homelinux.org/~marc/debian lenny main contrib non-free
deb-src http://scorpius.homelinux.org/~marc/debian lenny main contrib non-free

Install lighttpd in order to get a webserver (boa or apache will do as well)


[marc@ahkna ~]$ sudo apt-get install php5-cgi lighttpd
[marc@ahkna ~]$ sudo lighttpd-enable-mod fastcgi

Install the required packages (eibd-clients is optional)

[marc@ahkna ~]$ sudo apt-get install linknx eibd-server eibd-clients

Have a look in /etc/defaults/eibd-server and /etc/defaults/linknx, enable the services and correct the IPs to match your configuration. Of course, you'll need a valid XML description of your EIB installation. The default /etc/linknx/house.xml should give you a pretty extensive description to start with.
[marc@ahkna ~]$ cat /etc/default/eibd-server
# To enable eibd at startup set this everything != NO
START_EIBD=YES

# Options where EIBD should connect to
# -i usb: for usb or -i ip: for EIBnet/IP routing
REMOTE_ARGS="-i ipt:192.168.123.124"
[marc@ahkna ~]$ cat /etc/default/linknx
# To enable eibd at startup set this everything != NO
START_LINKNX=YES

# Daemon options
REMOTE_ARGS="--config=/etc/linknx/house.xml"

For the userfriendly interface, you'll need to extract knxweb in /var/www/

.

Trouble Shooting

You do not need JTAG to reflash your SheevaPlug, go to the section Flashing the system from the bootloader if you just want to have a cleanly flashed system.. the following paragraphs should only be used when your sheeva got bricked for some reason.

Clearing and re-writing the system on the Sheeva

The creation of these files (UbiFS, the kernel and bootloader) is readily described on the net, PlugComputer is a good place to start. For convenience, the files are bundled in one archive. Install openocd on your your system, download the sheevaplug-installer-v1.0.tar.gz file from openplug.org and extract it.


[marc@staleek ~]$ cd sheevaplug-installer-v1.0/uboot/openocd/config/
[marc@staleek config]$ sudo ../openocd -f ./board/sheevaplug.cfg

If OpenOCD complains with a similar message:


[marc@staleek Sheeva]$ sudo ../openocd -f ./board/sheevaplug.cfg
Open On-Chip Debugger 0.3.0-in-development (2009-08-13-23:22) svn:r2529
$URL: http://svn.berlios.de/svnroot/repos/openocd/trunk/src/openocd.c $
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
2000 kHz
jtag_nsrst_delay: 200
jtag_ntrst_delay: 200
dcc downloads are enabled
Error: unable to open ftdi device: device not found
Runtime error, file "command.c", line 469:
[marc@staleek Sheeva]$

you might need to change the file: sheevaplug-installer-v1.0/uboot/openocd/config/interface/sheevaplug.cfg
[marc@staleek Sheeva]$ cat sheevaplug-installer-v1.0/uboot/openocd/config/interface/sheevaplug.cfg
to:
#
# Marvel SheevaPlug Development Kit
#
# http://www.marvell.com/products/embedded_processors/developer/kirkwood/sheevaplug.jsp
#

interface ft2232
ft2232_layout sheevaplug
# ft2232_vid_pid 0x9e88 0x9e8f
ft2232_vid_pid 0x0403 0x6010
# ft2232_device_desc "SheevaPlug JTAGKey FT2232D B"
jtag_khz 2000

This is due to a changed vendor ID after 07/2009.

Connect with a telnet session to your OpenOCD session.


[marc@crichton ~]$ nc localhost 4444
Open On-Chip Debugger
> sheevaplug_init
sheevaplug_init
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x000000d3 pc: 0xffff0000
MMU: disabled, D-Cache: disabled, I-Cache: disabled
0 0 1 0: 00052078
>

Upgrading the bootloader

A new bootloader u-boot.bin can be obtained from the archive, copy it to the location openocd was started from, installer/sheevaplug-installer-v1.0/uboot/openocd/config/uboot.bin.

At the telnet session (nc); execute the following:


> nand probe 0
nand probe 0
NAND flash device 'NAND 512MiB 3,3V 8-bit' found
> nand erase 0 0 0xa0000
nand erase 0 0 0xa0000
successfully erased blocks 0 to 4 on NAND flash device 'NAND 512MiB 3,3V 8-bit'
> nand write 0 u-boot.bin 0 oob_softecc_kw
nand write 0 u-boot.bin 0 oob_softecc_kw
wrote file u-boot.bin to NAND flash 0 up to offset 0x00074000 in 71.423912s

If you look in the file installer/sheevaplug-installer-v1.0/uboot/openocd/config/board/sheevaplug.cfg; you'll see that this has been scripted with the command sheevaplug_reflash_uboot. Starting the plug is done with resume (in case you didn't use the script).

If you were using the default firmware; your plug should boot again; but this time with a newer and improved bootloader (better USB support).

Preparing and creating the system

Though it's easy to recompile the kernel; the easiest for most will probably be to download the uImage from here. At the time of writing; this is 2.6.31.5.

The kernel commandline gives a clear indication about the filesystem layout mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs):

  1. The kernel is location at offset 0x100000 and has a size of 0x400000 (4M)
  2. The root file system is located at 0x500000 and has a size of 1fb00000 (507M)

For the remainder, attach a serial console to /dev/ttyUSB1. This is mainly done since upgrading from the bootloader is much faster than using the OpenOCD/JTAG access.

Creating an UbiFS filesystem

Note that the finished filessytem is already in the archive.

A already prepared filesystem for Debian Lenny (armel) can be used as a base


[mleeman@bane debian-rootfs]$ mkdir sheeva-rootfs
[mleeman@bane debian-rootfs]$ sudo tar xf base.tar.bz2 -C sheeva-rootfs/

Change the fstab file to match the following:


# /etc/fstab: static file system information.
#
#
tmpfs /lib/init/rw tmpfs rw,nosuid,mode=0755 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0
varrun /var/run tmpfs rw,nosuid,mode=0755 0 0
varlock /var/lock tmpfs rw,noexec,nosuid,nodev,mode=1777 0 0
udev /dev tmpfs rw,mode=0755 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=620 0 0
/dev/root / rootfs rw 0 0
tmpfs /var/cache/apt tmpfs defaults,noatime

Since /var/run is mounted on a tmpfs, we need to create the directory by adding the following line mkdir -p /var/cache/apt/archives/partial in /etc/rc.local

At this point, the filesystem is ready to be re-created into a UbiFS image

In order to get better hardware support, extract the modules that match the running kernel in the filesystem

[mleeman@bane debian-rootfs]$ sudo tar xvfz ~/sheeva-2.6.31.5-Modules.tar.gz -C sheeva-rootfs/

Finally, create the filesystem image to flash.
[mleeman@bane debian-rootfs]$ sudo mkfs.ubifs -r sheeva-rootfs -m 2048 -e 129024 -c 4096 -o ubifs.img -x zlib
[mleeman@bane debian-rootfs]$ sudo ubinize -o ubi.img -m 2048 -p 128KiB -s 512 ubi.cfg
[mleeman@bane debian-rootfs]$ cat ubi.cfg
[ubifs]
mode=ubi
image=ubifs.img
vol_id=0
vol_size=256MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize


[Home]

Last update:

Valid HTML 4.01!