Upgrading your GTA02 u-boot in 20 easy steps
Werner Almesberger
werner at openmoko.org
Tue Jan 29 16:48:28 CET 2008
There have been the following major changes to u-boot in the last
hours:
- We have a new partition layout on GTA02, with a larger kernel
partition and a new "factory" partition. Unfortunately, upgrading to
the new layout will require deleting the entire NAND content.
- "mtdparts" now correctly reflects the NOR, without needing any extra
fiddling. Since the boot parameter line is now very long and kept on
getting truncated, I've also increased the maximum u-boot command
length (which also limits the length of variables) from 256 characters
to 1024.
- On GTA02, u-boot now uses the USB vendor ID of OpenMoko. This means
that "old" and this "new" u-boot will not recognize each other's
UDFU signatures and thus refuse attempts to "dfu-util -a u-boot -D"
the respective other version.
- When booting from NOR, the u-boot environment in NAND is ignored, and
the default environment built into u-boot is used instead.
Since some of these changes mean that this is a fairly disruptive update,
I'd suggest to just replace the entire NAND content. At the same time,
we set up u-boot in NOR, so future updates should be more convenient.
NOTE: All this is only about GTA02. For GTA01, nothing changes.
(I hope ;-)
GTA02 upgrade
-------------
Here are the step-by-step instructions for making the upgrade. Please read
them carefully before starting.
1) build the latest u-boot, e.g., using
http://svn.openmoko.org/trunk/src/target/u-boot/scripts/update
WARNING ! Make sure your u-boot is configured for the correct hardware.
You can check this with
host# cat u-boot/include/config.h
This update process does not include the sanity checks that normally
prevent accidents during u-boot updates.
2) build a recent 2.6.24 kernel, e.g., using
http://svn.openmoko.org/branches/src/target/kernel/2.6.24.x/scripts/build
3) obtain a recent rootfs image, e.g.,
http://buildhost.openmoko.org/daily/neo1973/deploy/glibc/images/neo1973/openmoko-devel-image-fic-gta02.jffs2
4) start the GTA02 and halt it in u-boot, pressing a key at the
respective console when u-boot asks for it, e.g.,
host# neocon -t 30 /dev/ttyACM{0,1,2}
(start the GTA02)
(keep pressing keys on the host until "neocon" says "[Open]")
Hit any key to stop autoboot: 3
(press one more key)
GTA02v3 #
"neocon" is in http://svn.openmoko.org/developers/werner/neocon/
5) install the kernel on the GTA02, e.g., with
host# dfu-util -a kernel -R -D linux-2.6.24/arch/arm/boot/uImage
6) install the rootfs on the GTA02, e.g., with
host# dfu-util -a rootfs -R -D openmoko-devel-image-fic-gta02.jffs2
7) boot the GTA02 into Linux, e.g.,
GTA02v3 # boot
(If "neocon" is already running, press a key to make it reconnect
after the DFU sessions.)
8) set up "Ethernet over USB" networking, e.g.,
host# ifconfig usb0 192.168.0.200 up
9) transfer a copy of u-boot to the GTA02, e.g.,
host# scp u-boot/u-boot.udfu 192.168.0.202:
Password: [Hit enter]
10) log on to the GTA02, e.g.,
host# ssh root at 192.168.0.202
Password:
root at fic-gta02:~$
11) write the u-boot binary to NOR, e.g.,
root at fic-gta02:~$ flash_unlock /dev/mtd0
root at fic-gta02:~$ flash_eraseall /dev/mtd0
root at fic-gta02:~$ cat u-boot.udfu >/dev/mtd0
12) restart the GTA02 while holding down the AUX button, e.g.,
root at fic-gta02:~$ /sbin/reboot -f
The u-boot start messages should look like this:
...
NAND: 128 MiB
NOR boot, using default environment
...
mtdparts variable not set, see 'help mtdparts'
mtdparts variable not set, see 'help mtdparts'
13) access the u-boot console, e.g.,
host# neocon -t 30 /dev/ttyACM{0,1,2}
(Or, if "neocon" is already running, press a key to reconnect.)
14) check that the environment is the default environment, e.g.,
GTA02v3 # echo ${mtdparts}
This must yield an empty line. If you get different output, you
didn't boot from NOR. Please return to step 7) and retry.
15) erase the Flash and set up a new environment, e.g.,
GTA02v3 # nand erase
Really erase everything ? <y/N>
GTA02v3 # dynpart
GTA02v3 # dynenv set u-boot_env
GTA02v3 # saveenv
16) upload u-boot to NAND, e.g.,
host# dfu-util -a 1 -R -D u-boot/u-boot.udfu
17) reset the GTA02 and watch it try to boot:
...
Bad Magic Number
GTA02v3 #
You'll notice that the kernel now loads more slowly than before.
This is because we load the content of the entire partition, which
has grown as a result of the upgrade. We'll fix this later.
18) install kernel and rootfs, as described in steps 5 and 6.
If you're ambitious, you could also install a splash image.
19) reset the GTA02 and watch it boot into Linux.
20) Have a beer :-)
Recovery using NOR
------------------
In the future, if the device is "bricked", performing steps 12 through
20 (or a subset/variation thereof, depending on how much needs fixing)
will let you restore the GTA02, without even opening the case.
(Note: in these development prototypes, the hardware write protection
of the NOR Flash is not active yet. This means that is could be
clobbered by accident.)
Going back
----------
If there's a major problem with u-boot, this is how one can roll back
to an older version:
1) bring up u-boot (from NAND or NOR) and halt it
2) upload u-boot to RAM:
dfu-util -a 0 -R -D u-boot/u-boot.udfu
3) at the u-boot console, enter
GTA02v3 # dynpart
GTA02v3 # nand write.e 0x32000000 u-boot
It may look like a brick, but ...
---------------------------------
Is the device completely bricked and even NOR is dead ? No problem.
1) connect the debug board.
2) power up the GTA02.
3) fire up OpenOCD, e.g.,
host# cd /where/openocd.cfg/lives
An example openocd.cfg can be downloaded from
http://people.openmoko.org/werner/openocd.cfg
4) connect to OpenOCD and bring up u-boot:
host# telnet localhost 4444
> reset halt
> wait_halt
> load_binary u-boot/board/neo1973/gta02/lowlevel_foo.bin 0
> bp 0x33f80000 4 hw
> resume
> wait_halt
> load_binary u-boot/u-boot.udfu 0x33f80000
> resume
The download should take about 30 seconds.
5) u-boot is now starting. Get its attention and perform the
recovery.
That's all folks ! Have fun ! :-)
- Werner
More information about the openmoko-kernel
mailing list