U-Boot/Legacy U-Boot

Initially developed by Tom Cubie and now developed and maintained by Henrik Nordström the u-boot support comes in two branches, one with NAND and android stuff(boot.img, fastboot) support and another with MMC-only ( aka SD ) support, which is more the traditional linux style.

For details see the linux-sunxi u-boot wiki.

Compilation
First of all you need a suitable toolchain installed and added to your PATH. Then proceed as follows.

git clone https://github.com/linux-sunxi/u-boot-sunxi.git
 * Clone sunxi version of u-boot git repository:


 * Go to the project directory and execute the build commands. Replace the board name in the first command with the one you are working with. Cubieboard is used in this example.

make CROSS_COMPILE=arm-linux-gnueabihf- Cubieboard

After finishing you'll find compiled files required for booting at spl/u-boot-spl.bin and u-boot.bin.

u-boot nand environment
Example u-boot environment from a stock android u-boot environment partition

bootdelay=0 bootcmd=run setargs boot_normal console=ttyS0,115200 nand_root=/dev/nandc mmc_root=/dev/mmcblk0p4 init=/init loglevel=8 setargs=setenv bootargs console=${console} root=${nand_root} init=${init} loglevel=${loglevel} boot_normal=nand read 40007800 boot;boota 40007800 boot_recovery=nand read 40007800 recovery;boota 40007800 boot_fastboot=fastboot

set u-boot environment variable
When setting environment variable in uboot, you must not place the '=' sign between variable name and value you want to asign.

setenv root /dev/sda1

When you display environment variable, you will see a '='

root=/dev/sda1