4

I'm attempting to run a simple u-boot script that will load a file from an SDcard into RAM before the Linux Kernel starts booting, and so far have had success with the 'load' command.

Unfortunately, I have to hardcode the filename into this u-boot script so I'd like to use a wildcard (such as *) to ignore the build date which is appended onto all of my filenames. I can't see any reference to wildcards within the U-Boot environment, so was wondering if anyone knew if this sort of things was possible?

I know that U-Boot is cut-down and not designed for this sort of thing, but we need this function to happen within a short time after release of reset and we cannot wait for Linux to boot.

I have attached the simple extract of my code below:

"if test -e mmc 0:1 <filename>.img; then " \
    "load mmc 0:1 0x81000000 <filename>.img; echo Image loaded into DRAM; " \
    "<RUN C PROGRAM HERE>;" \
"else echo No firmware image found; fi;"

Thanks for any help.

Tom Bailey
  • 41
  • 1
  • 1
    Looks like (from the extract of your "code") that you have installed the Hush shell in your U-Boot. According to [this guide](http://cd.textfiles.com/geminiatari/FILES/TELECOMM/HERM103B/USR/MAN/MAN1/HUSH.TXT), "most internal commands accept wildcards ("*" and "?") in file names". – sawdust Sep 18 '15 at 19:09
  • Thanks for the response Sawdust. I'm altering the u-boot provided with the Beaglebone Black and I think you're right in that it has the Hush shell running. I have already tried the Hush shell wildcards (* and ?) but with no luck, so I don't think it has the full capability installed / enabled. Do you know if this is something that can be configured when building u-boot? I'm not entirely sure what syntax applies to u-boot and what applies to the HUSH shell, or even if you can separate the two? (I'm pretty new to this as you can probably tell) Thanks for your help. – Tom Bailey Sep 21 '15 at 09:14
  • *"if you can separate the two?"* -- They are quite distinct. Use the U-Boot `help` command to get a list of installed U-Boot commands. A quick review of [common/cli_hush.c](http://git.denx.de/?p=u-boot.git;a=blob;f=common/cli_hush.c;h=296542f4c2d62b7094694a40c79c7d2fe9fdf545;hb=HEAD) indicates that there may be no filename expansion for wildcards after all. – sawdust Sep 22 '15 at 08:17
  • What would you expect the load command to do if your filename with wildcards has multiple matches? The best thing would be to create an updated boot.scr file when you write the new file to the SD card. – Xypron Aug 08 '20 at 18:41

0 Answers0