Mani
Mani

Reputation: 53

u-boot - select the correct linux image

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

Upvotes: 5

Views: 2158

Answers (1)

Pete Fordham
Pete Fordham

Reputation: 2343

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

Upvotes: 7

Related Questions