1With this approach, we don't need the UBL any more on DaVinci boards. 2A "make boardname" will compile a u-boot.ubl, with UBL Header, which is 3needed for the RBL to find the "UBL", which actually is a UBL-compatible 4header, nand spl code and u-boot code. 5 6 7As the RBL uses another read function as the "standard" u-boot, 8we need a command, which switches between this two read/write 9functions, so we can write the UBL header and the spl 10code in a format, which the RBL can read. This is realize 11(at the moment in board specific code) in the u-boot command 12nandrbl 13 14nandrbl without arguments returns actual mode (rbl or uboot). 15with nandrbl mode (mode = "rbl" or "uboot") you can switch 16between the two NAND read/write modes. 17 18 19To set up mkimage you need a config file for mkimage, example: 20board/ait/cam_enc_4xx/ublimage.cfg 21 22For information about the configuration please see: 23doc/README.ublimage 24 25Example for the cam_enc_4xx board: 26On the cam_enc_4xx board we have a NAND flash with blocksize = 0x20000 and 27pagesize = 0x800, so the u-boot.ubl image (which you get with: 28"make cam_enc_4xx") looks like this: 29 3000000000 00 ed ac a1 20 00 00 00 06 00 00 00 05 00 00 00 |.... ...........| 3100000010 00 00 00 00 20 00 00 00 ff ff ff ff ff ff ff ff |.... ...........| 3200000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 33* 3400000800 14 00 00 ea 14 f0 9f e5 10 f0 9f e5 0c f0 9f e5 |................| 3500000810 08 f0 9f e5 04 f0 9f e5 00 f0 9f e5 04 f0 1f e5 |................| 3600000820 00 01 00 00 78 56 34 12 78 56 34 12 78 56 34 12 |....xV4.xV4.xV4.| 37[...] 38* 3900001fe0 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff |................| 4000001ff0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| 41* 4200003800 14 00 00 ea 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 |................| 4300003810 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 |................| 4400003820 80 01 08 81 e0 01 08 81 40 02 08 81 a0 02 08 81 |........@.......| 45 46In the first "page" of the image, we have the UBL Header, needed for 47the RBL to find the spl code. 48 49The spl code starts in the second "page" of the image, with a size 50defined by: 51 52#define CONFIG_SYS_NROF_PAGES_NAND_SPL 6 53 54After the spl code, there comes the "real" u-boot code 55@ (6 + 1) * pagesize = 0x3800 56 57------------------------------------------------------------------------ 58Setting up spl code: 59 60/* 61 * RBL searches from Block n (n = 1..24) 62 * so we can define, how many UBL Headers 63 * we write before the real spl code 64 */ 65#define CONFIG_SYS_NROF_UBL_HEADER 5 66#define CONFIG_SYS_NROF_PAGES_NAND_SPL 6 67 68#define CONFIG_SYS_NAND_U_BOOT_OFFS ((CONFIG_SYS_NROF_UBL_HEADER * \ 69 CONFIG_SYS_NAND_BLOCK_SIZE) + \ 70 (CONFIG_SYS_NROF_PAGES_NAND_SPL) * \ 71 CONFIG_SYS_NAND_PAGE_SIZE) 72------------------------------------------------------------------------ 73 74Burning into NAND: 75 76step 1: 77The RBL searches from Block n ( n = 1..24) on page 0 for valid UBL 78Headers, so you have to burn the UBL header page from the u-boot.ubl 79image to the blocks, you want to have the UBL header. 80!! Don;t forget to switch to rbl nand read/write functions with 81 "nandrbl rbl" 82 83step 2: 84You need to setup in the ublimage.cfg, where the RBL can find the spl 85code, and how big it is. 86 87!! RBL always starts reading from page 0 !! 88 89For the AIT board, we have: 90PAGES 6 91START_BLOCK 5 92 93So we need to copy the spl code to block 5 page 0 94!! Don;t forget to switch to rbl nand read/write functions with 95 "nandrbl rbl" 96 97step 3: 98You need to copy the u-boot image to the block/page 99where the spl code reads it (CONFIG_SYS_NAND_U_BOOT_OFFS) 100!! Don;t forget to switch to rbl nand read/write functions with 101 "nandrbl uboot", which is default. 102 103On the cam_enc_4xx board it is: 104#define CONFIG_SYS_NAND_U_BOOT_OFFS (0xc0000) 105 106-> this results in following NAND usage on the cam_enc_4xx board: 107 108addr 109 11020000 possible UBL Header 11140000 possible UBL Header 11260000 possible UBL Header 11380000 possilbe UBL Header 114a0000 spl code 115c0000 u-boot code 116 117The above steps are executeed through the following environment vars: 118(using 80000 as address for the UBL header) 119 120pagesz=800 121uboot=/tftpboot/cam_enc_4xx/u-boot.ubl 122load=tftp 80000000 ${uboot} 123writeheader nandrbl rbl;nand erase 80000 ${pagesz};nand write 80000000 80000 ${pagesz};nandrbl uboot 124writenand_spl nandrbl rbl;nand erase a0000 3000;nand write 80000800 a0000 3000;nandrbl uboot 125writeuboot nandrbl uboot;nand erase c0000 5d000;nand write 80003800 c0000 5d000 126update=run load writeheader writenand_spl writeuboot 127 128If you do a "run load update" u-boot, spl + ubl header 129are magically updated ;-) 130 131Note: 132- There seem to be a bug in the RBL code (at least on my HW), 133 In the UBL block, I can set the page to values != 0, so it 134 is possible to burn step 1 and step 2 in one step into the 135 flash, but the RBL ignores the page settings, so I have to 136 burn the UBL Header to a page 0 and the spl code to 137 a page 0 ... :-( 138- If we make the nand read/write functions in the RBL equal to 139 the functions in u-boot (as I have no RBL code, it is only 140 possible in u-boot), we could burn the complete image in 141 one step ... that would be nice ... 142