UBoot must usually be installed in a Flash memory to be
executed by the hardware. Depending on the hardware, the installation of UBoot
is done in a different way
The board provides some kind of specific boot monitor, which allows to flash the second stage bootloader. In this case, refer to the board documentation and tools UBoot is already installed, and can be used to Flash a new version of UBoot.
However, be careful: if the new version of UBoot doesn't work, the board is unusable
The board provides a JTAG interface, which allows to write to the
Flash memory remotely, without any system running on the board. It
also allows to rescue a board if the boot loader doesn't work.
At the time of writing this, I had some issues with getting Buserror's U-Boot working correctly.
The code that is in his git repository, doesn't run from RAM without a modification to the source. So here are the instructions that I gathered for altering and compiling it, and getting it going on the Mini2440 and Micro2440 board.
For this to work, I'm going to assume that you have a crosscompiler set up. Later on, I will probably write an entry here about setting that up, but not now. I'm also assuming you have git installed.
Step 1: Get the source
mkdir uboot ;
cd uboot git clone git://repo.or.cz/u-boot-openmoko/mini2440.git
Step 2: Set your cross compiler prefix so you don't end up compiling this for x86.
export CROSS_COMPILE=arm-none-linux-gnueabi-
Step 3: Modify the source to disable CONFIG_USE_IRQ.
#define USE_920T_MMU //#define CONFIG_USE_IRQ 1 /* Needed for USB device! */
Disabling this obviously disables the use of USB During boot. You can fix this by reflashing a normal copy of
u-boot from within u-boot once this is up and running. In the above example, I commented it out but you can
probably just change the 1 to a 0.
Step 4: Make and compile.
cd ../../ make mini2440_config make
Step 5: Flashing u-boot to the mini2440. In this example, we'll be using DMW for Windows to transfer the binary over to the board with the supplied USB cable.
5a. Set boot switch to NOR.
5b. When supervivi pops up, hit q for supervivi shell.
5c. Load the image in to ram at 0x32000000 (6 zeros) memory location.
shell> load ram 0x32000000 <uboot bin size in bytes> u-boot
5d. Use DNW to transfer the u-boot.bin from your computer to the board.
5e. Execute the loaded bin file you loaded in to RAM.
shell> go 0x32000000
5f. You should now be inside u-boot at a MINI24440# prompt. Now we prepare the NAND.
MINI2440# nand scrub
5g. Create the bad block table.
MINI2440# nand createbbt
5h. Write the u-boot that we're running at 0x32000000, to the NAND.
MINI2440# nand write.e 0x32000000 0x0 <u-boot bin size in hex>
5i. Partition the NAND.
MINI2440# dynpart
MINI2440# dynenv set u-boot_env
5k. Save the environment to NAND.
MINI2440# saveenvYou can now set the boot switch back to NAND and reboot the system. It should pop up with U-Boot and give you a MINI2440# uboot prompt. From this point on you can do all your work inside U-boot for loading images for the kernel and for the filesystem. I would like to note though, that in the above examples, you need to know your u-boot bin file size in both bytes and in hex. You can use google to convert the file size in bytes to hex. (i.e. "233907 to hex" in the google search box). I recommend trying to run u-boot without the source modification first before disabling IRQ because I'm guessing at some point, buserror or someone else will figure out why it won't run from RAM with that enabled. If it fails, and you can always modify the source and recompile.
I'd like to note that I collected these instructions from various sites and I've re-worded and explained them some to help. I hope that this helps you.
Here are some useful links for u-boot and other things:
http://bliterness.blogspot.com/ - Busseror's blog
http://code.google.com/p/mini2440/ ... - Buserror's Google code page.
http://repo.or.cz/w/openembedded/mi... - Git repository for the modified Openembedded
http://repo.or.cz/w/u-boot-openmoko... - Git repository for u-boot
UPDATE: MAY 8th, 2010: As of writing this update, the code in the git repository already has the above modification to the code. If you for any reason require USB support on your bootloader, you will need to uncomment the line that is commented out above and recompile.
UPDATE MAY 31st, 2010: There have been some problems with the current repository code and it won't run from RAM for some devices. So here's a quick workaround.
- 1. Switch the system to NOR and boot with supervivi.
- 2. hit v in supervivi
- 3. i uploaded the u-boot.bin file
- 4. switch the system to NAND and boot up with u-boot. You'll get some errors.
- 5. Run nand scrubs and createbbt
- 6. switch back to NOR
- 7. hit v again and upload U-boot since you just erased it.
- 8. switch back to nand and it should boot up with minimal errors using u-boot.
- 9. run the dynpart and dynenv and saveenv as mentioned above.
original source bills Sargent