blob: b749ce022c87aee951c229f1347e68d8d12f1486 [file] [log] [blame]
Marek Vasutb68d57c2011-11-08 23:18:22 +00001DENX M28EVK
2===========
3
4This document describes the DENX M28/M28EVK U-Boot port. This document mostly
5covers topics related to making the module/board bootable.
6
7Terminology
8-----------
9
10The dollar symbol ($) introduces a snipped of shell code. This shall be typed
11into the unix command prompt in U-Boot source code root directory.
12
13The (=>) introduces a snipped of code that should by typed into U-Boot command
14prompt.
15
16Contents
17--------
18
190) Files of the M28/M28EVK port
201) Prerequisites
212) Compiling U-Boot for M28
223) Installation of U-Boot for M28EVK to SD card
234) Installation of U-Boot for M28 to NAND flash
24
250) Files of the M28/M28EVK port
26-------------------------------
27
28arch/arm/cpu/arm926ejs/mx28/ - The CPU support code for the Freescale i.MX28
29arch/arm/include/asm/arch-mx28/ - Header files for the Freescale i.MX28
30board/denx/m28evk/ - M28EVK board specific files
31include/configs/m28evk.h - M28EVK configuration file
32
331) Prerequisites
34----------------
35
36To make the M28 module or the M28 module or M28EVK board bootable, some tools
37are necessary. The first one is the "elftosb" tool distributed by Freescale
38Semiconductor. The other tool is the "mxsboot" tool found in U-Boot source tree.
39
40Firstly, obtain the elftosb archive from the following location:
41
42 http://foss.doredevelopment.dk/mirrors/imx/elftosb-10.12.01.tar.gz
43
44We use a $VER variable here to denote the current version. At the time of
45writing of this document, that is "10.12.01". To obtain the file from command
46line, use:
47
48 $ VER="10.12.01"
49 $ wget http://foss.doredevelopment.dk/mirrors/imx/elftosb-${VER}.tar.gz
50
51Extract the file:
52
53 $ tar xzf elftosb-${VER}.tar.gz
54
55Compile the file. We need to manually tell the linker to use also libm:
56
57 $ cd elftosb-${VER}/
58 $ make LIBS="-lstdc++ -lm" elftosb
59
60Optionally, remove debugging symbols from elftosb:
61
62 $ strip bld/linux/elftosb
63
64Finally, install the "elftosb" binary. The "install" target is missing, so just
65copy the binary by hand:
66
67 $ sudo cp bld/linux/elftosb /usr/local/bin/
68
69Make sure the "elftosb" binary can be found in your $PATH, in this case this
70means "/usr/local/bin/" has to be in your $PATH.
71
722) Compiling U-Boot for M28
73---------------------------
74
75Compiling the U-Boot for M28 is straightforward and done as compiling U-Boot
76for any other ARM device. For cross-compiler setup, please refer to ELDK5.0
77documentation. First, clean up the source code:
78
79 $ make mrproper
80
81Next, configure U-Boot for M28EVK:
82
83 $ make m28evk_config
84
85Lastly, compile U-Boot and prepare a "BootStream". The "BootStream" is a special
86type of file, which the i.MX28 CPU can boot. This is handled by the following
87command:
88
89 $ make u-boot.sb
90
91HINT: To speed-up the build process, you can add -j<N>, where N is number of
92 compiler instances that'll run in parallel.
93
94The code produces "u-boot.sb" file. This file needs to be augmented with a
95proper header to allow successful boot from SD or NAND. Adding the header is
96discussed in the following chapters.
97
983) Installation of U-Boot for M28EVK to SD card
99-----------------------------------------------
100
101To boot an M28 from SD, set the boot mode DIP switches according to i.MX28
102manual chapter 12.2.1 (Table 12-2), PORT=SSP0, SD/MMC master on SSP0, 3.3V.
103
104An SD card the i.MX28 CPU can use to boot U-Boot must contain a DOS partition
105table, which in turn carries a partition of special type and which contains a
106special header. The rest of partitions in the DOS partition table can be used
107by the user.
108
109To prepare such partition, use your favourite partitioning tool. The partition
110must have the following parameters:
111
112 * Start sector .......... sector 2048
113 * Partition size ........ at least 1024 kb
114 * Partition type ........ 0x53 (sometimes "OnTrack DM6 Aux3")
115
116For example in Linux fdisk, the sequence for a clear card is the following:
117
118 * o ..................... create a clear partition table
119 * n ..................... create new partition
120 * p ............. primary partition
121 * 1 ............. first partition
122 * 2048 .......... first sector is 2048
123 * +1M ........... make the partition 1Mb big
124 * t 1 ................... change first partition ID
125 * 53 ............ change the ID to 0x53 (OnTrack DM6 Aux3)
126 * <create other partitions>
127 * w ..................... write partition table to disk
128
129The partition layout is ready, next the special partition must be filled with
130proper contents. The contents is generated by running the following command (see
131chapter 2)):
132
133 $ ./tools/mxsboot sd u-boot.sb u-boot.sd
134
135The resulting file, "u-boot.sd", shall then be written to the partition. In this
136case, we assume the first partition of the SD card is /dev/mmcblk0p1:
137
138 $ dd if=u-boot.sd of=/dev/mmcblk0p1
139
140Last step is to insert the card into M28EVK and boot.
141
142NOTE: If the user needs to adjust the start sector, the "mxsboot" tool contains
143 a "-p" switch for that purpose. The "-p" switch takes the sector number as
144 an argument.
145
1464) Installation of U-Boot for M28 to NAND flash
147-----------------------------------------------
148
149To boot an M28 from NAND, set the boot mode DIP switches according to i.MX28
150manual chapter 12.2.1 (Table 12-2), PORT=GPMI, NAND 1.8 V.
151
152There are two possibilities when preparing an image writable to NAND flash.
153
154 I) The NAND wasn't written at all yet or the BCB is broken
155 ----------------------------------------------------------
156 In this case, both BCB (FCB and DBBT) and firmware needs to be
157 written to NAND. To generate NAND image containing all these,
158 there is a tool called "mxsboot" in the "tools/" directory. The tool
159 is invoked on "u-boot.sb" file from chapter 2):
160
161 $ ./tools/mxsboot nand u-boot.sb u-boot.nand
162
163 NOTE: The above invokation works for NAND flash with geometry of
164 2048b per page, 64b OOB data, 128kb erase size. If your chip
165 has a different geometry, please use:
166
167 -w <size> change page size (default 2048 b)
168 -o <size> change oob size (default 64 b)
169 -e <size> change erase size (default 131072 b)
170
171 The geometry information can be obtained from running U-Boot
172 on M28 by issuing the "nand info" command.
173
174 The resulting file, "u-boot.nand" can be written directly to NAND
175 from the U-Boot prompt. To simplify the process, the U-Boot default
176 environment contains script "update_nand_full" to update the system.
177
178 This script expects a working TFTP server containing the file
179 "u-boot.nand" in it's root directory. This can be changed by
180 adjusting the "update_nand_full_filename" varible.
181
182 To update the system, run the following in U-Boot prompt:
183
184 => run update_nand_full
185
186 In case you would only need to update the bootloader in future,
187 see II) below.
188
189 II) The NAND was already written with a good BCB
190 ------------------------------------------------
191 This part applies after the part I) above was done at least once.
192
193 If part I) above was done correctly already, there is no need to
194 write the FCB and DBBT parts of NAND again. It's possible to upgrade
195 only the bootloader image.
196
197 To simplify the process of firmware update, the U-Boot default
198 environment contains script "update_nand_firmware" to update only
199 the firmware, without rewriting FCB and DBBT.
200
201 This script expects a working TFTP server containing the file
202 "u-boot.sb" in it's root directory. This can be changed by
203 adjusting the "update_nand_firmware_filename" varible.
204
205 To update the system, run the following in U-Boot prompt:
206
207 => run update_nand_firmware
208
209 III) Special settings for the update scripts
210 --------------------------------------------
211 There is a slight possibility of the user wanting to adjust the
212 STRIDE and COUNT options of the NAND boot. For description of these,
213 see i.MX28 manual section 12.12.1.2 and 12.12.1.3.
214
215 The update scripts take this possibility into account. In case the
216 user changes STRIDE by blowing fuses, the user also has to change
217 "update_nand_stride" variable. In case the user changes COUNT by
218 blowing fuses, the user also has to change "update_nand_count"
219 variable for the update scripts to work correctly.
220
221 In case the user needs to boot a firmware image bigger than 1Mb, the
222 user has to adjust the "update_nand_firmware_maxsz" variable for the
223 update scripts to work properly.