|
226 | 226 | #define CONFIG_ENV_SPI_BUS 1
|
227 | 227 | #define CONFIG_ENV_SPI_CS 0
|
228 | 228 |
|
229 |
| -#define UPGRADE_CHECK_RESET \ |
230 |
| - "if test ${attempt_upgrade} -eq 1; then " \ |
231 |
| - "reset; " \ |
232 |
| - "fi;" |
| 229 | +#define CONFIG_CMD_SETEXPR |
| 230 | + |
233 | 231 | #define USB_BOOTCOMMAND \
|
234 | 232 | "sf probe 1:0;" \
|
235 | 233 | "mtdparts default;" \
|
|
278 | 276 | "ubifsload $loadaddr $bootdir$bootfile && " \
|
279 | 277 | "ubifsload $fdtaddr $bootdir$fdtfile && " \
|
280 | 278 | "bootm $loadaddr - $fdtaddr\";" \
|
281 |
| - "run ubifs_bootm_cmd" |
282 |
| - |
283 |
| -#define DUAL_NAND_BOOTCOMMAND_RESET \ |
284 |
| - DUAL_NAND_BOOTCOMMAND " || " UPGRADE_CHECK_RESET |
| 279 | + "run ubifs_bootm_cmd || reset;" |
285 | 280 |
|
286 | 281 | #ifdef CONFIG_BOOTCOUNT_LIMIT
|
287 | 282 |
|
288 | 283 | #define CONFIG_SYS_BOOTCOUNT_ADDR 0x18102120
|
289 | 284 |
|
290 | 285 | #define ALT_BOOTCOMMAND \
|
291 |
| - "if test ${attempt_upgrade} -eq 1; then " \ |
292 |
| - "if test ${boot_partition} -eq 0; then " \ |
293 |
| - "setenv boot_partition 1;" \ |
294 |
| - "else " \ |
295 |
| - "setenv boot_partition 0;" \ |
296 |
| - "fi;" \ |
297 |
| - "setenv attempt_upgrade 0;" \ |
298 |
| - "saveenv;" \ |
299 |
| - "fi;" \ |
| 286 | + "setexpr bootcount_temp $bootcount - 1;" \ |
| 287 | + "setexpr switch_partition $bootcount_temp % $bootlimit;" \ |
| 288 | + "if test ${switch_partition} -eq 0; then " \ |
| 289 | + "if test ${boot_partition} -eq 0; then " \ |
| 290 | + "echo **Switching to partition 1;" \ |
| 291 | + "setenv boot_partition 1;" \ |
| 292 | + "else " \ |
| 293 | + "echo **Switching to partition 0;" \ |
| 294 | + "setenv boot_partition 0;" \ |
| 295 | + "fi;" \ |
| 296 | + "env delete bootcount_temp;" \ |
| 297 | + "env delete switch_partition;" \ |
| 298 | + "saveenv;" \ |
| 299 | + "fi;" \ |
300 | 300 | DUAL_NAND_BOOTCOMMAND
|
301 | 301 |
|
302 | 302 | #define BOOTCOUNT_VARIABLES \
|
303 | 303 | "bootlimit=5\0" \
|
304 |
| - "attempt_upgrade=0\0" \ |
305 | 304 | "altbootcmd="ALT_BOOTCOMMAND"\0"
|
306 | 305 |
|
307 | 306 | #else
|
|
337 | 336 |
|
338 | 337 | #else
|
339 | 338 |
|
340 |
| -#define CONFIG_BOOTCOMMAND DUAL_NAND_BOOTCOMMAND_RESET |
| 339 | +#define CONFIG_BOOTCOMMAND DUAL_NAND_BOOTCOMMAND |
341 | 340 |
|
342 | 341 | #endif
|
343 | 342 |
|
|
363 | 362 | "nandboot="NAND_BOOTCOMMAND"\0" \
|
364 | 363 | "ethboot="ETH_BOOTCOMMAND"\0" \
|
365 | 364 | "netboot="NET_BOOTCOMMAND"\0" \
|
366 |
| - "dualnandboot="DUAL_NAND_BOOTCOMMAND_RESET"\0" \ |
| 365 | + "dualnandboot="DUAL_NAND_BOOTCOMMAND"\0" \ |
367 | 366 | BOOTCOUNT_VARIABLES \
|
368 | 367 | "u_memload=0x00800000\0" \
|
369 | 368 | "u_memsize=0x08000000\0" \
|
|
0 commit comments