I would like, from my u-boot script, to check the existence of a file on a device before running the image on this device. Indeed, this would ensure to have access to the requested device before booting from it. How could I test the file existence using u-boot console commands?
The following test does a ls on the USB stick, and here are the results with USB stick present:
> if ext2ls usb 0; then echo "USB ON"; else echo "USB KO"; fi
<DIR> 4096 .
<DIR> 4096 ..
<DIR> 16384 lost+found
<DIR> 4096 boot
4096 boot.scr
USB ON
Same test without USB stick:
> if ext2ls usb 0; then echo "USB ON"; else echo "USB KO"; fi
** Bad device usb 0 **
USB KO
My wish would be to test the presence of the boot.scr file in fact. How could I do that please?