Commit 4bb6650632a3e36185f689c56ea31f189ce39325

Authored by Linus Walleij
Committed by Tom Rini
1 parent ffb96d55d1

common/armflash: Support for ARM flash images

The ARM reference designs all use a special flash image format
that stores a footer (two versions exist) at the end of the last
erase block of the image in flash memory.

Version one of the footer is indicated by the magic number
0xA0FFFF9F at 12 bytes before the end of the flash block and
version two is indicated by the magic number 0x464F4F54 0x464C5348
(ASCII for "FLSHFOOT") in the very last 8 bytes of the erase block.

This command driver implements support for both versions of the
AFS images (the name comes from the Linux driver in drivers/mtd/afs.c)
and makes it possible to list images and load an image by name into
the memory with these commands:

afs - lists flash contents
afs load <image> - loads image to address indicated in the image
afs load <image> <addres> - loads image to a specified address

This image scheme is used on the ARM Integrator family, ARM
Versatile family, ARM RealView family (not yet supported in U-Boot)
and ARM Versatile Express family up to and including the new
Juno board for 64 bit development.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Showing 3 changed files with 285 additions and 0 deletions Inline Diff

1 menu "Command line interface" 1 menu "Command line interface"
2 2
3 config HUSH_PARSER 3 config HUSH_PARSER
4 bool "Use hush shell" 4 bool "Use hush shell"
5 select SYS_HUSH_PARSER 5 select SYS_HUSH_PARSER
6 help 6 help
7 This option enables the "hush" shell (from Busybox) as command line 7 This option enables the "hush" shell (from Busybox) as command line
8 interpreter, thus enabling powerful command line syntax like 8 interpreter, thus enabling powerful command line syntax like
9 if...then...else...fi conditionals or `&&' and '||' 9 if...then...else...fi conditionals or `&&' and '||'
10 constructs ("shell scripts"). 10 constructs ("shell scripts").
11 11
12 If disabled, you get the old, much simpler behaviour with a somewhat 12 If disabled, you get the old, much simpler behaviour with a somewhat
13 smaller memory footprint. 13 smaller memory footprint.
14 14
15 config SYS_HUSH_PARSER 15 config SYS_HUSH_PARSER
16 bool 16 bool
17 help 17 help
18 Backward compatibility. 18 Backward compatibility.
19 19
20 comment "Commands" 20 comment "Commands"
21 21
22 menu "Info commands" 22 menu "Info commands"
23 23
24 config CMD_BDI 24 config CMD_BDI
25 bool "bdinfo" 25 bool "bdinfo"
26 help 26 help
27 Print board info 27 Print board info
28 28
29 config CMD_CONSOLE 29 config CMD_CONSOLE
30 bool "coninfo" 30 bool "coninfo"
31 help 31 help
32 Print console devices and information. 32 Print console devices and information.
33 33
34 config CMD_LICENSE 34 config CMD_LICENSE
35 bool "license" 35 bool "license"
36 help 36 help
37 Print GPL license text 37 Print GPL license text
38 38
39 endmenu 39 endmenu
40 40
41 menu "Boot commands" 41 menu "Boot commands"
42 42
43 config CMD_BOOTD 43 config CMD_BOOTD
44 bool "bootd" 44 bool "bootd"
45 help 45 help
46 Run the command stored in the environment "bootcmd", i.e. 46 Run the command stored in the environment "bootcmd", i.e.
47 "bootd" does the same thing as "run bootcmd". 47 "bootd" does the same thing as "run bootcmd".
48 48
49 config CMD_BOOTM 49 config CMD_BOOTM
50 bool "bootm" 50 bool "bootm"
51 default y 51 default y
52 help 52 help
53 Boot an application image from the memory. 53 Boot an application image from the memory.
54 54
55 config CMD_GO 55 config CMD_GO
56 bool "go" 56 bool "go"
57 default y 57 default y
58 help 58 help
59 Start an application at a given address. 59 Start an application at a given address.
60 60
61 config CMD_RUN 61 config CMD_RUN
62 bool "run" 62 bool "run"
63 help 63 help
64 Run the command in the given environment variable. 64 Run the command in the given environment variable.
65 65
66 config CMD_IMI 66 config CMD_IMI
67 bool "iminfo" 67 bool "iminfo"
68 help 68 help
69 Print header information for application image. 69 Print header information for application image.
70 70
71 config CMD_IMLS 71 config CMD_IMLS
72 bool "imls" 72 bool "imls"
73 help 73 help
74 List all images found in flash 74 List all images found in flash
75 75
76 config CMD_XIMG 76 config CMD_XIMG
77 bool "imxtract" 77 bool "imxtract"
78 help 78 help
79 Extract a part of a multi-image. 79 Extract a part of a multi-image.
80 80
81 endmenu 81 endmenu
82 82
83 menu "Environment commands" 83 menu "Environment commands"
84 84
85 config CMD_EXPORTENV 85 config CMD_EXPORTENV
86 bool "env export" 86 bool "env export"
87 default y 87 default y
88 help 88 help
89 Export environments. 89 Export environments.
90 90
91 config CMD_IMPORTENV 91 config CMD_IMPORTENV
92 bool "env import" 92 bool "env import"
93 default y 93 default y
94 help 94 help
95 Import environments. 95 Import environments.
96 96
97 config CMD_EDITENV 97 config CMD_EDITENV
98 bool "editenv" 98 bool "editenv"
99 help 99 help
100 Edit environment variable. 100 Edit environment variable.
101 101
102 config CMD_SAVEENV 102 config CMD_SAVEENV
103 bool "saveenv" 103 bool "saveenv"
104 help 104 help
105 Run the command in the given environment variable. 105 Run the command in the given environment variable.
106 106
107 endmenu 107 endmenu
108 108
109 menu "Memory commands" 109 menu "Memory commands"
110 110
111 config CMD_MEMORY 111 config CMD_MEMORY
112 bool "md, mm, nm, mw, cp, cmp, base, loop" 112 bool "md, mm, nm, mw, cp, cmp, base, loop"
113 help 113 help
114 Memeory commands. 114 Memeory commands.
115 md - memory display 115 md - memory display
116 mm - memory modify (auto-incrementing address) 116 mm - memory modify (auto-incrementing address)
117 nm - memory modify (constant address) 117 nm - memory modify (constant address)
118 mw - memory write (fill) 118 mw - memory write (fill)
119 cp - memory copy 119 cp - memory copy
120 cmp - memory compare 120 cmp - memory compare
121 base - print or set address offset 121 base - print or set address offset
122 loop - initinite loop on address range 122 loop - initinite loop on address range
123 123
124 config CMD_CRC32 124 config CMD_CRC32
125 bool "crc32" 125 bool "crc32"
126 default y 126 default y
127 help 127 help
128 Compute CRC32. 128 Compute CRC32.
129 129
130 config LOOPW 130 config LOOPW
131 bool "loopw" 131 bool "loopw"
132 help 132 help
133 Infinite write loop on address range 133 Infinite write loop on address range
134 134
135 config CMD_MEMTEST 135 config CMD_MEMTEST
136 bool "memtest" 136 bool "memtest"
137 help 137 help
138 Simple RAM read/write test. 138 Simple RAM read/write test.
139 139
140 config CMD_MX_CYCLIC 140 config CMD_MX_CYCLIC
141 bool "mdc, mwc" 141 bool "mdc, mwc"
142 help 142 help
143 mdc - memory display cyclic 143 mdc - memory display cyclic
144 mwc - memory write cyclic 144 mwc - memory write cyclic
145 145
146 config CMD_MEMINFO 146 config CMD_MEMINFO
147 bool "meminfo" 147 bool "meminfo"
148 help 148 help
149 Display memory information. 149 Display memory information.
150 150
151 endmenu 151 endmenu
152 152
153 menu "Device access commands" 153 menu "Device access commands"
154 154
155 config CMD_DM 155 config CMD_DM
156 bool "dm - Access to driver model information" 156 bool "dm - Access to driver model information"
157 depends on DM 157 depends on DM
158 default y 158 default y
159 help 159 help
160 Provides access to driver model data structures and information, 160 Provides access to driver model data structures and information,
161 such as a list of devices, list of uclasses and the state of each 161 such as a list of devices, list of uclasses and the state of each
162 device (e.g. activated). This is not required for operation, but 162 device (e.g. activated). This is not required for operation, but
163 can be useful to see the state of driver model for debugging or 163 can be useful to see the state of driver model for debugging or
164 interest. 164 interest.
165 165
166 config CMD_DEMO 166 config CMD_DEMO
167 bool "demo - Demonstration commands for driver model" 167 bool "demo - Demonstration commands for driver model"
168 depends on DM 168 depends on DM
169 help 169 help
170 Provides a 'demo' command which can be used to play around with 170 Provides a 'demo' command which can be used to play around with
171 driver model. To use this properly you will need to enable one or 171 driver model. To use this properly you will need to enable one or
172 both of the demo devices (DM_DEMO_SHAPE and DM_DEMO_SIMPLE). 172 both of the demo devices (DM_DEMO_SHAPE and DM_DEMO_SIMPLE).
173 Otherwise you will always get an empty list of devices. The demo 173 Otherwise you will always get an empty list of devices. The demo
174 devices are defined in the sandbox device tree, so the easiest 174 devices are defined in the sandbox device tree, so the easiest
175 option is to use sandbox and pass the -d point to sandbox's 175 option is to use sandbox and pass the -d point to sandbox's
176 u-boot.dtb file. 176 u-boot.dtb file.
177 177
178 config CMD_LOADB 178 config CMD_LOADB
179 bool "loadb" 179 bool "loadb"
180 help 180 help
181 Load a binary file over serial line. 181 Load a binary file over serial line.
182 182
183 config CMD_LOADS 183 config CMD_LOADS
184 bool "loads" 184 bool "loads"
185 help 185 help
186 Load an S-Record file over serial line 186 Load an S-Record file over serial line
187 187
188 config CMD_FLASH 188 config CMD_FLASH
189 bool "flinfo, erase, protect" 189 bool "flinfo, erase, protect"
190 help 190 help
191 NOR flash support. 191 NOR flash support.
192 flinfo - print FLASH memory information 192 flinfo - print FLASH memory information
193 erase - FLASH memory 193 erase - FLASH memory
194 protect - enable or disable FLASH write protection 194 protect - enable or disable FLASH write protection
195 195
196 config CMD_ARMFLASH
197 depends on FLASH_CFI_DRIVER
198 bool "armflash"
199 help
200 ARM Ltd reference designs flash partition access
201
196 config CMD_NAND 202 config CMD_NAND
197 bool "nand" 203 bool "nand"
198 help 204 help
199 NAND support. 205 NAND support.
200 206
201 config CMD_SPI 207 config CMD_SPI
202 bool "sspi" 208 bool "sspi"
203 help 209 help
204 SPI utility command. 210 SPI utility command.
205 211
206 config CMD_I2C 212 config CMD_I2C
207 bool "i2c" 213 bool "i2c"
208 help 214 help
209 I2C support. 215 I2C support.
210 216
211 config CMD_USB 217 config CMD_USB
212 bool "usb" 218 bool "usb"
213 help 219 help
214 USB support. 220 USB support.
215 221
216 config CMD_FPGA 222 config CMD_FPGA
217 bool "fpga" 223 bool "fpga"
218 help 224 help
219 FPGA support. 225 FPGA support.
220 226
221 endmenu 227 endmenu
222 228
223 229
224 menu "Shell scripting commands" 230 menu "Shell scripting commands"
225 231
226 config CMD_ECHO 232 config CMD_ECHO
227 bool "echo" 233 bool "echo"
228 help 234 help
229 Echo args to console 235 Echo args to console
230 236
231 config CMD_ITEST 237 config CMD_ITEST
232 bool "itest" 238 bool "itest"
233 help 239 help
234 Return true/false on integer compare. 240 Return true/false on integer compare.
235 241
236 config CMD_SOURCE 242 config CMD_SOURCE
237 bool "source" 243 bool "source"
238 help 244 help
239 Run script from memory 245 Run script from memory
240 246
241 endmenu 247 endmenu
242 248
243 menu "Network commands" 249 menu "Network commands"
244 250
245 config CMD_NET 251 config CMD_NET
246 bool "bootp, tftpboot" 252 bool "bootp, tftpboot"
247 help 253 help
248 Network commands. 254 Network commands.
249 bootp - boot image via network using BOOTP/TFTP protocol 255 bootp - boot image via network using BOOTP/TFTP protocol
250 tftpboot - boot image via network using TFTP protocol 256 tftpboot - boot image via network using TFTP protocol
251 257
252 config CMD_TFTPPUT 258 config CMD_TFTPPUT
253 bool "tftp put" 259 bool "tftp put"
254 help 260 help
255 TFTP put command, for uploading files to a server 261 TFTP put command, for uploading files to a server
256 262
257 config CMD_TFTPSRV 263 config CMD_TFTPSRV
258 bool "tftpsrv" 264 bool "tftpsrv"
259 help 265 help
260 Act as a TFTP server and boot the first received file 266 Act as a TFTP server and boot the first received file
261 267
262 config CMD_RARP 268 config CMD_RARP
263 bool "rarpboot" 269 bool "rarpboot"
264 help 270 help
265 Boot image via network using RARP/TFTP protocol 271 Boot image via network using RARP/TFTP protocol
266 272
267 config CMD_DHCP 273 config CMD_DHCP
268 bool "dhcp" 274 bool "dhcp"
269 help 275 help
270 Boot image via network using DHCP/TFTP protocol 276 Boot image via network using DHCP/TFTP protocol
271 277
272 config CMD_NFS 278 config CMD_NFS
273 bool "nfs" 279 bool "nfs"
274 help 280 help
275 Boot image via network using NFS protocol. 281 Boot image via network using NFS protocol.
276 282
277 config CMD_PING 283 config CMD_PING
278 bool "ping" 284 bool "ping"
279 help 285 help
280 Send ICMP ECHO_REQUEST to network host 286 Send ICMP ECHO_REQUEST to network host
281 287
282 config CMD_CDP 288 config CMD_CDP
283 bool "cdp" 289 bool "cdp"
284 help 290 help
285 Perform CDP network configuration 291 Perform CDP network configuration
286 292
287 config CMD_SNTP 293 config CMD_SNTP
288 bool "sntp" 294 bool "sntp"
289 help 295 help
290 Synchronize RTC via network 296 Synchronize RTC via network
291 297
292 config CMD_DNS 298 config CMD_DNS
293 bool "dns" 299 bool "dns"
294 help 300 help
295 Lookup the IP of a hostname 301 Lookup the IP of a hostname
296 302
297 config CMD_DNS 303 config CMD_DNS
298 bool "dns" 304 bool "dns"
299 help 305 help
300 Lookup the IP of a hostname 306 Lookup the IP of a hostname
301 307
302 config CMD_LINK_LOCAL 308 config CMD_LINK_LOCAL
303 bool "linklocal" 309 bool "linklocal"
304 help 310 help
305 Acquire a network IP address using the link-local protocol 311 Acquire a network IP address using the link-local protocol
306 312
307 endmenu 313 endmenu
308 314
309 menu "Misc commands" 315 menu "Misc commands"
310 316
311 config CMD_TIME 317 config CMD_TIME
312 bool "time" 318 bool "time"
313 help 319 help
314 Run commands and summarize execution time. 320 Run commands and summarize execution time.
315 321
316 # TODO: rename to CMD_SLEEP 322 # TODO: rename to CMD_SLEEP
317 config CMD_MISC 323 config CMD_MISC
318 bool "sleep" 324 bool "sleep"
319 help 325 help
320 Delay execution for some time 326 Delay execution for some time
321 327
322 config CMD_TIMER 328 config CMD_TIMER
323 bool "timer" 329 bool "timer"
324 help 330 help
325 Access the system timer. 331 Access the system timer.
326 332
327 config CMD_SETGETDCR 333 config CMD_SETGETDCR
328 bool "getdcr, setdcr, getidcr, setidcr" 334 bool "getdcr, setdcr, getidcr, setidcr"
329 depends on 4xx 335 depends on 4xx
330 help 336 help
331 getdcr - Get an AMCC PPC 4xx DCR's value 337 getdcr - Get an AMCC PPC 4xx DCR's value
332 setdcr - Set an AMCC PPC 4xx DCR's value 338 setdcr - Set an AMCC PPC 4xx DCR's value
333 getidcr - Get a register value via indirect DCR addressing 339 getidcr - Get a register value via indirect DCR addressing
334 setidcr - Set a register value via indirect DCR addressing 340 setidcr - Set a register value via indirect DCR addressing
335 341
336 endmenu 342 endmenu
337 343
338 endmenu 344 endmenu
339 345
1 # 1 #
2 # (C) Copyright 2004-2006 2 # (C) Copyright 2004-2006
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. 3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 # 4 #
5 # SPDX-License-Identifier: GPL-2.0+ 5 # SPDX-License-Identifier: GPL-2.0+
6 # 6 #
7 7
8 # core 8 # core
9 ifndef CONFIG_SPL_BUILD 9 ifndef CONFIG_SPL_BUILD
10 obj-y += main.o 10 obj-y += main.o
11 obj-y += exports.o 11 obj-y += exports.o
12 obj-y += hash.o 12 obj-y += hash.o
13 ifdef CONFIG_SYS_HUSH_PARSER 13 ifdef CONFIG_SYS_HUSH_PARSER
14 obj-y += cli_hush.o 14 obj-y += cli_hush.o
15 endif 15 endif
16 16
17 # This option is not just y/n - it can have a numeric value 17 # This option is not just y/n - it can have a numeric value
18 ifdef CONFIG_BOOTDELAY 18 ifdef CONFIG_BOOTDELAY
19 obj-y += autoboot.o 19 obj-y += autoboot.o
20 endif 20 endif
21 21
22 # This option is not just y/n - it can have a numeric value 22 # This option is not just y/n - it can have a numeric value
23 ifdef CONFIG_BOOT_RETRY_TIME 23 ifdef CONFIG_BOOT_RETRY_TIME
24 obj-y += bootretry.o 24 obj-y += bootretry.o
25 endif 25 endif
26 26
27 # boards 27 # boards
28 obj-$(CONFIG_SYS_GENERIC_BOARD) += board_f.o 28 obj-$(CONFIG_SYS_GENERIC_BOARD) += board_f.o
29 obj-$(CONFIG_SYS_GENERIC_BOARD) += board_r.o 29 obj-$(CONFIG_SYS_GENERIC_BOARD) += board_r.o
30 obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o 30 obj-$(CONFIG_DISPLAY_BOARDINFO) += board_info.o
31 obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o 31 obj-$(CONFIG_DISPLAY_BOARDINFO_LATE) += board_info.o
32 32
33 # core command 33 # core command
34 obj-y += cmd_boot.o 34 obj-y += cmd_boot.o
35 obj-$(CONFIG_CMD_BOOTM) += cmd_bootm.o bootm.o bootm_os.o 35 obj-$(CONFIG_CMD_BOOTM) += cmd_bootm.o bootm.o bootm_os.o
36 obj-y += cmd_help.o 36 obj-y += cmd_help.o
37 obj-y += cmd_version.o 37 obj-y += cmd_version.o
38 38
39 # environment 39 # environment
40 obj-y += env_attr.o 40 obj-y += env_attr.o
41 obj-y += env_callback.o 41 obj-y += env_callback.o
42 obj-y += env_flags.o 42 obj-y += env_flags.o
43 obj-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o 43 obj-$(CONFIG_ENV_IS_IN_DATAFLASH) += env_dataflash.o
44 obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o 44 obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_eeprom.o
45 extra-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o 45 extra-$(CONFIG_ENV_IS_EMBEDDED) += env_embedded.o
46 obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o 46 obj-$(CONFIG_ENV_IS_IN_EEPROM) += env_embedded.o
47 extra-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o 47 extra-$(CONFIG_ENV_IS_IN_FLASH) += env_embedded.o
48 obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o 48 obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
49 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o 49 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
50 obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o 50 obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
51 obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o 51 obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o
52 obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o 52 obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
53 obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o 53 obj-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
54 obj-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o 54 obj-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
55 obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o 55 obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
56 obj-$(CONFIG_ENV_IS_IN_REMOTE) += env_remote.o 56 obj-$(CONFIG_ENV_IS_IN_REMOTE) += env_remote.o
57 obj-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o 57 obj-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o
58 obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o 58 obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
59 59
60 # command 60 # command
61 obj-$(CONFIG_CMD_AES) += cmd_aes.o 61 obj-$(CONFIG_CMD_AES) += cmd_aes.o
62 obj-$(CONFIG_CMD_AMBAPP) += cmd_ambapp.o 62 obj-$(CONFIG_CMD_AMBAPP) += cmd_ambapp.o
63 obj-$(CONFIG_CMD_ARMFLASH) += cmd_armflash.o
63 obj-$(CONFIG_SOURCE) += cmd_source.o 64 obj-$(CONFIG_SOURCE) += cmd_source.o
64 obj-$(CONFIG_CMD_SOURCE) += cmd_source.o 65 obj-$(CONFIG_CMD_SOURCE) += cmd_source.o
65 obj-$(CONFIG_CMD_BDI) += cmd_bdinfo.o 66 obj-$(CONFIG_CMD_BDI) += cmd_bdinfo.o
66 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o 67 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o
67 obj-$(CONFIG_CMD_BMP) += cmd_bmp.o 68 obj-$(CONFIG_CMD_BMP) += cmd_bmp.o
68 obj-$(CONFIG_CMD_BOOTMENU) += cmd_bootmenu.o 69 obj-$(CONFIG_CMD_BOOTMENU) += cmd_bootmenu.o
69 obj-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o 70 obj-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o
70 obj-$(CONFIG_CMD_BOOTSTAGE) += cmd_bootstage.o 71 obj-$(CONFIG_CMD_BOOTSTAGE) += cmd_bootstage.o
71 obj-$(CONFIG_CMD_CACHE) += cmd_cache.o 72 obj-$(CONFIG_CMD_CACHE) += cmd_cache.o
72 obj-$(CONFIG_CMD_CBFS) += cmd_cbfs.o 73 obj-$(CONFIG_CMD_CBFS) += cmd_cbfs.o
73 obj-$(CONFIG_CMD_CLK) += cmd_clk.o 74 obj-$(CONFIG_CMD_CLK) += cmd_clk.o
74 obj-$(CONFIG_CMD_CONSOLE) += cmd_console.o 75 obj-$(CONFIG_CMD_CONSOLE) += cmd_console.o
75 obj-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o 76 obj-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o
76 obj-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o 77 obj-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o
77 obj-$(CONFIG_CMD_DATE) += cmd_date.o 78 obj-$(CONFIG_CMD_DATE) += cmd_date.o
78 obj-$(CONFIG_CMD_DEMO) += cmd_demo.o 79 obj-$(CONFIG_CMD_DEMO) += cmd_demo.o
79 obj-$(CONFIG_CMD_SOUND) += cmd_sound.o 80 obj-$(CONFIG_CMD_SOUND) += cmd_sound.o
80 ifdef CONFIG_4xx 81 ifdef CONFIG_4xx
81 obj-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o 82 obj-$(CONFIG_CMD_SETGETDCR) += cmd_dcr.o
82 endif 83 endif
83 ifdef CONFIG_POST 84 ifdef CONFIG_POST
84 obj-$(CONFIG_CMD_DIAG) += cmd_diag.o 85 obj-$(CONFIG_CMD_DIAG) += cmd_diag.o
85 endif 86 endif
86 obj-$(CONFIG_CMD_DISPLAY) += cmd_display.o 87 obj-$(CONFIG_CMD_DISPLAY) += cmd_display.o
87 obj-$(CONFIG_CMD_DTT) += cmd_dtt.o 88 obj-$(CONFIG_CMD_DTT) += cmd_dtt.o
88 obj-$(CONFIG_CMD_ECHO) += cmd_echo.o 89 obj-$(CONFIG_CMD_ECHO) += cmd_echo.o
89 obj-$(CONFIG_ENV_IS_IN_EEPROM) += cmd_eeprom.o 90 obj-$(CONFIG_ENV_IS_IN_EEPROM) += cmd_eeprom.o
90 obj-$(CONFIG_CMD_EEPROM) += cmd_eeprom.o 91 obj-$(CONFIG_CMD_EEPROM) += cmd_eeprom.o
91 obj-$(CONFIG_CMD_ELF) += cmd_elf.o 92 obj-$(CONFIG_CMD_ELF) += cmd_elf.o
92 obj-$(CONFIG_SYS_HUSH_PARSER) += cmd_exit.o 93 obj-$(CONFIG_SYS_HUSH_PARSER) += cmd_exit.o
93 obj-$(CONFIG_CMD_EXT4) += cmd_ext4.o 94 obj-$(CONFIG_CMD_EXT4) += cmd_ext4.o
94 obj-$(CONFIG_CMD_EXT2) += cmd_ext2.o 95 obj-$(CONFIG_CMD_EXT2) += cmd_ext2.o
95 obj-$(CONFIG_CMD_FAT) += cmd_fat.o 96 obj-$(CONFIG_CMD_FAT) += cmd_fat.o
96 obj-$(CONFIG_CMD_FDC) += cmd_fdc.o 97 obj-$(CONFIG_CMD_FDC) += cmd_fdc.o
97 obj-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o 98 obj-$(CONFIG_OF_LIBFDT) += cmd_fdt.o fdt_support.o
98 obj-$(CONFIG_CMD_FITUPD) += cmd_fitupd.o 99 obj-$(CONFIG_CMD_FITUPD) += cmd_fitupd.o
99 obj-$(CONFIG_CMD_FLASH) += cmd_flash.o 100 obj-$(CONFIG_CMD_FLASH) += cmd_flash.o
100 ifdef CONFIG_FPGA 101 ifdef CONFIG_FPGA
101 obj-$(CONFIG_CMD_FPGA) += cmd_fpga.o 102 obj-$(CONFIG_CMD_FPGA) += cmd_fpga.o
102 endif 103 endif
103 obj-$(CONFIG_CMD_FPGAD) += cmd_fpgad.o 104 obj-$(CONFIG_CMD_FPGAD) += cmd_fpgad.o
104 obj-$(CONFIG_CMD_FS_GENERIC) += cmd_fs.o 105 obj-$(CONFIG_CMD_FS_GENERIC) += cmd_fs.o
105 obj-$(CONFIG_CMD_FUSE) += cmd_fuse.o 106 obj-$(CONFIG_CMD_FUSE) += cmd_fuse.o
106 obj-$(CONFIG_CMD_GETTIME) += cmd_gettime.o 107 obj-$(CONFIG_CMD_GETTIME) += cmd_gettime.o
107 obj-$(CONFIG_CMD_GPIO) += cmd_gpio.o 108 obj-$(CONFIG_CMD_GPIO) += cmd_gpio.o
108 obj-$(CONFIG_CMD_I2C) += cmd_i2c.o 109 obj-$(CONFIG_CMD_I2C) += cmd_i2c.o
109 obj-$(CONFIG_CMD_IOTRACE) += cmd_iotrace.o 110 obj-$(CONFIG_CMD_IOTRACE) += cmd_iotrace.o
110 obj-$(CONFIG_CMD_HASH) += cmd_hash.o 111 obj-$(CONFIG_CMD_HASH) += cmd_hash.o
111 obj-$(CONFIG_CMD_IDE) += cmd_ide.o 112 obj-$(CONFIG_CMD_IDE) += cmd_ide.o
112 obj-$(CONFIG_CMD_IMMAP) += cmd_immap.o 113 obj-$(CONFIG_CMD_IMMAP) += cmd_immap.o
113 obj-$(CONFIG_CMD_INI) += cmd_ini.o 114 obj-$(CONFIG_CMD_INI) += cmd_ini.o
114 obj-$(CONFIG_CMD_IRQ) += cmd_irq.o 115 obj-$(CONFIG_CMD_IRQ) += cmd_irq.o
115 obj-$(CONFIG_CMD_ITEST) += cmd_itest.o 116 obj-$(CONFIG_CMD_ITEST) += cmd_itest.o
116 obj-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o 117 obj-$(CONFIG_CMD_JFFS2) += cmd_jffs2.o
117 obj-$(CONFIG_CMD_CRAMFS) += cmd_cramfs.o 118 obj-$(CONFIG_CMD_CRAMFS) += cmd_cramfs.o
118 obj-$(CONFIG_CMD_LDRINFO) += cmd_ldrinfo.o 119 obj-$(CONFIG_CMD_LDRINFO) += cmd_ldrinfo.o
119 obj-$(CONFIG_CMD_LED) += cmd_led.o 120 obj-$(CONFIG_CMD_LED) += cmd_led.o
120 obj-$(CONFIG_CMD_LICENSE) += cmd_license.o 121 obj-$(CONFIG_CMD_LICENSE) += cmd_license.o
121 obj-y += cmd_load.o 122 obj-y += cmd_load.o
122 obj-$(CONFIG_LOGBUFFER) += cmd_log.o 123 obj-$(CONFIG_LOGBUFFER) += cmd_log.o
123 obj-$(CONFIG_ID_EEPROM) += cmd_mac.o 124 obj-$(CONFIG_ID_EEPROM) += cmd_mac.o
124 obj-$(CONFIG_CMD_MD5SUM) += cmd_md5sum.o 125 obj-$(CONFIG_CMD_MD5SUM) += cmd_md5sum.o
125 obj-$(CONFIG_CMD_MEMORY) += cmd_mem.o 126 obj-$(CONFIG_CMD_MEMORY) += cmd_mem.o
126 obj-$(CONFIG_CMD_IO) += cmd_io.o 127 obj-$(CONFIG_CMD_IO) += cmd_io.o
127 obj-$(CONFIG_CMD_MFSL) += cmd_mfsl.o 128 obj-$(CONFIG_CMD_MFSL) += cmd_mfsl.o
128 obj-$(CONFIG_MII) += miiphyutil.o 129 obj-$(CONFIG_MII) += miiphyutil.o
129 obj-$(CONFIG_CMD_MII) += miiphyutil.o 130 obj-$(CONFIG_CMD_MII) += miiphyutil.o
130 obj-$(CONFIG_PHYLIB) += miiphyutil.o 131 obj-$(CONFIG_PHYLIB) += miiphyutil.o
131 obj-$(CONFIG_CMD_MII) += cmd_mii.o 132 obj-$(CONFIG_CMD_MII) += cmd_mii.o
132 ifdef CONFIG_PHYLIB 133 ifdef CONFIG_PHYLIB
133 obj-$(CONFIG_CMD_MII) += cmd_mdio.o 134 obj-$(CONFIG_CMD_MII) += cmd_mdio.o
134 endif 135 endif
135 obj-$(CONFIG_CMD_MISC) += cmd_misc.o 136 obj-$(CONFIG_CMD_MISC) += cmd_misc.o
136 obj-$(CONFIG_CMD_MMC) += cmd_mmc.o 137 obj-$(CONFIG_CMD_MMC) += cmd_mmc.o
137 obj-$(CONFIG_CMD_MMC_SPI) += cmd_mmc_spi.o 138 obj-$(CONFIG_CMD_MMC_SPI) += cmd_mmc_spi.o
138 obj-$(CONFIG_MP) += cmd_mp.o 139 obj-$(CONFIG_MP) += cmd_mp.o
139 obj-$(CONFIG_CMD_MTDPARTS) += cmd_mtdparts.o 140 obj-$(CONFIG_CMD_MTDPARTS) += cmd_mtdparts.o
140 obj-$(CONFIG_CMD_NAND) += cmd_nand.o 141 obj-$(CONFIG_CMD_NAND) += cmd_nand.o
141 obj-$(CONFIG_CMD_NET) += cmd_net.o 142 obj-$(CONFIG_CMD_NET) += cmd_net.o
142 obj-$(CONFIG_CMD_ONENAND) += cmd_onenand.o 143 obj-$(CONFIG_CMD_ONENAND) += cmd_onenand.o
143 obj-$(CONFIG_CMD_OTP) += cmd_otp.o 144 obj-$(CONFIG_CMD_OTP) += cmd_otp.o
144 obj-$(CONFIG_CMD_PART) += cmd_part.o 145 obj-$(CONFIG_CMD_PART) += cmd_part.o
145 ifdef CONFIG_PCI 146 ifdef CONFIG_PCI
146 obj-$(CONFIG_CMD_PCI) += cmd_pci.o 147 obj-$(CONFIG_CMD_PCI) += cmd_pci.o
147 endif 148 endif
148 obj-y += cmd_pcmcia.o 149 obj-y += cmd_pcmcia.o
149 obj-$(CONFIG_CMD_PORTIO) += cmd_portio.o 150 obj-$(CONFIG_CMD_PORTIO) += cmd_portio.o
150 obj-$(CONFIG_CMD_PXE) += cmd_pxe.o 151 obj-$(CONFIG_CMD_PXE) += cmd_pxe.o
151 obj-$(CONFIG_CMD_READ) += cmd_read.o 152 obj-$(CONFIG_CMD_READ) += cmd_read.o
152 obj-$(CONFIG_CMD_REGINFO) += cmd_reginfo.o 153 obj-$(CONFIG_CMD_REGINFO) += cmd_reginfo.o
153 obj-$(CONFIG_CMD_REISER) += cmd_reiser.o 154 obj-$(CONFIG_CMD_REISER) += cmd_reiser.o
154 obj-$(CONFIG_SANDBOX) += cmd_sandbox.o 155 obj-$(CONFIG_SANDBOX) += cmd_sandbox.o
155 obj-$(CONFIG_CMD_SATA) += cmd_sata.o 156 obj-$(CONFIG_CMD_SATA) += cmd_sata.o
156 obj-$(CONFIG_CMD_SF) += cmd_sf.o 157 obj-$(CONFIG_CMD_SF) += cmd_sf.o
157 obj-$(CONFIG_CMD_SCSI) += cmd_scsi.o 158 obj-$(CONFIG_CMD_SCSI) += cmd_scsi.o
158 obj-$(CONFIG_CMD_SHA1SUM) += cmd_sha1sum.o 159 obj-$(CONFIG_CMD_SHA1SUM) += cmd_sha1sum.o
159 obj-$(CONFIG_CMD_SETEXPR) += cmd_setexpr.o 160 obj-$(CONFIG_CMD_SETEXPR) += cmd_setexpr.o
160 obj-$(CONFIG_CMD_SOFTSWITCH) += cmd_softswitch.o 161 obj-$(CONFIG_CMD_SOFTSWITCH) += cmd_softswitch.o
161 obj-$(CONFIG_CMD_SPI) += cmd_spi.o 162 obj-$(CONFIG_CMD_SPI) += cmd_spi.o
162 obj-$(CONFIG_CMD_SPIBOOTLDR) += cmd_spibootldr.o 163 obj-$(CONFIG_CMD_SPIBOOTLDR) += cmd_spibootldr.o
163 obj-$(CONFIG_CMD_STRINGS) += cmd_strings.o 164 obj-$(CONFIG_CMD_STRINGS) += cmd_strings.o
164 obj-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o 165 obj-$(CONFIG_CMD_TERMINAL) += cmd_terminal.o
165 obj-$(CONFIG_CMD_TIME) += cmd_time.o 166 obj-$(CONFIG_CMD_TIME) += cmd_time.o
166 obj-$(CONFIG_CMD_TRACE) += cmd_trace.o 167 obj-$(CONFIG_CMD_TRACE) += cmd_trace.o
167 obj-$(CONFIG_SYS_HUSH_PARSER) += cmd_test.o 168 obj-$(CONFIG_SYS_HUSH_PARSER) += cmd_test.o
168 obj-$(CONFIG_CMD_TPM) += cmd_tpm.o 169 obj-$(CONFIG_CMD_TPM) += cmd_tpm.o
169 obj-$(CONFIG_CMD_TSI148) += cmd_tsi148.o 170 obj-$(CONFIG_CMD_TSI148) += cmd_tsi148.o
170 obj-$(CONFIG_CMD_UBI) += cmd_ubi.o 171 obj-$(CONFIG_CMD_UBI) += cmd_ubi.o
171 obj-$(CONFIG_CMD_UBIFS) += cmd_ubifs.o 172 obj-$(CONFIG_CMD_UBIFS) += cmd_ubifs.o
172 obj-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o 173 obj-$(CONFIG_CMD_UNIVERSE) += cmd_universe.o
173 obj-$(CONFIG_CMD_UNZIP) += cmd_unzip.o 174 obj-$(CONFIG_CMD_UNZIP) += cmd_unzip.o
174 ifdef CONFIG_LZMA 175 ifdef CONFIG_LZMA
175 obj-$(CONFIG_CMD_LZMADEC) += cmd_lzmadec.o 176 obj-$(CONFIG_CMD_LZMADEC) += cmd_lzmadec.o
176 endif 177 endif
177 ifdef CONFIG_CMD_USB 178 ifdef CONFIG_CMD_USB
178 obj-y += cmd_usb.o 179 obj-y += cmd_usb.o
179 obj-y += usb.o usb_hub.o 180 obj-y += usb.o usb_hub.o
180 obj-$(CONFIG_USB_STORAGE) += usb_storage.o 181 obj-$(CONFIG_USB_STORAGE) += usb_storage.o
181 endif 182 endif
182 obj-$(CONFIG_CMD_FASTBOOT) += cmd_fastboot.o 183 obj-$(CONFIG_CMD_FASTBOOT) += cmd_fastboot.o
183 obj-$(CONFIG_CMD_FS_UUID) += cmd_fs_uuid.o 184 obj-$(CONFIG_CMD_FS_UUID) += cmd_fs_uuid.o
184 185
185 obj-$(CONFIG_CMD_USB_MASS_STORAGE) += cmd_usb_mass_storage.o 186 obj-$(CONFIG_CMD_USB_MASS_STORAGE) += cmd_usb_mass_storage.o
186 obj-$(CONFIG_CMD_THOR_DOWNLOAD) += cmd_thordown.o 187 obj-$(CONFIG_CMD_THOR_DOWNLOAD) += cmd_thordown.o
187 obj-$(CONFIG_CMD_XIMG) += cmd_ximg.o 188 obj-$(CONFIG_CMD_XIMG) += cmd_ximg.o
188 obj-$(CONFIG_YAFFS2) += cmd_yaffs2.o 189 obj-$(CONFIG_YAFFS2) += cmd_yaffs2.o
189 obj-$(CONFIG_CMD_SPL) += cmd_spl.o 190 obj-$(CONFIG_CMD_SPL) += cmd_spl.o
190 obj-$(CONFIG_CMD_ZIP) += cmd_zip.o 191 obj-$(CONFIG_CMD_ZIP) += cmd_zip.o
191 obj-$(CONFIG_CMD_ZFS) += cmd_zfs.o 192 obj-$(CONFIG_CMD_ZFS) += cmd_zfs.o
192 193
193 # others 194 # others
194 obj-$(CONFIG_BOOTSTAGE) += bootstage.o 195 obj-$(CONFIG_BOOTSTAGE) += bootstage.o
195 obj-$(CONFIG_CONSOLE_MUX) += iomux.o 196 obj-$(CONFIG_CONSOLE_MUX) += iomux.o
196 obj-y += flash.o 197 obj-y += flash.o
197 obj-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o 198 obj-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
198 obj-$(CONFIG_I2C_EDID) += edid.o 199 obj-$(CONFIG_I2C_EDID) += edid.o
199 obj-$(CONFIG_KALLSYMS) += kallsyms.o 200 obj-$(CONFIG_KALLSYMS) += kallsyms.o
200 obj-y += splash.o 201 obj-y += splash.o
201 obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o 202 obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o
202 obj-$(CONFIG_LCD) += lcd.o lcd_console.o 203 obj-$(CONFIG_LCD) += lcd.o lcd_console.o
203 obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o 204 obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o
204 obj-$(CONFIG_LYNXKDI) += lynxkdi.o 205 obj-$(CONFIG_LYNXKDI) += lynxkdi.o
205 obj-$(CONFIG_MENU) += menu.o 206 obj-$(CONFIG_MENU) += menu.o
206 obj-$(CONFIG_MODEM_SUPPORT) += modem.o 207 obj-$(CONFIG_MODEM_SUPPORT) += modem.o
207 obj-$(CONFIG_UPDATE_TFTP) += update.o 208 obj-$(CONFIG_UPDATE_TFTP) += update.o
208 obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o 209 obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
209 obj-$(CONFIG_CMD_DFU) += cmd_dfu.o 210 obj-$(CONFIG_CMD_DFU) += cmd_dfu.o
210 obj-$(CONFIG_CMD_GPT) += cmd_gpt.o 211 obj-$(CONFIG_CMD_GPT) += cmd_gpt.o
211 endif 212 endif
212 213
213 ifdef CONFIG_SPL_BUILD 214 ifdef CONFIG_SPL_BUILD
214 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o 215 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
215 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o 216 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += xyzModem.o
216 obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o 217 obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o
217 ifdef CONFIG_SPL_USB_HOST_SUPPORT 218 ifdef CONFIG_SPL_USB_HOST_SUPPORT
218 obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o 219 obj-$(CONFIG_SPL_USB_SUPPORT) += usb.o usb_hub.o
219 obj-$(CONFIG_USB_STORAGE) += usb_storage.o 220 obj-$(CONFIG_USB_STORAGE) += usb_storage.o
220 endif 221 endif
221 ifdef CONFIG_SPL_SATA_SUPPORT 222 ifdef CONFIG_SPL_SATA_SUPPORT
222 obj-$(CONFIG_CMD_SCSI) += cmd_scsi.o 223 obj-$(CONFIG_CMD_SCSI) += cmd_scsi.o
223 endif 224 endif
224 # environment 225 # environment
225 ifdef CONFIG_SPL_ENV_SUPPORT 226 ifdef CONFIG_SPL_ENV_SUPPORT
226 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_attr.o 227 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_attr.o
227 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_flags.o 228 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_flags.o
228 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_callback.o 229 obj-$(CONFIG_SPL_ENV_SUPPORT) += env_callback.o
229 obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o 230 obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
230 obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o 231 obj-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
231 obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o 232 obj-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o
232 obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o 233 obj-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
233 obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o 234 obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
234 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o 235 obj-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
235 endif 236 endif
236 endif 237 endif
237 # core command 238 # core command
238 obj-y += cmd_nvedit.o 239 obj-y += cmd_nvedit.o
239 #environment 240 #environment
240 obj-y += env_common.o 241 obj-y += env_common.o
241 #others 242 #others
242 obj-$(CONFIG_DDR_SPD) += ddr_spd.o 243 obj-$(CONFIG_DDR_SPD) += ddr_spd.o
243 obj-$(CONFIG_SPD_EEPROM) += ddr_spd.o 244 obj-$(CONFIG_SPD_EEPROM) += ddr_spd.o
244 obj-$(CONFIG_HWCONFIG) += hwconfig.o 245 obj-$(CONFIG_HWCONFIG) += hwconfig.o
245 obj-$(CONFIG_BOUNCE_BUFFER) += bouncebuf.o 246 obj-$(CONFIG_BOUNCE_BUFFER) += bouncebuf.o
246 obj-y += console.o 247 obj-y += console.o
247 obj-$(CONFIG_CROS_EC) += cros_ec.o 248 obj-$(CONFIG_CROS_EC) += cros_ec.o
248 obj-y += dlmalloc.o 249 obj-y += dlmalloc.o
249 ifdef CONFIG_SYS_MALLOC_F_LEN 250 ifdef CONFIG_SYS_MALLOC_F_LEN
250 obj-y += malloc_simple.o 251 obj-y += malloc_simple.o
251 endif 252 endif
252 obj-y += image.o 253 obj-y += image.o
253 obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o 254 obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o
254 obj-$(CONFIG_OF_LIBFDT) += image-fdt.o 255 obj-$(CONFIG_OF_LIBFDT) += image-fdt.o
255 obj-$(CONFIG_FIT) += image-fit.o 256 obj-$(CONFIG_FIT) += image-fit.o
256 obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o 257 obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o
257 obj-$(CONFIG_IO_TRACE) += iotrace.o 258 obj-$(CONFIG_IO_TRACE) += iotrace.o
258 obj-y += memsize.o 259 obj-y += memsize.o
259 obj-y += stdio.o 260 obj-y += stdio.o
260 261
261 # This option is not just y/n - it can have a numeric value 262 # This option is not just y/n - it can have a numeric value
262 ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV 263 ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
263 obj-y += aboot.o 264 obj-y += aboot.o
264 obj-y += fb_mmc.o 265 obj-y += fb_mmc.o
265 endif 266 endif
266 267
267 obj-$(CONFIG_CMD_BLOB) += cmd_blob.o 268 obj-$(CONFIG_CMD_BLOB) += cmd_blob.o
268 269
269 # We always have this since drivers/ddr/fs/interactive.c needs it 270 # We always have this since drivers/ddr/fs/interactive.c needs it
270 obj-y += cli_simple.o 271 obj-y += cli_simple.o
271 272
272 obj-y += cli.o 273 obj-y += cli.o
273 obj-y += cli_readline.o 274 obj-y += cli_readline.o
274 obj-y += command.o 275 obj-y += command.o
275 obj-y += s_record.o 276 obj-y += s_record.o
276 obj-y += xyzModem.o 277 obj-y += xyzModem.o
277 obj-y += cmd_disk.o 278 obj-y += cmd_disk.o
278 279
279 CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null) 280 CFLAGS_env_embedded.o := -Wa,--no-warn -DENV_CRC=$(shell tools/envcrc 2>/dev/null)
280 281
common/cmd_armflash.c
File was created 1 /*
2 * (C) Copyright 2015
3 * Linus Walleij, Linaro
4 *
5 * Support for ARM Flash Partitions
6 *
7 * SPDX-License-Identifier: GPL-2.0+
8 */
9 #include <common.h>
10 #include <command.h>
11 #include <asm/io.h>
12
13 #define MAX_REGIONS 4
14 #define MAX_IMAGES 32
15
16 struct afs_region {
17 u32 load_address;
18 u32 size;
19 u32 offset;
20 };
21
22 struct afs_image {
23 flash_info_t *flinfo;
24 const char *name;
25 u32 version;
26 u32 entrypoint;
27 u32 attributes;
28 u32 region_count;
29 struct afs_region regions[MAX_REGIONS];
30 ulong flash_mem_start;
31 ulong flash_mem_end;
32 };
33
34 static struct afs_image afs_images[MAX_IMAGES];
35 static int num_afs_images;
36
37 static u32 compute_crc(ulong start, u32 len)
38 {
39 u32 sum = 0;
40 int i;
41
42 if (len % 4 != 0) {
43 printf("bad checksumming\n");
44 return 0;
45 }
46
47 for (i = 0; i < len; i += 4) {
48 u32 val;
49
50 val = readl((void *)start + i);
51 if (val > ~sum)
52 sum++;
53 sum += val;
54 }
55 return ~sum;
56 }
57
58 static void parse_bank(ulong bank)
59 {
60 int i;
61 ulong flstart, flend;
62 flash_info_t *info;
63
64 info = &flash_info[bank];
65 if (info->flash_id != FLASH_MAN_CFI) {
66 printf("Bank %lu: missing or unknown FLASH type\n", bank);
67 return;
68 }
69 if (!info->sector_count) {
70 printf("Bank %lu: no FLASH sectors\n", bank);
71 return;
72 }
73
74 flstart = info->start[0];
75 flend = flstart + info->size;
76
77 for (i = 0; i < info->sector_count; ++i) {
78 ulong secend;
79 u32 foot1, foot2;
80
81 if (ctrlc())
82 break;
83
84 if (i == info->sector_count-1)
85 secend = flend;
86 else
87 secend = info->start[i+1];
88
89 /* Check for v1 header */
90 foot1 = readl((void *)secend - 0x0c);
91 if (foot1 == 0xA0FFFF9FU) {
92 struct afs_image *afi = &afs_images[num_afs_images];
93 ulong imginfo;
94
95 afi->flinfo = info;
96 afi->version = 1;
97 afi->flash_mem_start = readl((void *)secend - 0x10);
98 afi->flash_mem_end = readl((void *)secend - 0x14);
99 afi->attributes = readl((void *)secend - 0x08);
100 /* Adjust to even address */
101 imginfo = afi->flash_mem_end + afi->flash_mem_end % 4;
102 /* Record as a single region */
103 afi->region_count = 1;
104 afi->regions[0].offset = readl((void *)imginfo + 0x04);
105 afi->regions[0].load_address =
106 readl((void *)imginfo + 0x08);
107 afi->regions[0].size = readl((void *)imginfo + 0x0C);
108 afi->entrypoint = readl((void *)imginfo + 0x10);
109 afi->name = (const char *)imginfo + 0x14;
110 num_afs_images++;
111 }
112
113 /* Check for v2 header */
114 foot1 = readl((void *)secend - 0x04);
115 foot2 = readl((void *)secend - 0x08);
116 /* This makes up the string "HSLFTOOF" flash footer */
117 if (foot1 == 0x464F4F54U && foot2 == 0x464C5348U) {
118 struct afs_image *afi = &afs_images[num_afs_images];
119 ulong imginfo;
120 u32 block_start, block_end;
121 int j;
122
123 afi->flinfo = info;
124 afi->version = readl((void *)secend - 0x0c);
125 imginfo = secend - 0x30 - readl((void *)secend - 0x10);
126 afi->name = (const char *)secend - 0x30;
127
128 afi->entrypoint = readl((void *)imginfo+0x08);
129 afi->attributes = readl((void *)imginfo+0x0c);
130 afi->region_count = readl((void *)imginfo+0x10);
131 block_start = readl((void *)imginfo+0x54);
132 block_end = readl((void *)imginfo+0x58);
133 afi->flash_mem_start = afi->flinfo->start[block_start];
134 afi->flash_mem_end = afi->flinfo->start[block_end];
135
136 /*
137 * Check footer CRC, the algorithm saves the inverse
138 * checksum as part of the summed words, and thus
139 * the result should be zero.
140 */
141 if (compute_crc(imginfo + 8, 0x88) != 0) {
142 printf("BAD CRC on ARM image info\n");
143 printf("(continuing anyway)\n");
144 }
145
146 /* Parse regions */
147 for (j = 0; j < afi->region_count; j++) {
148 afi->regions[j].load_address =
149 readl((void *)imginfo+0x14 + j*0x10);
150 afi->regions[j].size =
151 readl((void *)imginfo+0x18 + j*0x10);
152 afi->regions[j].offset =
153 readl((void *)imginfo+0x1c + j*0x10);
154 /*
155 * At offset 0x20 + j*0x10 there is a region
156 * checksum which seems to be the running
157 * sum + 3, however since we anyway checksum
158 * the entire footer this is skipped over for
159 * checking here.
160 */
161 }
162 num_afs_images++;
163 }
164 }
165 }
166
167 static void parse_flash(void)
168 {
169 ulong bank;
170
171 /* We have already parsed the images in flash */
172 if (num_afs_images > 0)
173 return;
174 for (bank = 0; bank < CONFIG_SYS_MAX_FLASH_BANKS; ++bank)
175 parse_bank(bank);
176 }
177
178 static void load_image(const char * const name, const ulong address)
179 {
180 struct afs_image *afi = NULL;
181 int i;
182
183 parse_flash();
184 for (i = 0; i < num_afs_images; i++) {
185 struct afs_image *tmp = &afs_images[i];
186
187 if (!strcmp(tmp->name, name)) {
188 afi = tmp;
189 break;
190 }
191 }
192 if (!afi) {
193 printf("image \"%s\" not found in flash\n", name);
194 return;
195 }
196
197 for (i = 0; i < afi->region_count; i++) {
198 ulong from, to;
199
200 from = afi->flash_mem_start + afi->regions[i].offset;
201 if (address) {
202 to = address;
203 } else if (afi->regions[i].load_address) {
204 to = afi->regions[i].load_address;
205 } else {
206 printf("no valid load address\n");
207 return;
208 }
209
210 memcpy((void *)to, (void *)from, afi->regions[i].size);
211
212 printf("loaded region %d from %08lX to %08lX, %08X bytes\n",
213 i,
214 from,
215 to,
216 afi->regions[i].size);
217 }
218 }
219
220 static void print_images(void)
221 {
222 int i;
223
224 parse_flash();
225 for (i = 0; i < num_afs_images; i++) {
226 struct afs_image *afi = &afs_images[i];
227 int j;
228
229 printf("Image: \"%s\" (v%d):\n", afi->name, afi->version);
230 printf(" Entry point: 0x%08X\n", afi->entrypoint);
231 printf(" Attributes: 0x%08X: ", afi->attributes);
232 if (afi->attributes == 0x01)
233 printf("ARM executable");
234 if (afi->attributes == 0x08)
235 printf("ARM backup");
236 printf("\n");
237 printf(" Flash mem start: 0x%08lX\n",
238 afi->flash_mem_start);
239 printf(" Flash mem end: 0x%08lX\n",
240 afi->flash_mem_end);
241 for (j = 0; j < afi->region_count; j++) {
242 printf(" region %d\n"
243 " load address: %08X\n"
244 " size: %08X\n"
245 " offset: %08X\n",
246 j,
247 afi->regions[j].load_address,
248 afi->regions[j].size,
249 afi->regions[j].offset);
250 }
251 }
252 }
253
254 static int do_afs(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
255 {
256 if (argc == 1) {
257 print_images();
258 } else if (argc == 3 && !strcmp(argv[1], "load")) {
259 load_image(argv[2], 0x0);
260 } else if (argc == 4 && !strcmp(argv[1], "load")) {
261 ulong load_addr;
262
263 load_addr = simple_strtoul(argv[3], NULL, 16);
264 load_image(argv[2], load_addr);
265 } else {
266 return CMD_RET_USAGE;
267 }
268
269 return 0;
270 }
271
272 U_BOOT_CMD(afs, 4, 0, do_afs, "show AFS partitions",
273 "no arguments\n"
274 " - list images in flash\n"
275 "load <image>\n"
276 " - load an image to the location indicated in the header\n"
277 "load <image> 0x<address>\n"
278 " - load an image to the location specified\n");
279