By Bill » Saturday, January 16 2010, 13:41
The bootloader that comes factory installed on the Micro2440 and the Mini2440 board is called Supervivi. I don't personally like it. It has very limited support and requires a YAFFS filesystem for the root filesystem. So when I bought my board I began to immediately search out an alternative. The bootloader by choice, it seems, is a modified version of U-Boot with modifications for the Mini2440 board's hardware
The code is maintained by a guy named buserror. I'll provide his information at the end of this howto.
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.
Step 3: Modify the source to disable CONFIG_USE_IRQ. Open include/configs/mini2440.h.
#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
Assuming this all compiles correctly, you will have a u-boot.bin file in your directory now as well as a 2k and 16k block size bin file. Those two are for flashing inside of U-Boot. The normal .bin is for flashing from ram from within supervivi.
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.
5j Create the dynamic environment space for u-boot.
MINI2440# dynenv set u-boot_env
5k. Save the environment to NAND.
You 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.
You should have a working u-boot... I'm currently getting an error about it not seeing my nand but it seems to be able to access it. Maybe you guys can let me know if you see anything wrong. I am suspecting there is a problem with the new u-boot code. Maybe buserror can shed some light on this.
Questions? Comments? Need Help? Go to my forum and ask there.