Encoding/Decoding boot.scr
If/Else syntax
# Converting boot.cmd to boot.scr
mkimage -T script -d boot.txt boot.scr
# Reverse
dd if=boot.scr of=boot.cmd bs=72 skip=1
if <test statement>
then
<statements>
fi
if <test statement>
then
<statements>
else
<statements>
fi
a=1; if itest $a == 0; then echo true; else echo false; fi
if tftp $kernel_addr_r shellriscv64.efi; then bootefi $kernel_addr_r; fi
test statement
Any command. The test statement set the $? variable. If the value of $? becomes 0 (true) the statements after the then statement will be executed. Otherwise the statements after the else statement.