Welcome! Log In Create A New Profile

Advanced

UART Booting HowTo for Selected Kirkwood Devices

Posted by davygravy 
UART Booting HowTo for Selected Kirkwood Devices
May 06, 2012 03:49PM
This tutorial/howto describes how to boot certain Kirkwood machines via UART/serial connection. Though there are at least three different utilities that support this, the kwboot tool by Daniel Stodden is the focus here. kwboot is, in my opinion, perhaps the best of this genre of utility, and has been submitted to U-Boot mainline for inclusion in tools/. Using this patch (from early May 2012), it automatically compiles for the build-host if CONFIG_KIRKWOOD is declared.

A precompiled binary of kwboot (built on a 64-bit Ubuntu system) is attached, in a tarball w/ man page. The contents of the man page are listed below, also.

0. What is this and why do it? UART-booting provides a way to test a U-Boot uboot.kwb image before actually flashing to NAND. It also provides a non-JTAG method of unbricking any compatible device that has a working serial connection. It has been tested quite a bit, and it works well for me, but YMMV and there is no warranty, express or implied. Use at your own risk.

1. Compatible Kirkwood devices: Any Kirkwood SoC that has a BootROM version 1.21 (perhaps others?)
Known working (please post if you can confirm other working devices):
  • Seagate GoFlex Net/Home
  • Pogoplug V4/Mobile
  • Zyxel NSA320
  • RaidSonic ICYBox NAS6220/NAS6210

Non-working (post if you know of others, or if you find a workaround!):
  • Pogoplug V2/E02
  • Seagate Dockstar
  • SheevaPlug

