U-Boot
From Gumstix User Wiki
Revision as of 16:45, 11 March 2010 by Ashcharles (Talk | contribs) (Created page with '== boot.scr == On boot, U-Boot looks for a file called ''boot.scr'' which it will try to run. Users can create such a script to do boot time configuration of the board, do low-l…')
boot.scr
On boot, U-Boot looks for a file called boot.scr which it will try to run. Users can create such a script to do boot time configuration of the board, do low-level testing, or set up the U-Boot environment. A common use case is to do a one-time configuration and reflash of boards to be deployed without microSD cards.
For example, this script flashes a new x-load, U-Boot, and kernel image to an Overo board. If it is mounted on an expansion board with LEDs, the blue one will light up if the script completes successfully or a red one will light up if the script fails. The following files should be loaded on a microSD card (taking care to copy over x-load first):
* x-load-new * mlo * u-boot * u-boot-new * uimage-new
setenv success 1 setenv loadaddr 0x82000000 setenv ext new # clear daughter card LEDs (GPIO21 and GPIO22) mw 48310034 ff9fffff mw 48310094 00600000 # Two notes: # 1. FAT file-systems handle letter case strangely---we should use # lower-case only # 2. x-load should be copied first to the microSD card otherwise U-Boot # doesn't see it. if mmc init; then echo "Flashing uimage${ext}..." nandecc sw nand erase if fatload mmc 1 ${loadaddr} uimage${ext}; then nand write ${loadaddr} 0x00200000 0x00500000 else echo "ERROR: couldn\'t find uimage${ext}..." setenv success 0 fi echo "Flashing u-boot${ext}.bin..." if fatload mmc 1 ${loadaddr} u-boot${ext}.bin; then nand write ${loadaddr} 0x00080000 0x001c0000 else echo "ERROR: couldn\'t find u-boot${ext}.bin..." setenv success 0 fi echo "Flashing x-load${ext}..." if fatload mmc 1 ${loadaddr} x-load${ext}; then nandecc hw nand write ${loadaddr} 0x00000000 0x00080000 else echo "ERROR: couldn\'t find x-load${ext}..." setenv success 0 fi else echo "Please insert a microSD and reboot the board" setenv success 0 fi # display error condition if test $success -eq 1; then # SUCCESS: light up LED on GPIO22 mw 48310090 00400000 echo "COMPLETED SUCCESSFULLY" else # ERROR: light up LED on GPIO21 mw 48310090 00200000 echo "COMPLETED WITH ERRORS" fi