I need to create a 3-step macro in U-Boot:
I know how to do steps 1 and 3, but not 2.
I know that I can use the U-Boot command itest to test integer values, but I don't know how to create a compound statement in the if/else/endif clause.
And I don't know how to have an "abort macro" step in one of those clauses.
How can I stop a U-Boot command sequence abruptly?
For testing if the result of itest is true you can use the if command. To leave a macro use the exitcommand:
setenv macro 'if itest $filesize > 2048; then exit; else echo bingo; fi; echo continuing'
setenv filesize 10000
run macro
Man-pages for 'if' and 'itest' have been added to https://docs.u-boot.org/en/latest/usage/.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With