summaryrefslogtreecommitdiff
path: root/doc/README.ublimage
blob: ab25b2615e528223945070573c55918d8e1ae6eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---------------------------------------------
UBL image Boot Image generation using mkimage
---------------------------------------------

This document describes how to set up an U-Boot image that can be directly
booted by a DaVinci processor via NAND boot mode, using an UBL header,
but without need for UBL.

For more details see section 11.2 "ARM ROM Boot Modes" of
http://focus.ti.com/lit/ug/sprufg5a/sprufg5a.pdf

Command syntax:
--------------
./tools/mkimage -l <u-boot_file>
		to list the UBL image file details

./tools/mkimage -T ublimage \
		-n <board specific configuration file> \
		-d <u-boot binary>  <output image file>

For example, for the davinci dm365evm board:
./tools/mkimage -n ./board/davinci/dm365evm/ublimage.cfg \
		-T ublimage \
		-d u-boot-nand.bin u-boot.ubl

You can generate the image directly when you compile u-boot with:

$ make u-boot.ubl

The output image can be flashed into the NAND.

Please check the DaVinci documentation for further details.

Board specific configuration file specifications:
-------------------------------------------------
1. This file must present in the $(BOARDDIR) and the name should be
	ublimage.cfg (since this is used in Makefile).
2. This file can have empty lines and lines starting with "#" as first
	character to put comments.
3. This file can have configuration command lines as mentioned below,
	any other information in this file is treated as invalid.

Configuration command line syntax:
---------------------------------
1. Each command line must have two strings, first one command or address
	and second one data string
2. Following are the valid command strings and associated data strings:-
	Command string		data string
	--------------		-----------
	MODE			UBL special mode, on of:
				safe
				Example:
				MODE	safe

	ENTRY			Entry point address for the user
				bootloader (absolute address) = TEXT_BASE
				nand_spl loader.
				Example:
				ENTRY	0x00000020

	PAGES			Number of pages (size of user bootloader
				in number of pages)
				Example:
				PAGES	27

	START_BLOCK		Block number where user bootloader is present
				Example:
				START_BLOCK	5

	START_PAGE		Page number where user bootloader is present
				(for RBL always 0)
				Example:
				START_PAGE	0

------------------------------------------------

Structure of the u-boot.ubl binary:

compile steps:

1) nand_spl code compile, with pad_to = (TEXT_BASE +
   (CONFIG_SYS_NROF_PAGES_NAND_SPL * pagesize))
   Example: cam_enc_4xx pad_to = 0x20 + (6 * 0x800) = 0x3020 = 12320
   -> u-boot-spl-16k.bin

   !! TEXT_BASE = 0x20, as the RBL starts at 0x20

2) compile u-boot.bin ("normal" u-boot)
   -> u-boot.bin

3) create u-boot-nand.bin = u-boot-spl-16k.bin + u-boot.bin

4) create u-boot.ubl, size = 1 page size NAND
   create UBL header and paste it before u-boot.bin

This steps are done automagically if you do a "make all"

-> You get an u-boot.ubl binary, which you can flash
   into your NAND.

Structure of this binary (Example for the cam_enc_4xx board with a NAND
page size = 0x800):

offset :    0x00000 | 0x800	  | 0x3800
content:    UBL     | nand_spl	  | u-boot code
	    Header  | code	  |

The NAND layout looks for example like this:

(Example for the cam_enc_4xx board with a NAND page size = 0x800, block
size = 0x20000 and CONFIG_SYS_NROF_UBL_HEADER 5):

offset :    0x80000 | 0xa0000	  | 0xa3000
content:    UBL     | nand_spl	  | u-boot code
	    Header  | code	  |
	    ^	      ^
	    ^	      0xa0000 = CONFIG_SYS_NROF_UBL_HEADER * 0x20000
	    ^
	    0x80000 = Block 4 * 0x20000

If the cpu starts in NAND boot mode, it checks the UBL descriptor
starting with block 1 (page 0).  When a valid UBL signature is found,
the corresponding block number (from 1 to 24) is written to the last 32
bits of ARM internal memory (0x7ffc-0x8000).  This feature is provided
as a basic debug mechanism.  If not found, it continues with block 2
... last possible block is 24

If a valid UBL descriptor is found, the UBL descriptor is read and
processed.  The descriptor gives the information required for loading
and control transfer to the nand_spl code.  The nand_spl code is then
read and processed.

Once the user-specified start-up conditions are set, the RBL copies the
nand_spl into ARM internal RAM, starting at address 0x0000: 0020.
							    ^^^^

The nand_spl code itself now does necessary intializations, and at least,
copies the u-boot code from NAND into RAM, and jumps to it ...

------------------------------------------------
Author: Heiko Schocher <hs@denx.de>