xref: /openbmc/u-boot/doc/README.ublimage (revision aa0ecfeb)
1---------------------------------------------
2UBL image Boot Image generation using mkimage
3---------------------------------------------
4
5This document describes how to set up an U-Boot image that can be directly
6booted by a DaVinci processor via NAND boot mode, using an UBL header,
7but without need for UBL.
8
9For more details see section 11.2 "ARM ROM Boot Modes" of
10http://focus.ti.com/lit/ug/sprufg5a/sprufg5a.pdf
11
12Command syntax:
13--------------
14./tools/mkimage -l <u-boot_file>
15		to list the UBL image file details
16
17./tools/mkimage -T ublimage \
18		-n <board specific configuration file> \
19		-d <u-boot binary>  <output image file>
20
21For example, for the davinci dm365evm board:
22./tools/mkimage -n ./board/davinci/dm365evm/ublimage.cfg \
23		-T ublimage \
24		-d u-boot-nand.bin u-boot.ubl
25
26You can generate the image directly when you compile u-boot with:
27
28$ make u-boot.ubl
29
30The output image can be flashed into the NAND.
31
32Please check the DaVinci documentation for further details.
33
34Board specific configuration file specifications:
35-------------------------------------------------
361. This file must present in the $(BOARDDIR) and the name should be
37	ublimage.cfg (since this is used in Makefile).
382. This file can have empty lines and lines starting with "#" as first
39	character to put comments.
403. This file can have configuration command lines as mentioned below,
41	any other information in this file is treated as invalid.
42
43Configuration command line syntax:
44---------------------------------
451. Each command line must have two strings, first one command or address
46	and second one data string
472. Following are the valid command strings and associated data strings:-
48	Command string		data string
49	--------------		-----------
50	MODE			UBL special mode, on of:
51				safe
52				Example:
53				MODE	safe
54
55	ENTRY			Entry point address for the user
56				bootloader (absolute address) = TEXT_BASE
57				nand_spl loader.
58				Example:
59				ENTRY	0x00000020
60
61	PAGES			Number of pages (size of user bootloader
62				in number of pages)
63				Example:
64				PAGES	27
65
66	START_BLOCK		Block number where user bootloader is present
67				Example:
68				START_BLOCK	5
69
70	START_PAGE		Page number where user bootloader is present
71				(for RBL always 0)
72				Example:
73				START_PAGE	0
74
75------------------------------------------------
76
77Structure of the u-boot.ubl binary:
78
79compile steps:
80
811) nand_spl code compile, with pad_to = (TEXT_BASE +
82   (CONFIG_SYS_NROF_PAGES_NAND_SPL * pagesize))
83   Example: cam_enc_4xx pad_to = 0x20 + (6 * 0x800) = 0x3020 = 12320
84   -> u-boot-spl-16k.bin
85
86   !! TEXT_BASE = 0x20, as the RBL starts at 0x20
87
882) compile u-boot.bin ("normal" u-boot)
89   -> u-boot.bin
90
913) create u-boot-nand.bin = u-boot-spl-16k.bin + u-boot.bin
92
934) create u-boot.ubl, size = 1 page size NAND
94   create UBL header and paste it before u-boot.bin
95
96This steps are done automagically if you do a "make all"
97
98-> You get an u-boot.ubl binary, which you can flash
99   into your NAND.
100
101Structure of this binary (Example for the cam_enc_4xx board with a NAND
102page size = 0x800):
103
104offset :    0x00000 | 0x800	  | 0x3800
105content:    UBL     | nand_spl	  | u-boot code
106	    Header  | code	  |
107
108The NAND layout looks for example like this:
109
110(Example for the cam_enc_4xx board with a NAND page size = 0x800, block
111size = 0x20000 and CONFIG_SYS_NROF_UBL_HEADER 5):
112
113offset :    0x80000 | 0xa0000	  | 0xa3000
114content:    UBL     | nand_spl	  | u-boot code
115	    Header  | code	  |
116	    ^	      ^
117	    ^	      0xa0000 = CONFIG_SYS_NROF_UBL_HEADER * 0x20000
118	    ^
119	    0x80000 = Block 4 * 0x20000
120
121If the cpu starts in NAND boot mode, it checks the UBL descriptor
122starting with block 1 (page 0).  When a valid UBL signature is found,
123the corresponding block number (from 1 to 24) is written to the last 32
124bits of ARM internal memory (0x7ffc-0x8000).  This feature is provided
125as a basic debug mechanism.  If not found, it continues with block 2
126... last possible block is 24
127
128If a valid UBL descriptor is found, the UBL descriptor is read and
129processed.  The descriptor gives the information required for loading
130and control transfer to the nand_spl code.  The nand_spl code is then
131read and processed.
132
133Once the user-specified start-up conditions are set, the RBL copies the
134nand_spl into ARM internal RAM, starting at address 0x0000: 0020.
135							    ^^^^
136
137The nand_spl code itself now does necessary intializations, and at least,
138copies the u-boot code from NAND into RAM, and jumps to it ...
139
140------------------------------------------------
141Author: Heiko Schocher <hs@denx.de>
142