How to determine if UART-booting works: It seems like the best marker is the BootROM version. So far, all machines with version 1.21 do support it, but none of the version 1.11 machines seem to work with it. From within U-Boot (either serial or netconsole, execute the md memory-display command at offset ff00003c:
md ff00003c
If you see
ff00003c: 00000111
it is v1.11, and if you see
ff00003c: 00000121
it has v 1.21.


2. Hardware setup: Test this first and make sure it is working normally.
  • a working serial connection to a compatible Kirkwood device
  • (optional) network/ethernet connection for the same Kirkwood device
Note: UART booting is not possible over netconsole.


3. kwboot binary and uboot.kwb:
  • download the kwboot-tool tarball and untar it somewhere convenient on your system
  • copy the uboot.kwb that you wish to boot the device with to the same kwboot-tool directory
  • cd to the directory, issue the command with the appropriate options/flags, depending on the uboot.kwb's filename and type [NAND or UART]

UART-boot uboot.kwb images work without any special fixing:
./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.uartpogoMobile-MMC-mtdparts-NoUSB.kwb


If the uboot.kwb is a regular image built for flashing NAND, then append the -p flag and it will attempt to patch the header of the transmitted image, on-the-fly. The uboot.kwb file will not be altered.
./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.goflexnet-IDEpatched-netconsoleON.kwb -p

Note that the documentation states that the baudrate flag is optional, with a default setting of 115200.




4. (Re)Start your Kirkwood device:
davygravy@bitbaker64:~/Desktop/kwboot-tool/$ ./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.goflexnet-IDEpatched-netconsoleONdefault.kwb  -p
Sending boot message. Please reboot the target.../
Sending boot image...
  0 % [......................................................................]
  1 % [......................................................................]
  3 % [......................................................................]
 ...
 95 % [......................................................................]
 97 % [......................................................................]
 99 % [....................................]
[Type Ctrl-\ + c to quit]


U-Boot 2011.12 (Apr 27 2012 - 23:06:45)
Seagate GoFlexNet

SoC:   Kirkwood 88F6281_A1
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
88E1116 Initialized on egiga0
Using egiga0 device

==================================================

man page for kwboot

KWBOOT(1)                                                                                                            KWBOOT(1)

NAME
       kwboot - Boot Marvell Kirkwood SoCs over a serial link.

SYNOPSIS
       kwboot [-b image] [-p] [-t] [-B baudrate] [TTY]

DESCRIPTION
       The  kwboot program boots boards based on Marvell's Kirkwood platform over their integrated UART. Boot image files will
       typically contain a second stage boot loader, such as U-Boot. The image file must conform to Marvell's BootROM firmware
       image format (kwbimage), created using a tool such as .B mkimage.

       Following  power-up  or  a system reset, system BootROM code polls the UART for a brief period of time, sensing a hand‐
       shake message which initiates an image upload. This program sends this  boot  message  until  it  receives  a  positive
       acknowledgement. The image is transfered using Xmodem.

       Additionally,  this program implements a minimal terminal mode, which can be used either standalone, or entered immedi‐
       ately following boot image transfer completion. This is often useful to catch  early  boot  messages,  or  to  manually
       interrupt a default boot procedure performed by the second-stage loader.

OPTIONS
       -b image
              Handshake; then upload file image over TTY.

              Note  that  for the encapsulated boot code to be executed, image must be of type "UART boot" (0x69). Boot images
              of different types, such as backup images of vendor firmware downloaded from flash memory (type 0x8B), will  not
              work (or not as expected). See -p for a workaround.

              This mode writes handshake status and upload progress indication to stdout.

       -p     In combination with -b, patches the header in image prior to upload, to "UART boot" type.

              This  option  attempts on-the-fly conversion of some none-UART image types, such as images which were originally
              formatted to be stored in flash memory.

              Conversion is performed in memory. The contents of image will not be altered.

       -t     Run a terminal program, connecting standard input and output to TTY.

              If used in combination with -b, terminal mode is entered immediately following a successful image upload.

              If standard I/O streams connect to a console, this mode will terminate after receiving 'ctrl-\' followed by  'c'
              from console input.

       -B baudrate
              Adjust the baud rate on TTY. Default rate is 115200.

SEE ALSO
       mkimage(1)

AUTHORS
       Daniel Stodden <daniel.stodden@gmail.com>

                                                          2012-05-02                                                 KWBOOT(1)

References & Other:
http://www.solinno.co.uk/public/kwuartboot/
http://lists.debian.org/debian-arm/2011/10/msg00012.html
https://doukki.net/doku.php?id=wiki:tutoriels:u-boot.uart

=====================================================





Edited 5 time(s). Last edit at 05/06/2012 04:26PM by davygravy.
Attachments:
open | download - kwboot-tool.tar.gz (7.1 KB)
The UART boot works for NetGear OpenStora as well, ref this thread

Workaround for bootrom 1.11 is mentioned in a post in that thread and reproduced here, uncertain if this is universally applicable for other bootrom 1.11 devices, the post is reproduced here:

Tip: If you have an 88F6281 revision A0 CPU:

1. Power down the Stora.
2. Prepare picocom by hitting C+a C+e, then entering the u-boot uart filename BUT DON'T PRESS RETURN.
3. Press the Stora power button and count 1000, 2000, 3000.
4. Hit enter in picocom.
5. Success.

Works for me 99% of the time now. Suspect bootROM 1.21 waits to see if another bb11223344556677 comes around before declaring the uart boot process dead.

So it is possible, but it doesn't work in quite the same way as later CPUs.
Re: UART Booting HowTo for Selected Kirkwood Devices
May 07, 2012 06:18PM
openstoraU Wrote:
-------------------------------------------------------
> The UART boot works for NetGear OpenStora as well,
> ref
> http://www.openstora.com/phpBB3//viewtopic.ph
> p?t=1211]this thread
>
> Workaround for bootrom 1.11 is mentioned in a post
> in that thread and reproduced here, uncertain if
> this is universally applicable for other bootrom
> 1.11 devices, the post is reproduced here:
>
>
> Tip: If you have an 88F6281 revision A0 CPU:
> 
> 1. Power down the Stora.
> 2. Prepare picocom by hitting C+a C+e, then
> entering the u-boot uart filename BUT DON'T PRESS
> RETURN.
> 3. Press the Stora power button and count 1000,
> 2000, 3000.
> 4. Hit enter in picocom.
> 5. Success.
> 
> Works for me 99% of the time now. Suspect bootROM
> 1.21 waits to see if another bb11223344556677
> comes around before declaring the uart boot
> process dead.
> 
> So it is possible, but it doesn't work in quite
> the same way as later CPUs.
>


Something about this looks inconclusive/not-definitive... quoting the writer, the sentence just below/after what was posted above, makes the idea of UART-booting on the v1.11 BootROM machines look ... well... unsure and ... ???

Quote
justnine from www.openstora.com/phpBB3//viewtopic.php?t=1211
Works for me 99% of the time now. Suspect bootROM 1.21 waits to see if another bb11223344556677 comes around before declaring the uart boot process dead.

So it is possible, but it doesn't work in quite the same way as later CPUs.

edit: I have bootROM 1.11. And after a quick nand erase 0x0 0x2000, the device is back to refusing to boot.

