flash image from SD card

Werner Almesberger werner at openmoko.org
Tue Apr 1 07:39:21 CEST 2008

I wrote:
> - I can write a special erase tool that preserves the OOB data

Even better, I can simply write a tool to set the environment pointer.
I just did that :-)

(revision 4288)

Example session:

    # First, we erase the u-boot partition and put the new u-boot there.

    root at om-gta02:~# flash_eraseall /dev/mtd1
    Erasing 128 Kibyte @ 20000 -- 50 % complete.
    root at om-gta02:~# nandwrite -p /dev/mtd1 u-boot.udfu 
    Writing data to block 0
    Writing data to block 20000

    # Let's check the environment pointer.

    root at om-gta02:~# ./dynenv /dev/mtd1
    environment pointer marker is absent

    # Nothing there, of course. Now we put it back, taking into account
    # that the offset of the environment partition is just the size of
    # the u-boot partition.

    root at om-gta02:~# ./dynenv /dev/mtd1 0x`awk '/mtd1/{print $2}' </proc/mtd`

    # Lo and behold, it's back now.

    root at om-gta02:~# ./dynenv /dev/mtd1

- Werner

More information about the openmoko-kernel mailing list