[U-Boot-Users] Extending bootm command.

Hi there,
from time to time it might be necessary to (decompress and) copy some data from flash to ram.
The configuration data for an Altera ACEX 1K FPGA for instance is about 163KB. The gzipped file (for a quite complex design) is only 54kB. So instead of wasting three flash sectors one could store a gzipped and mkimage wrapped version of the data in flash. If calling mkimage with the type STANDALONE like [1] proposes one could then use "bootm" to decompress and copy these data to ram. In order to call "fpga load" afterwards one need the location and the resulting size of the data. That is why I suggest the following patch:
* Patch by Steven Scholz, 29 Sep 2003: - A second parameter for bootm overwrites the load address for "Standalone Application" images. - bootm sets environment variable "filesize" to the resulting data lenght for "Standalone Application" images when autostart is set to "no".
Then one could do something like
if bootm $fpgadata $some_free_ram ; then fpga load 0 $some_free_ram $filesize ; fi
Cheers,
Steven
[1] https://www.denx.de/twiki/bin/view/DULG/HowCanILoadAndUncompressACompressedI...
+ diff -u ./common/cmd_bootm.c.orig ./common/cmd_bootm.c --- ./common/cmd_bootm.c.orig Fri Aug 29 22:58:07 2003 +++ ./common/cmd_bootm.c Mon Sep 29 10:18:56 2003 @@ -247,6 +247,10 @@
switch (hdr->ih_type) { case IH_TYPE_STANDALONE: name = "Standalone Application"; + /* A second argument overwrites the load address */ + if (argc > 2) { + hdr->ih_load = simple_strtoul(argv[2], NULL, 16); + } break; case IH_TYPE_KERNEL: name = "Kernel Image"; break; @@ -347,8 +351,12 @@ /* load (and uncompress), but don't start if "autostart" * is set to "no" */ - if (((s = getenv("autostart")) != NULL) && (strcmp(s,"no") == 0)) + if (((s = getenv("autostart")) != NULL) && (strcmp(s,"no") == 0)) { + char buf[32]; + sprintf(buf, "%lX", len); + setenv("filesize", buf); return 0; + } appl = (int (*)(cmd_tbl_t *, int, int, char *[]))ntohl(hdr->ih_ep); (*appl)(cmdtp, flag, argc-1, &argv[1]); return 0;

Steven Scholz wrote:
... from time to time it might be necessary to (decompress and) copy some data from flash to ram. ...
- Patch by Steven Scholz, 29 Sep 2003:
- A second parameter for bootm overwrites the load address for "Standalone Application" images.
- bootm sets environment variable "filesize" to the resulting data
lenght for "Standalone Application" images when autostart is set to "no".
Then one could do something like
if bootm $fpgadata $some_free_ram ; then fpga load 0 $some_free_ram $filesize ; fi
Any comments on that?
Thanks,
Steven

Dear Steven,
in message 3F827F5E.6060609@imc-berlin.de you wrote:
Then one could do something like
if bootm $fpgadata $some_free_ram ; then fpga load 0 $some_free_ram $filesize ; fi
Any comments on that?
I think Detlev already ACKed that this is a good thing to do.
It's in "The Queue" - sorry, I'm just back from vacation and there is a _huge_ backlog.
Best regards,
Wolfgang Denk

In message 3F7808C9.2020708@imc-berlin.de you wrote:
- Patch by Steven Scholz, 29 Sep 2003:
- A second parameter for bootm overwrites the load address for "Standalone Application" images.
- bootm sets environment variable "filesize" to the resulting data lenght for "Standalone Application" images when autostart is set to "no".
Thanks, added. Will show up on CVS soon.
Best regards,
Wolfgang Denk
participants (2)
-
Steven Scholz
-
Wolfgang Denk