==to use automated build method==
after setting up [[gcc cross compiler (armhf)]], we need to git clone, build and install.

===clone===
 luna-itc-uboot2013 in git.g77k.com

===build===
 cd luna-itc-uboot2013
 ./build.sh

===install===
modify device location inside install.sh script and run
 ./install.sh

== U-boot introduction ==

U-boot is from denx [http://www.denx.de/wiki/U-Boot] and used as defualt bootload from TI

== u-boot Image file ==
# MLO
# u-boot.img

== Build u-boot ==

 export PATH=/opt/arm-2010.09/bin:${PATH}
 export CROSS_COMPILE=arm-none-linux-gnueabi-
 make am335x_evm



==uboot & MLO guide ==
* guide: http://elinux.org/Panda_How_to_MLO_%26_u-boot
* slide: http://beagle.s3.amazonaws.com/esc/Uboot-esc-chicago-2010.pdf

==eeprom datastructure==
arch/arm/include/asm/arch-am33xx/sys_proto.h
<pre>
struct am335x_baseboard_id {
        unsigned int  magic;
        char name[HDR_NAME_LEN];
        char version[4];
        char serial[12];
        char config[32];
        char mac_addr[HDR_NO_OF_MAC_ADDR][HDR_ETH_ALEN];
};
</pre>


===adding printing eeprom===
<pre>
        printf("########## DEBUG c2h2: printing eeprom header ##################\n");
        printf("magic = %x\n",        header.magic);
        printf("name = %.*s\n", 8,    header.name);
        printf("version = %.*s\n", 4, header.version);
        printf("serial = %.*s\n", 12, header.serial);
        printf("config = %.*s\n", 32, header.config);
        printf("mac = (not imp)\n");
        printf("########## END DEBUG c2h2 ##################\n");
</pre>

===printing on beaglebone ===
<pre>
########## DEBUG c2h2: printing eeprom header ##################
magic = ee3355aa
name = A335BONE
version = 00A5
serial = 0812BB000113
config = 
mac = (not imp)
########## END DEBUG c2h2 ##################
</pre>

on a A5A
<pre>
########## DEBUG c2h2: printing eeprom header ##################
magic = ee3355aa
name = A335BONE
version = 00A5
serial = 1912BB000014
config = 
mac = (not imp)
########## END DEBUG c2h2 ##################
</pre>

===printing on starter kit ===
<pre>
########## DEBUG c2h2: printing eeprom header ##################
magic = ee3355aa
name = A335X_SK
version = 1.2B
serial = 45124P196856
config = SKU#00FFFFFFFFFFFFFFFFFFFFFFFFFF
mac = (not imp)
########## END DEBUG c2h2 ##################
</pre>

==overclocking==
serach: MPUPLL_M_720


==command to write NAND in u-boot==
<pre>

mmc rescan 
fatload mmc 0 0x82000000 MLO 
nandecc hw 2
nand erase 0x0 0x20000
nand write.i 0x82000000 0x0 0x20000
mw.b 0x82000000 0 0x20000

mmc rescan
fatload mmc 0 0x82000000 u-boot.img
nandecc hw 2
nand erase 0x80000 0x40000
nand write.i 0x82000000 0x80000 0x40000
mw.b 0x82000000 0 0x40000

mmc rescan
fatload mmc 0 0x82000000 uImage
nandecc hw 2
nand erase 0x00280000 0x00500000
nand write.i 0x82000000 0x00280000 0x500000
mw.b 0x82000000 0 0x500000

mmc rescan
fatload mmc 0 0x82000000 ubi.img
nandecc hw 2
nand erase 0x780000 0xf880000
nand write.i 0x82000000 0x780000 0x1200000

</pre>


==make uboot functions==
see the patch:

http://e2e.ti.com/support/arm/sitara_arm/f/791/t/208040.aspx


==uboot ecc==
see this
AM335X 更改NAND ecc 纠错位数
http://www.deyisupport.com/question_answer/dsp_arm/sitara_arm/f/25/t/18179.aspx

Patch for 16-bit BCH ECC in StarterWare
http://e2e.ti.com/support/arm/sitara_arm/f/791/t/241321.aspx