]>
Commit | Line | Data |
---|---|---|
4dd83490 HS |
1 | With this approach, we don't need the UBL any more on DaVinci boards. |
2 | A "make boardname" will compile a u-boot.ubl, with UBL Header, which is | |
3 | needed for the RBL to find the "UBL", which actually is a UBL-compatible | |
4 | header, nand spl code and u-boot code. | |
5 | ||
6 | ||
7 | As the RBL uses another read function as the "standard" u-boot, | |
8 | we need a command, which switches between this two read/write | |
9 | functions, so we can write the UBL header and the spl | |
10 | code in a format, which the RBL can read. This is realize | |
11 | (at the moment in board specific code) in the u-boot command | |
12 | nandrbl | |
13 | ||
14 | nandrbl without arguments returns actual mode (rbl or uboot). | |
15 | with nandrbl mode (mode = "rbl" or "uboot") you can switch | |
16 | between the two NAND read/write modes. | |
17 | ||
18 | ||
19 | To set up mkimage you need a config file for mkimage, example: | |
20 | board/ait/cam_enc_4xx/ublimage.cfg | |
21 | ||
22 | For information about the configuration please see: | |
23 | doc/README.ublimage | |
24 | ||
25 | Example for the cam_enc_4xx board: | |
26 | On the cam_enc_4xx board we have a NAND flash with blocksize = 0x20000 and | |
27 | pagesize = 0x800, so the u-boot.ubl image (which you get with: | |
28 | "make cam_enc_4xx") looks like this: | |
29 | ||
30 | 00000000 00 ed ac a1 20 00 00 00 06 00 00 00 05 00 00 00 |.... ...........| | |
31 | 00000010 00 00 00 00 20 00 00 00 ff ff ff ff ff ff ff ff |.... ...........| | |
32 | 00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| | |
33 | * | |
34 | 00000800 14 00 00 ea 14 f0 9f e5 10 f0 9f e5 0c f0 9f e5 |................| | |
35 | 00000810 08 f0 9f e5 04 f0 9f e5 00 f0 9f e5 04 f0 1f e5 |................| | |
36 | 00000820 00 01 00 00 78 56 34 12 78 56 34 12 78 56 34 12 |....xV4.xV4.xV4.| | |
37 | [...] | |
38 | * | |
39 | 00001fe0 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff |................| | |
40 | 00001ff0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| | |
41 | * | |
42 | 00003800 14 00 00 ea 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 |................| | |
43 | 00003810 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 14 f0 9f e5 |................| | |
44 | 00003820 80 01 08 81 e0 01 08 81 40 02 08 81 a0 02 08 81 |........@.......| | |
45 | ||
46 | In the first "page" of the image, we have the UBL Header, needed for | |
47 | the RBL to find the spl code. | |
48 | ||
49 | The spl code starts in the second "page" of the image, with a size | |
50 | defined by: | |
51 | ||
52 | #define CONFIG_SYS_NROF_PAGES_NAND_SPL 6 | |
53 | ||
54 | After the spl code, there comes the "real" u-boot code | |
55 | @ (6 + 1) * pagesize = 0x3800 | |
56 | ||
57 | ------------------------------------------------------------------------ | |
58 | Setting 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 | ||
74 | Burning into NAND: | |
75 | ||
76 | step 1: | |
77 | The RBL searches from Block n ( n = 1..24) on page 0 for valid UBL | |
78 | Headers, so you have to burn the UBL header page from the u-boot.ubl | |
79 | image 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 | ||
83 | step 2: | |
84 | You need to setup in the ublimage.cfg, where the RBL can find the spl | |
85 | code, and how big it is. | |
86 | ||
87 | !! RBL always starts reading from page 0 !! | |
88 | ||
89 | For the AIT board, we have: | |
90 | PAGES 6 | |
91 | START_BLOCK 5 | |
92 | ||
93 | So 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 | ||
97 | step 3: | |
98 | You need to copy the u-boot image to the block/page | |
99 | where 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 | ||
103 | On 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 | ||
108 | addr | |
109 | ||
110 | 20000 possible UBL Header | |
111 | 40000 possible UBL Header | |
112 | 60000 possible UBL Header | |
113 | 80000 possilbe UBL Header | |
114 | a0000 spl code | |
115 | c0000 u-boot code | |
116 | ||
117 | The above steps are executeed through the following environment vars: | |
118 | (using 80000 as address for the UBL header) | |
119 | ||
120 | pagesz=800 | |
121 | uboot=/tftpboot/cam_enc_4xx/u-boot.ubl | |
122 | load=tftp 80000000 ${uboot} | |
123 | writeheader nandrbl rbl;nand erase 80000 ${pagesz};nand write 80000000 80000 ${pagesz};nandrbl uboot | |
124 | writenand_spl nandrbl rbl;nand erase a0000 3000;nand write 80000800 a0000 3000;nandrbl uboot | |
125 | writeuboot nandrbl uboot;nand erase c0000 5d000;nand write 80003800 c0000 5d000 | |
126 | update=run load writeheader writenand_spl writeuboot | |
127 | ||
128 | If you do a "run load update" u-boot, spl + ubl header | |
129 | are magically updated ;-) | |
130 | ||
131 | Note: | |
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 ... |