That last sentence is a real show-stopper... First he says 1.21 BootROM, then 1.11. Which is it? In any case, this seems odd, since he said after that quick erase, it was refusing to boot. If this is what he meant, was it really working in the first place?

============================

I've tried this sequence repeatedly on a Pogoplug E02 and Dockstar and haven't been able to get it to work. If someone can show output for it and post a reproducible set of steps that works reliably on these machines, please post back. Thanks.

=====================================================





Edited 3 time(s). Last edit at 05/07/2012 06:56PM by davygravy.
Re: UART Booting HowTo for Selected Kirkwood Devices
June 15, 2012 12:20PM
This is nice!
I can use this to test my uBoot builds!

Only wish it worked for the Dockstar, and that Allwinner A10 had similar utility.
Maybe now that A10 is wildly popular Marvell will get off their butts and make a newer SoC like A10 that can use this utility.
But Marvell is going to be hurting badly after introduction of A10/A13. They probably lost a few contracts already. Why would anybody make a new plug/server/tablet/etc. using Marvell when A10/A13 is more powerful and likely way cheaper at $7/$5. Kirkwood and devices based on it are now already obsolete (though it will be fine for my servers for a good while!). So it would probably better for more tools to become available for A10. It is open source and was just released late last year, so only a matter of time for more A10 tools to be widely available. Hopefully new plugs and more boxes like this will come soon.

Thanks for the info davy!!
Re: UART Booting HowTo for Selected Kirkwood Devices
November 04, 2012 11:14AM
davygravy Wrote:
-------------------------------------------------------
>all machines with version 1.21 do support it, but none of the version 1.11

Is it possible to update Dockstar and other Plugs like Pogo to BootROM 1.21 and how?
Re: UART Booting HowTo for Selected Kirkwood Devices
November 05, 2012 05:29AM
sambul14 Wrote:

> Is it possible to update Dockstar and other Plugs
> like Pogo to BootROM 1.21 and how?

