Let's start tinkering


Patch the kernel, man!

Long time no see again, you know by now I don't update often--I need real news to feel the need to add something to this site. And news I have, but still, I took my own time...

For some time already the Marvell folks have contributed support for their SoCs to the Linux kernel. And recently, kernel 2.6.28 was published, which contains a commit by Chris (and to a lesser extent, myself) to add support to the Marvell-based ED Mini!

The commit is there:

This means you can build a Linux kernel for the ED Mini, and it'll boot. :)

However it does not support everything yet, most notably USB slave is missing. I'm trying to find some time working on that right now.

Also, we have a kernel now but installing a complete linux distribution is no piece of cake at the moment. I personally went through most of Debian's install process, only to fail near the end for some reason.

But the point is: no need to re-use LaCie's code. I'll keep it around of course, if only as a reference or if you absolutely want to rebuild it because you can't wait for USB gadget to work on 2.6.28.

See you soon!

Hooking up the console

Recently, I came in contact with another edminiv2 owner, who goes by the nick rosbif, and who also likes to tinker. That gave me the impulse to proceed further, so I went and did what had to be done: hook up a terminal to the EDMini's serial console.

The serial is 3.3V, which is not standard RS232 but is, fortunately, common across many mobile phones. A web search will show that Nokia's DKU-5 USB cable is an ideal candidate to connect a modern PC to any 3.3V UART.

As rosbif pointed out, LaCie's been kind enough to populate the J2 UART+JTAG connector on their ED Mini, which made things easier yet.

Then there was a short phase of worry: if you connect the DKU-5 to the LaCie but not to the PC which will act as a console, then power up the LaCie, it will seem not to boot. Actually it does, but it stops at the bootloader prompt--and thus does not boot Linux nor LaCie's SW. If the DKU-5 is connected (whether or not you actually read the console from the PC) then the LaCie will boot without stopping at the u-boot prompt any more.

What do I learn from looking at the console?

First: the flash memory (a Macronix 29LV400CBCT in my case) isn't propery recognized. That means I can't reflash my unit from u-boot... yet.

Second: once the unit has completely booted, it prompts for a Linux login. I haven't tried much, but I can already tell that neither 'admin' nor the users added through the Web interface can log in. Maybe 'root' can, but I don't know root's password.

Third: with some care, we can boot from TFTP and NFS. To achieve this, one has to re-build the LaCie kernel, create a minimal rootfs (with /etc/console and /bin/busybox aliased as /bin/sh). I'll dive into more details later on.

Playing with u-boot

Once you get the console link working, you can witness the very early stage of the ED Mini boot process. It looks like this:

__ __ _ _
| \/ | __ _ _ ____ _____| | |
| |\/| |/ _` | '__\ \ / / _ \ | |
| | | | (_| | | \ V / __/ | |
|_| |_|\__,_|_| \_/ \___|_|_|
_ _ ____ _
| | | | | __ ) ___ ___ | |_
| | | |___| _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
\___/ |____/ \___/ \___/ \__| ** LOADER **
** MARVELL BOARD: DB-88F5182-EDmini-V2 LE

U-Boot 1.1.1 (Aug 16 2006 - 10:46:18) Marvell version: 1.7.3 - LaCie version: 1.3.4

DRAM CS[0] base 0x00000000 size 64MB
DRAM Total size 64MB
Flash: flashStructGet manu 0xff id 0xff
[0kB@fff80000] ## Unknown FLASH at fff80000: Size = 0x00000000 = 0 MB
Flash: 0 kB
Addresses 20M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (20M - 16M): Done
*** Warning - bad CRC, using default environment

Soc: MV88F5182 Rev 2
CPU: ARM926 (Rev 0) running @ 400Mhz
SysClock = 133Mhz , TClock = 166Mhz

USB 0: host mode
USB 1: device mode
PCI 0: PCI Express Root Complex Interface
PCI 1: Conventional PCI, speed = 33000000
Net: egiga0 [PRIME]
Power Button Released
Hit any key to stop autoboot: 3

Is that big enough to notice? The ED Mini uses u-boot as its bootloader. You can find more about u-boot there. U-boot is Open Source, and actually in the ED Mini tarball, LaCie provides a heavily modified u-boot version.

The good news is that we can stop the boot process and enter u-boot commands at the console, which allows us to change the Linux booting process: we could for instance load a Linux kernel from a TFTP server, and boot on a root filesystem over NFS. We simply need to set some environment variables at the u-boot prompt and enter the right boot command.

The bad news is that, as the prompt shows, this u-boot has trouble recognizing the board's FLASH part. This basically means we can't make permanent changes to environment variables, which should reside in FLASH. And this means that each time we want to boot over TFTP/NFS, we'd have to stop u-boot at the prompt, re-enter the environment variables again, and re-enter the right boot command.

But we've got the source, right? So we should be able to fix that FLASH issue.

Summary of the u-boot patches

Here are the patches I made against LaCie's u-boot source tarball. You can find a patch file (cd uboot-lacie; patch -p1 < patchfile) as an attachment below.

File Patch
board/mv88fxx81/Board/boardEnv/DB_88FXX81/mvBoardEnvSpec.h Change BOOT device bus width from 8 to 16
board/mv88fxx81/Board/flash/mvAmdFlash.c Add support for Macronix in unlock, erase and program functions
board/mv88fxx81/Board/flash/mvAmdFlash.h Add device ID for Macronix MX29LV400CBCT
board/mv88fxx81/Board/flash/mvFlash.c Add support for Macronix and MX29LV400CBCT in reset, erase and program functions
board/mv88fxx81/Board/flash/mvFlashCom.c Add support for Macronix and MX29LV400CBCT in console messages
board/mv88fxx81/USP/mv_main.c Changed wrong machine type from 526 to 1756 (ED Mini) and added a mach_type envirnoment variable to allow overriding during boot
examples/Makefile Fixed rules which break with make 3.81
include/configs/db88f5181.h Enabled "bdinfo" command
lib_arm/armlinux.c Added support to take mach_type's value into account if modified between power-up and bootm
Makefile Added removal of temp files created by examples/Makefile fix
uboot-lacie-aa-patch.patch11.89 KB

A fixed u-boot, with instructions

For those who want the result without wading through my rants, here it is.


  • An ED Mini V2 with a Macronix MX29LV400CBCT FLASH part;
  • A serial console hooked up on the ED Mini V2;
  • A machine to act as a TFTP server.


Do not try this on anything else than an ED Mini V2 with a Macronix MX29LV400CBCT FLASH part.

Do not try this if you don't want to take the risk of rendering your ED Mini TOTALLY AND DEFINITIVELY UNUSABLE. Should the ED Mini become unuseable, you might be able to raise it from the dead by using JTAG equipment, but I cannot vouch for it, because I did not try JTAG.


  1. Download both u-boot-RAM.bin and u-boot-FLASH.bin.
  2. Power up the ED Mini V2 with the console attached, and press a key to get to the u-boot command prompt.
  3. Enter the following commands:
    • setenv serverip ip address of the TFTP server
    • setenv ipaddr ip address of the ED Mini V2
    • tftp 400000 u-boot-RAM.bin
    • go 410000
  4. The RAM-based u-boot starts. Press a key to stop it and get to its command line
  5. Enter the following commands:
    • setenv serverip ip address of the TFTP server
    • setenv ipaddr ip address of the ED Mini V2
    • tftp 500000 u-boot-FLASH.bin
  6. After the TFTP transfer is done, the length of the image is given, in decimal then between parentheses in hexadecimal. Note the hexadecimal length, you'll need it.
  7. Enter the following commands:
    • protect off all
    • erase all
    • cp.b 500000 fff80000 length
  8. Hold your breath, and enter the following command:
    • reset
  9. Relax and enjoy your newly flashed u-boot or weep.

2008-jun-13: inserted the 'erase all' command, which was missing previously; thanks to petris at nas-central.org for pointing it out!

u-boot-RAM.bin448.13 KB
u-boot-FLASH.bin448.13 KB

DKU-5 versus ARM-USB-OCD (updated)

For some time I've been unable to access my ED Mini's console.

This was not a fault in the wiring or a failure of the DKU-5 cable. This is a fault of the Linux kernel on my host, development, machine: it freezes completely when opening the /dev/ttyUSB0 device which represents the DKU-5 cable; and when I say 'freeze', I mean it. Mouse pointer dead. Keyboard dead. Filesystems not synced. Only way out is reset or, as my computer does not have a reset button, forced power-off.

I don't like that at all.
Investigations showed that some Ubuntu and Redhat users experienced the same issue, with variants. It looks like recent kernels have the issue; I could downgrade my kernel... Or I could switch from the DKU-5 cable to the serial on my Olimex ARM-USB-OCD JTAG probe, which I knew was not causing trouble with Linux.

That meant unsoldering the end of the DKU-5 cable from the 8-pin header on the ED Mini, and re-soldering again... Which I was becoming tired of. So I decided I'd rather add a connector to the ED Mini once and for all.

I chose a DB-9 female connector for two reasons. First, it's the most common connector with close to 8 lines. Second, its ninth hole can easily be filled in to make sure no one will plug a normal male DB-9 in it by mistake.

First thing was to drill the casing...

... then adding the DB-9...

... then drilling the backplate and putting it back in place.

Now the next phase was to build a splitter which would connect to the ED Mini's female DB-9 and split out to a 20-pin JTAG connector on one side and a male DB-9 RS-232 plug on the other side. Of course, the splitter has to do the level conversion between the ED Mini's 3.3v serial console and the theoretical +12/-12 (actually +5/-5) RS-232.

[picture of the splitter coming up soon]

Actually the splitter is not 100% complete yet: it lacks two resistors that will provide a 3.3v reference voltage for the JTAG probe from the 5v source on the ED Mini. However, the serial part is complete, which allows me to go back to software development. :)