|
36 | 36 | *FIT Image
|
37 | 37 | */
|
38 | 38 | #define CONFIG_FIT
|
39 |
| -#ifdef CONFIG_FIT |
40 | 39 | #define CONFIG_FIT_BEST_MATCH
|
41 | 40 | #define CONFIG_FIT_SIGNATURE
|
42 | 41 | #define CONFIG_FIT_VERBOSE
|
43 | 42 | #define CONFIG_RSA
|
44 | 43 | #define CONFIG_RSA_SOFTWARE_EXP
|
45 | 44 | #define CONFIG_IMAGE_FORMAT_LEGACY
|
46 |
| -#define FITBOOT_VARIABLES \ |
47 |
| - "fitfile=fitImage\0" \ |
48 |
| - "fitconf="PISTACHIO_BOARD_NAME"_config@1\0" \ |
49 |
| - "bootm_verify=y\0" |
50 |
| -#else |
51 |
| -#define FITBOOT_VARIABLES "" |
52 |
| -#endif |
53 | 45 |
|
54 | 46 | /*
|
55 | 47 | * Memory map
|
|
217 | 209 | #define CONFIG_MTD_PARTITIONS
|
218 | 210 | #define CONFIG_CMD_UBI
|
219 | 211 | #define CONFIG_CMD_UBIFS
|
220 |
| -#define MTDIDS_DEFAULT "nand0=spi-nand,nor0=spi-nor" |
221 |
| -#define MTDPARTS_DEFAULT "mtdparts=spi-nand:256M(firmware0),256M(firmware1);"\ |
222 |
| - "spi-nor:1536k(uboot),8k(data-ro),8k(uEnv),496k(data-rw)" |
| 212 | +#define MTDIDS_DEFAULT \ |
| 213 | + "nand0=spi-nand,nor0=spi-nor" |
| 214 | +#define MTDPARTS_DEFAULT \ |
| 215 | + "mtdparts=spi-nand:256M(firmware0),256M(firmware1);"\ |
| 216 | + "spi-nor:1536k(uboot),8k(data-ro),8k(uEnv),496k(data-rw)" |
223 | 217 | #endif
|
224 | 218 |
|
225 | 219 | /* I2C */
|
|
254 | 248 | #define CONFIG_SYS_NO_FLASH
|
255 | 249 |
|
256 | 250 | #define CONFIG_ENV_IS_IN_SPI_FLASH
|
257 |
| -#define CONFIG_ENV_SECT_SIZE 0x01000 /* 4KB */ |
| 251 | +#define CONFIG_ENV_SECT_SIZE 0x01000 /* 4KB */ |
258 | 252 | #define CONFIG_ENV_SIZE 0x02000 /* 8KB */
|
259 | 253 | #define CONFIG_ENV_OFFSET 0x182000 /* env starts here */
|
260 | 254 | #define CONFIG_ENV_SPI_BUS 1
|
261 | 255 | #define CONFIG_ENV_SPI_CS 0
|
262 | 256 |
|
263 |
| -#define USB_BOOTCOMMAND \ |
264 |
| - "sf probe 1:0;" \ |
265 |
| - "mtdparts default;" \ |
266 |
| - "setenv bootargs $console $earlycon $usbroot $bootextra $mtdparts;" \ |
267 |
| - "setenv verify n;" \ |
268 |
| - "usb start;" \ |
269 |
| - "ext4load usb $usbdev $fdtaddr $bootdir$fdtfile;" \ |
270 |
| - "ext4load usb $usbdev $loadaddr $bootdir$bootfile;" \ |
271 |
| - "bootm $loadaddr - $fdtaddr;" |
272 |
| - |
273 |
| -#define ETH_BOOTCOMMAND \ |
274 |
| - "setenv verify n;" \ |
275 |
| - "dhcp $loadaddr $bootfile; dhcp $fdtaddr $fdtfile;" \ |
276 |
| - "bootm $loadaddr - $fdtaddr;" |
277 |
| - |
278 |
| -#define MMC_BOOTCOMMAND \ |
279 |
| - "sf probe 1:0;" \ |
280 |
| - "mtdparts default;" \ |
281 |
| - "setenv bootargs $console $earlycon $mmcroot $bootextra $mtdparts;" \ |
282 |
| - "setenv verify n;" \ |
283 |
| - "mmcinfo; mmc dev $mmcdev;" \ |
284 |
| - "ext4load mmc $mmcdev $fdtaddr $bootdir$fdtfile;" \ |
285 |
| - "ext4load mmc $mmcdev $loadaddr $bootdir$bootfile;" \ |
286 |
| - "bootm $loadaddr - $fdtaddr;" |
287 |
| - |
288 |
| -#define NAND_BOOTCOMMAND \ |
289 |
| - "sf probe 1:0;" \ |
290 |
| - "mtdparts default;" \ |
291 |
| - "setenv nandroot ubi.mtd=firmware0 root=ubi0:rootfs rootfstype=ubifs;" \ |
292 |
| - "setenv bootargs $console $earlycon $nandroot $bootextra $mtdparts;" \ |
293 |
| - "setenv verify n;" \ |
294 |
| - "ubi part firmware0;" \ |
295 |
| - "ubifsmount ubi:rootfs;" \ |
296 |
| - "ubifsload $loadaddr $bootdir$bootfile;" \ |
297 |
| - "ubifsload $fdtaddr $bootdir$fdtfile;" \ |
298 |
| - "bootm $loadaddr - $fdtaddr;" |
299 |
| - |
300 |
| -#define DUAL_NAND_BOOT_INIT \ |
301 |
| - "sf probe 1:0;" \ |
302 |
| - "mtdparts default;" \ |
303 |
| - "setenv nandroot ubi.mtd=firmware${boot_partition} root=ubi0:rootfs rootfstype=ubifs;" \ |
304 |
| - "setenv bootargs $console $earlycon $nandroot $bootextra $mtdparts panic=2;" \ |
305 |
| - "setenv verify $bootm_verify;" \ |
306 |
| - "ubi part firmware${boot_partition};" \ |
307 |
| - "ubifsmount ubi:rootfs || reset;" |
308 |
| - |
309 |
| -#define DUAL_NAND_UIMAGE_BOOT \ |
310 |
| - "setenv ubifs_bootm_cmd \"ubifsload $loadaddr $bootdir$bootfile && " \ |
311 |
| - "ubifsload $fdtaddr $bootdir$fdtfile && " \ |
312 |
| - "bootm $loadaddr - $fdtaddr\";" |
313 |
| - |
314 |
| -#define DUAL_NAND_FITIMAGE_BOOT \ |
315 |
| - "setenv ubifs_bootm_cmd \"ubifsload $loadaddr $bootdir$fitfile && " \ |
316 |
| - "bootm $loadaddr#$fitconf\";" |
317 |
| - |
318 |
| - |
319 |
| -#ifdef CONFIG_FIT |
320 |
| -/* |
321 |
| - If fitImage file is found boot that, else try uImage |
322 |
| -*/ |
323 |
| -#define DUAL_NAND_BOOTCOMMAND \ |
324 |
| - DUAL_NAND_BOOT_INIT \ |
325 |
| - "if ubifsls $bootdir$fitfile; then " \ |
326 |
| - DUAL_NAND_FITIMAGE_BOOT \ |
327 |
| - "else " \ |
328 |
| - DUAL_NAND_UIMAGE_BOOT \ |
329 |
| - "fi;" \ |
330 |
| - "run ubifs_bootm_cmd || reset;" |
331 |
| -#else |
332 |
| -#define DUAL_NAND_BOOTCOMMAND \ |
333 |
| - DUAL_NAND_BOOT_INIT \ |
334 |
| - DUAL_NAND_UIMAGE_BOOT \ |
335 |
| - "run ubifs_bootm_cmd || reset;" |
336 |
| -#endif |
| 257 | +#define INIT_BOOTCOMMAND \ |
| 258 | + "sf probe 1:0;"\ |
| 259 | + "mtdparts default;"\ |
| 260 | + "setenv verify $bootm_verify;" |
337 | 261 |
|
338 |
| -#ifdef CONFIG_BOOTCOUNT_LIMIT |
| 262 | +#define USB_BOOTCOMMAND \ |
| 263 | + "setenv bootargs $console $earlycon $usbroot $bootextra $mtdparts;"\ |
| 264 | + "usb start;"\ |
| 265 | + "ext4load usb $usbdev $loadaddr $bootdir$fitfile;" |
339 | 266 |
|
340 |
| -#define CONFIG_SYS_BOOTCOUNT_ADDR 0x18102120 |
| 267 | +#define ETH_BOOTCOMMAND \ |
| 268 | + "dhcp $loadaddr $fitfile;" |
341 | 269 |
|
342 |
| -#define ALT_BOOTCOMMAND \ |
343 |
| - "setexpr bootcount_temp $bootcount - 1;" \ |
344 |
| - "setexpr switch_partition $bootcount_temp % $bootlimit;" \ |
345 |
| - "if test ${switch_partition} -eq 0; then " \ |
346 |
| - "if test ${boot_partition} -eq 0; then " \ |
347 |
| - "echo **Switching to partition 1;" \ |
348 |
| - "setenv boot_partition 1;" \ |
349 |
| - "else " \ |
350 |
| - "echo **Switching to partition 0;" \ |
351 |
| - "setenv boot_partition 0;" \ |
352 |
| - "fi;" \ |
353 |
| - "env delete bootcount_temp;" \ |
354 |
| - "env delete switch_partition;" \ |
355 |
| - "saveenv;" \ |
356 |
| - "fi;" \ |
357 |
| - DUAL_NAND_BOOTCOMMAND |
358 |
| - |
359 |
| -#define BOOTCOUNT_VARIABLES \ |
360 |
| - "bootlimit=5\0" \ |
361 |
| - "altbootcmd="ALT_BOOTCOMMAND"\0" |
| 270 | +#define NET_BOOTCOMMAND \ |
| 271 | + "setenv bootargs $console $earlycon $netroot nfsroot=$serverip:$rootpath $bootextra $mtdparts;"\ |
| 272 | + ETH_BOOTCOMMAND |
362 | 273 |
|
363 |
| -#else |
| 274 | +#define MMC_BOOTCOMMAND \ |
| 275 | + "setenv bootargs $console $earlycon $mmcroot $bootextra $mtdparts;"\ |
| 276 | + "mmcinfo; mmc dev $mmcdev;"\ |
| 277 | + "ext4load mmc $mmcdev $loadaddr $bootdir$fitfile;" |
364 | 278 |
|
365 |
| -#define BOOTCOUNT_VARIABLES "" |
| 279 | +/* Support legacy uImage on nand for smoother transition */ |
| 280 | +#ifdef CONFIG_IMAGE_FORMAT_LEGACY |
366 | 281 |
|
367 |
| -#endif |
| 282 | +#define BOOT_ENV_LEGACY \ |
| 283 | + "fdtaddr=0x0D000000\0"\ |
| 284 | + "fdtfile="PISTACHIO_BOARD_NAME".dtb\0"\ |
| 285 | + "legacy_bootfile=uImage\0" |
368 | 286 |
|
369 |
| -#define NET_BOOTCOMMAND \ |
370 |
| - "sf probe 1:0;" \ |
371 |
| - "mtdparts default;" \ |
372 |
| - "setenv bootargs $console $earlycon $netroot nfsroot=$serverip:$rootpath $bootextra $mtdparts;" \ |
373 |
| - ETH_BOOTCOMMAND |
| 287 | +#define NAND_BOOTCOMMAND_LEGACY \ |
| 288 | + "echo Loading legacy kernel from rootfs... && "\ |
| 289 | + "ubifsload $loadaddr $bootdir$legacy_bootfile && "\ |
| 290 | + "ubifsload $fdtaddr $bootdir$fdtfile && "\ |
| 291 | + "bootm $loadaddr - $fdtaddr || " |
374 | 292 |
|
375 |
| -#define BOOT_EXTRA "rootwait ro lpj=723968" |
| 293 | +#else |
376 | 294 |
|
377 |
| -#ifndef NAND_BOOT |
378 |
| -#define CONFIG_BOOTCOMMAND USB_BOOTCOMMAND |
| 295 | +#define BOOT_ENV_LEGACY "" |
| 296 | +#define NAND_BOOTCOMMAND_LEGACY "" |
| 297 | + |
| 298 | +#endif |
| 299 | + |
| 300 | +#define NAND_BOOTCOMMAND \ |
| 301 | + "setenv nandroot ubi.mtd=firmware$boot_partition;"\ |
| 302 | + "setenv bootargs $console $earlycon $nandroot $bootextra $mtdparts panic=2;"\ |
| 303 | + "echo Attempting to boot from firmware$boot_partition;"\ |
| 304 | + "ubi part firmware$boot_partition || reset;"\ |
| 305 | + "if ubi check kernel; then "\ |
| 306 | + "echo Loading kernel from volume...;"\ |
| 307 | + "ubi read $loadaddr kernel || reset;"\ |
| 308 | + "else "\ |
| 309 | + "echo Loading kernel from rootfs...;"\ |
| 310 | + "ubifsmount ubi:rootfs && "\ |
| 311 | + "ubifsload $loadaddr $bootdir$fitfile || "NAND_BOOTCOMMAND_LEGACY"reset;"\ |
| 312 | + "fi;" |
| 313 | + |
| 314 | +#define ALT_BOOTCOMMAND \ |
| 315 | + "setexpr boot_partition $boot_partition + 1;"\ |
| 316 | + "setexpr boot_partition $boot_partition % 2;"\ |
| 317 | + "echo Boot failure detected, switching to firmware$boot_partition;"\ |
| 318 | + "saveenv;" |
| 319 | + |
| 320 | +#define FINAL_BOOTCOMMAND \ |
| 321 | + "bootm $loadaddr#$fitconf || reset;" |
| 322 | + |
| 323 | +#define CONFIG_BOOTDELAY 2 |
| 324 | +#define CONFIG_SYS_BOOTCOUNT_ADDR 0x18102120 |
| 325 | +#ifdef NAND_BOOT |
| 326 | +#define CONFIG_BOOTCOMMAND "run nandboot" |
379 | 327 | #else
|
380 |
| -#define CONFIG_BOOTCOMMAND DUAL_NAND_BOOTCOMMAND |
| 328 | +#define CONFIG_BOOTCOMMAND "run usbboot" |
381 | 329 | #endif
|
382 | 330 |
|
383 |
| -#define CONFIG_EXTRA_ENV_SETTINGS \ |
384 |
| - "console=console=ttyS1,115200n8\0" \ |
385 |
| - "earlycon=earlycon=uart8250,mmio32,0x18101500,115200\0" \ |
386 |
| - "bootextra="BOOT_EXTRA"\0" \ |
387 |
| - "rootpath=/srv/fs\0" \ |
388 |
| - "usbroot=root=/dev/sda1\0" \ |
389 |
| - "mmcroot=root=/dev/mmcblk0p1\0" \ |
390 |
| - "boot_partition=0\0" \ |
391 |
| - "netroot=root=/dev/nfs rootfstype=nfs ip=dhcp\0" \ |
392 |
| - "fdtaddr=0x0D000000\0" \ |
393 |
| - "fdtfile="PISTACHIO_BOARD_NAME".dtb\0" \ |
394 |
| - "bootfile=uImage\0" \ |
395 |
| - FITBOOT_VARIABLES \ |
396 |
| - "loadaddr=0x0E000000\0" \ |
397 |
| - "bootdir=/\0" \ |
398 |
| - "usbdev=0\0" \ |
399 |
| - "usbpart=0\0" \ |
400 |
| - "mmcdev=0\0" \ |
401 |
| - "usbboot="USB_BOOTCOMMAND"\0" \ |
402 |
| - "mmcboot="MMC_BOOTCOMMAND"\0" \ |
403 |
| - "nandboot="NAND_BOOTCOMMAND"\0" \ |
404 |
| - "ethboot="ETH_BOOTCOMMAND"\0" \ |
405 |
| - "netboot="NET_BOOTCOMMAND"\0" \ |
406 |
| - "dualnandboot="DUAL_NAND_BOOTCOMMAND"\0" \ |
407 |
| - BOOTCOUNT_VARIABLES \ |
408 |
| - "factory_reset="FACTORY_RESET_CMD"\0" \ |
| 331 | +#define CONFIG_EXTRA_ENV_SETTINGS \ |
| 332 | + "console=console=ttyS1,115200n8\0"\ |
| 333 | + "earlycon=earlycon=uart8250,mmio32,0x18101500,115200\0"\ |
| 334 | + "bootextra=rootwait ro lpj=723968\0"\ |
| 335 | + "loadaddr=0x0E000000\0"\ |
| 336 | + "boot_partition=0\0"\ |
| 337 | + "bootlimit=5\0"\ |
| 338 | + "fitfile=fitImage\0"\ |
| 339 | + "fitconf=config@1\0"\ |
| 340 | + "bootm_verify=n\0"\ |
| 341 | + "rootpath=/srv/fs\0"\ |
| 342 | + "netroot=root=/dev/nfs rootfstype=nfs ip=dhcp\0"\ |
| 343 | + "usbroot=root=/dev/sda1\0"\ |
| 344 | + "mmcroot=root=/dev/mmcblk0p1\0"\ |
| 345 | + "usbdev=0\0"\ |
| 346 | + "mmcdev=0\0"\ |
| 347 | + "usbboot="INIT_BOOTCOMMAND USB_BOOTCOMMAND FINAL_BOOTCOMMAND"\0"\ |
| 348 | + "mmcboot="INIT_BOOTCOMMAND MMC_BOOTCOMMAND FINAL_BOOTCOMMAND"\0"\ |
| 349 | + "ethboot="INIT_BOOTCOMMAND ETH_BOOTCOMMAND FINAL_BOOTCOMMAND"\0"\ |
| 350 | + "netboot="INIT_BOOTCOMMAND NET_BOOTCOMMAND FINAL_BOOTCOMMAND"\0"\ |
| 351 | + "nandboot="INIT_BOOTCOMMAND NAND_BOOTCOMMAND FINAL_BOOTCOMMAND"\0"\ |
| 352 | + "altbootcmd="INIT_BOOTCOMMAND ALT_BOOTCOMMAND NAND_BOOTCOMMAND FINAL_BOOTCOMMAND"\0"\ |
| 353 | + "factory_reset="FACTORY_RESET_CMD"\0"\ |
| 354 | + BOOT_ENV_LEGACY\ |
409 | 355 | "\0"
|
410 | 356 |
|
411 |
| -#define CONFIG_BOOTDELAY 2 |
412 |
| - |
413 | 357 | /*
|
414 | 358 | * Hash Accelerator
|
415 | 359 | */
|
|
0 commit comments