Nope, its not posible cause it is part of the hardware...
It`s work only over serial cable ?
I try this method over serial-to-usb adapter, and it stop after display in console "[Type Ctrl-\ + c to quit]".
I wait 1-2 min, but no another messages, no uboot prompt
I'll answer:)
In DNS-320 seems to tricky uartboot.

Tried with serial-to-low3.3v adapter on a real computer with Sabayon Linux x86 - works from time to time with some
magic. But when work, it work fast - load u-boot.kwb in 50-60 sec.

Tried with serial-to-low3.3v adapter on a VirtualBox with Sabayon Linux x86 - work always, without triks.
But slow, load u-boot.kwb in 7-10 min.

Tried with usb-to-low3.3v adapter on a VirtualBox with Sabayon Linux x86 - work always, without triks.
But after succes load , only see "[Type Ctrl-\ + c to quit]".

Many thanks to the author, I have updated u-boot without the risk of flash and get a brick
Greg Langford
Re: UART Booting HowTo for Selected Kirkwood Devices
August 19, 2013 04:48PM
I can confirm this works on the Synology DS213, I managed to brick mine and then bought her back from the dead. Remember be careful don't rely on this it is a very last resort.
Help im just stuck at "Sending boot message. Please reboot the target..."

How can i fix?
After this message you must turn on your device, if nothing - check which uboot used - uart or nand, if nand you should run kwboot with "-p" key.
Re: UART Booting HowTo for Selected Kirkwood Devices
October 15, 2013 04:30PM
Fma965 Wrote:
-------------------------------------------------------
> Help im just stuck at "Sending boot message.
> Please reboot the target..."
>
> How can i fix?

Which plug do you have? How did you run kwboot ? It is best if you can post the log of what you are doing so we can help!

-bodhi
===========================
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
bodhi's u-boot GitHub
bodhi's corner
Re: UART Booting HowTo for Selected Kirkwood Devices
December 27, 2013 06:02PM
I've bricked my GoFlex Net, following the advices within this thread:

http://forum.doozan.com/read.php?3,6965

I successfully downloaded the new u-boot image to the GFN
via tftp, then tried:

b. Erase and flash; execute

nand erase 0x0 0x80000
nand write.e 0x800000 0x0 0x80000


The write command failed (AFAIR something like "offset error"
was reported, maybe since I interpreted "0x800000" as a typo
and omitted one zero). Yeah. But luckily found this thread, so
there is probably still hope for that box.

Started a Knoppix distro running from a smaller thumb drive
succesfully so far, I had to face the next obstacle: it's a 32-bit
(debian based) system, not capable of running the kwboot
binary provided above.

It would be very nice if somebody here will provide me a
32-bit version of kwboot or at least points me to any
clue how to download and compile that tool.

TIA

Olaf
Re: UART Booting HowTo for Selected Kirkwood Devices
January 03, 2014 03:40PM
A happy new year to you guys.

Unfortunately my problem with kwboot is still pending.

I wasn't aware that my AMD C-50 netbook is capable of running
64bit-Linux (sorry, I didn't deal with Linux for a longer period of
time). But, changing over to the 64bit flavour of Knoppix let
me fail again.

The kwboot binary I downloaded here responded with:

bash: /usr/local/sbin/kwboot: Cannot execute file. (or so, I translated
on my own from german output: "Kann die Datei nicht ausführen.")

on that system. It also happens when kwboot is run from the local dir
with "./" invocation.

I guess that the problem must have to do with this:

$ uname -s -r
Linux 3.9.6-64

$ file `which kwboot`
/usr/local/sbin/kwboot: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.15 [...]

Will somebody please be so kind and point me to a Linux distro that's suitable?
Formerly I was somewhat familiar with SuSE, but I couldn't find anything that
might be into "kernel-2.6" on suse.com.

(meanwhile I am prepared to install such distro on my netbook, it has a bigger
HDD now with plenty of space).

Thanks for your attention

Olaf
Re: UART Booting HowTo for Selected Kirkwood Devices
January 04, 2014 04:36AM
Besides the GoFlex Net, do you have another Kirwood plug? or any ARM 32 based Linux box?

-bodhi
===========================
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
bodhi's u-boot GitHub
bodhi's corner
Re: UART Booting HowTo for Selected Kirkwood Devices
January 04, 2014 11:51AM
Hello Bodhi,

I have a Raspberry Pi laying around, but AFAIK it's ARM but no Kirkwood device.
And I'm thinking of getting an Arduino Yun, will that one probably help?

Am I really stuck with Linux on PC?

Olaf
Re: UART Booting HowTo for Selected Kirkwood Devices
January 04, 2014 12:23PM
Olaf,

Perfect! download this kwboot and run it from the Raspi:

kwboot
md5:
0efd011bdb244436e432a8de33e639a1

It's ARM.So it should work whether it's kirkwood or not.

-bodhi
===========================
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
bodhi's u-boot GitHub
bodhi's corner



Edited 1 time(s). Last edit at 01/04/2014 12:24PM by bodhi.
Re: UART Booting HowTo for Selected Kirkwood Devices
July 26, 2014 10:53PM
I'm getting the following. Anyone know what's going on? Thanks

[root@vader kwboot-tool]# kwboot -t /dev/ttyUSB0 -b uboot.bin
Sending boot message. Please reboot the target...|
Sending boot image...
  0 % [+++++++++++++++++xmodem: Bad message
Re: UART Booting HowTo for Selected Kirkwood Devices
July 27, 2014 04:26AM
Re: UART Booting HowTo for Selected Kirkwood Devices
July 27, 2014 09:30AM
I'm using a Pogoplug E02 to run the kwboot binary. I got the precompiled binary from davy's kwboot thread - http://forum.doozan.com/read.php?3,7852,7852

Serial is connected to my Pogoplug Mobile 4 which I'm experimenting with. The uboot.bin is from Pogoplug v4 Arch Linux ARM installation scripting (http://archlinuxarm.org/os/ppv4/ppv4-install.sh),specifically this bin - http://archlinuxarm.org/os/ppv4/uboot.bin.gz. Should I try a different uboot file?

Thanks for the help.
Re: UART Booting HowTo for Selected Kirkwood Devices
July 27, 2014 03:49PM
grayman4hire,

You should try my latest u-boot Pogo V4 build.
./kwboot-tool/kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2014.07-tld-1.pogo_v4.mtd0.kwb -p

And here is how you boot the Pogo Mobile (it is different from other Kirkwood boxes, a little bit flaky):

- Start kwboot on a different Linux box using the above command.
- Power up the Pogo V4/Mobile.
- Within 1-2 seconds when the spinning | starts slowing down (but not too soon), Control-C to abort kwboot, and recall the command, execute kwboot again.
- Repeatedly run kwboot this way for a few times, it will handshake successfully eventually.

-bodhi
===========================
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
bodhi's u-boot GitHub
bodhi's corner



Edited 2 time(s). Last edit at 07/27/2014 04:03PM by bodhi.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: