5

I want to let u-boot select between 2 linux kernel images based on a criterion. For example, I have uImage1 and uImage2 in SPI, u-boot checks the CRC of uImage1 and if ok, boots up uImage1 else boots up uImage2. Is there an option in u-boot that I can use?

Thanks, Mani

Mani
  • 53
  • 4

1 Answers1

7

You can just set you bootcmd variable to 'bootm 80000000; bootm 820000000'. If the first bootm fails (which it will if the CRC check fails) then the second will run. If the first succeeds then the second never gets a chance to run.

Uboot does support a scripting mechanism with constructs like 'for' and 'if' e.g.:

for part in ${partition_list}
do
    if nfs ${loadaddr} ${nfs_update_prefix}.${part}
        echo Partition ${part} loaded at ${loadaddr}.
        echo Do something with it here.
    else
        echo Partition ${part} not found.
    fi
done
Pete Fordham
  • 2,278
  • 16
  • 25
  • +1 [stlinux](http://www.stlinux.com/u-boot/using) and [if comparison in uboot](http://stackoverflow.com/questions/5646749/how-to-make-if-and-comparison-statement-in-uboot). The uboot manual didn't have anything obvious. – artless noise Apr 25 '13 at 00:00