1. NAND
注意在uboot里面写ubl要先打补丁。针对EEC。。
块擦除: 128K+4K Bytes 块的大小 128K = 0x2 0000
页: 2K + 64 byte 页大小2K = 0x800
UBL页数 20,480 /2112 = 15个pages.
|
|
address offset |
Value |
Description |
块0 |
|
0x0 |
|
CIS/IDI block? |
块1 |
页0 |
0x00021000 |
a1aced00 00000100 0000000F 00000001 |
UBL signature |
|
|
|
|
|
|
页1 |
0x00021840 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Page 0 Address |
Value |
Address |
32-Bits |
Description |
0 |
a1aced00 |
|
0xA1AC EDxx |
Magic number (0xA1ACEDxx) |
4 |
|
Entry Point Address of UBL |
Entry point address for the user bootloader (absolute address) |
|
8 |
|
Number of pages in UBL |
Number of blocks (size of user bootloader in number of blocks) |
|
12 |
|
Starting Block # of UBL |
Block number where user bootloader is located |
|
16 |
|
Starting Page # of UBL |
Page number where user bootloader is present |
|
20 |
|
|
PLL settings -M |
PLL setting -Multiplier (only valid is Magic Number indicates PLL enable) |
24 |
|
|
PLL settings -N |
PLL setting -Divider (only valid is Magic Number indicates PLL enable) |
28 |
|
|
Fast EMIF setting |
Fast EMIF settings(only valid is Magic Number indicates fast EMIF boot) |
|
|
|
|
|
1.2. 擦除整片NAND
nand scrub.chip
Erasing at 0x4280000 -- 52% complete.
nand_erase: Failed erase status = c1, page 0x00008740
nand0: MTD Erase failure: -5
注意先擦除再写第二次!!!
1.3. 写ubl描述符
nand erase 0x20000 0x10
读取SD卡的 UBL描述符(位于第1块.不是第0块! 块大小0x200)
mmc[1] read 0 0x80700000 1 1
查看
md 0x80700000
80700000: a1aced00 00000100 00000028 00000075
80700010: 00000000 00000000 00000000 00000000
a1aced00 00000100 0000000F 00000002 00000000
修改 Page 0 Address = 12 (75) 处为第2块:
nm.b 0x80700008
F
q
nm.b 0x8070000C
2
q
修改 75 为1 : 由于地址对齐,(75) 不是 0x8070000F ,而是 0x8070000C
80700000: a1aced00 00000100 00000028 00000075
写ubl描述符前16字节(0x10)到nand中的第1块 (BLOCK ERASE : 128K+4K Bytes 块的大小 128K = 0x20000)
nand[2] write 0x80700000 0x20000 0x10
16 bytes : sd描述符
32 bytes : nand描述符
查看
nand[3] read 0x80700000 0x20000 10
md 0x80700000
2. 写ubl内容
读取SD卡 第75块(0xEA00处)的内容(为ubl的实际内容) 30K = 30,720 = 0x7800 = 0x3C 个块(SD块大小0x200)到内存:
mmc read 0 0x80700000 75 0x3C
写这些内容到nand的第2块中:
nand write 0x80700000 0x40000 0x7800
UBL内容开始地址20000+800 = 0x20800
UBoot内容开始地址 0x320800
*********************************************************************
[1] mmc read dev_no dest_address start_block block_count
[2] nand write mem_address flash_offset size
[3] nand read mem_address flash_offset size