The bootloader supplied with Balloon is 'Bootldr' from handhelds.org. This is quite a full-featured loader and thus is relatively fat (200K for a full build, although you can build much smaller versions by configuring out things you don't need).
The bootloader lives in the NOR flash.
It is configured with 3 partitions as standard:
- bootldr - (256K) in NOR flash - holds the bootloader
- boot - (1Mb) - in NAND flash - holds a compressed kerenel
- root - (63MB) - in NAND flash -root filesystem
To install a new bootloader image you can use bflash/jflash to upload it over JTAG (very slow) or you can also do it from the boot> prompt: Bootldr can download a new copy of itself by xmodem and replace itself. Be aware that if you do this and the new version doesn't work then your balloon is useless and you need a JTAG dongle to upload a new bootloader.
The command is
boot> load bootldr
Then start your xmodem download.
Balloons have been shipped with various versions on bootldr. You can find the current version with the ver command:
Balloon BootLoader, Rev 3-0-0-aleph1 for Balloon [BIG_KERNEL] [MD5] [NAND] [YAFFS] [MONO] Last link date: Tue Jul 18 17:16:41 BST 2006 Contact: email@example.com
The items in square brackets show which functions have been built in to this version. So the above version suporrts nand access, the yaffs filesystem, mono audio, md5sums and big kernels.
Will show you bootloader commands although for some subcommands you just need to know, so here are the the nand and yaffs subcommands
nand [0|1|2|3] - shows the chips detected. A number will specify just showing info for that device.
nand init - reinitialises the nand interface
nand nocache|icache|dcache|bothcache - enables/dsiables instruction and data caches
nand [force_erase] erasechip|eraseblocks <from> <to> - erases the nand chip or specified blocks, preserving bad block markers. If force_erase is specified then the bad block markers are erased too. Don't do this unless you know what you are doing. It can be necessary when doing yaffs development and you have erroneously marked a load of blocks bad.
nand size - display nand size
nand scanblocks [show] - scan nand for bad blocks - it will print out how many were good and how many are marked bad. 'show' will give the list of bad ones
nand browse|browseecc <page> - shows nand contents and OOB values in hex. Space shows next page. 'q' quits. It will timeout back to the boot> prompt after a minute or so.
nand markbadblock <address> - marks the block continaing the address given as bad
nand read [<address>] - reads nand block a t given address
nand write <address> <data> - writes data byute at given address
nand yaffs [save] [gzip] <partition> - loads yaffs image to given partition (or first one if none given).
If things are working you should see this first:
U3 @00000344 F04000000
U3 indicates that UART 3 (console serial port) is enabled
@00000344 shows the current address that is being executed: 0x344
F04000000 shows that the bootloader is running from Flash ('D' would indicate DRAM) and that the Flash size is 0x4000000 (64MB)
Then there is a memory test, indicated by
*MTST 00000001 ... 80000000
(it counts up through each bit from 00000001 to 80000000). Then the 2nd memory bank
MBK2 00000001 ... 80000000 ENDM
Next we get
which shows the stack pointer address at the point the bootloader moves from assembler to C code. Followed by details of the Flash memory and the bootloader version and CPU/machine type.
If you see something like this:
DABT 0001F634 FFFFFFF7
Then your bootloader is broken. This is how it shows a Data Abort (DABT). The first line is the address of the instruction that was executing when it blew up and the second line is the address that was being accessed.