Possible usage of IMFS came up in a recent tech-talk thread[1]. I tried again to make
use of the logic in initialize_local_filesystem() from rtems_init.c, and this time was
successful. Although with some caveats.
As far as I can tell, only the uC5282 target provides special symbols _DownloadLocation,
_FlashBase, and _FlashSize. I found a archived mail from Eric Norum [2] which gives a
hint about how he meant this to be used
> I do this for my standalone EPICS applications by concatenating the tar file at the end of the bootstrap flash. ...
I couldn't figure out how to make use of this logic as is with pc386 (QEMU). By changing
the pointer gymnastics to something simpler I was able to load a tar containing an st.cmd
and a .dbd file. (see attached)
I don't think the idea of concatenating an FS image to an ELF executable or .boot file
can be generalized though.
Linking a tar into an executable can be generalized, but means an executable for each
IOC instance, which seems kind of awkward.
The use of rtems_tarfs_load() also carries a couple of surprises.
1. The 'tar_size' argument is actually not a size, but an upper bound address.
2. Missing directories are not created automatically, and files in them are silently ignored.
eg. "tar -cf image.tar dbd/foo.dbd st.cmd" results in a tar with only two REGTYPE
entries, and no DIRTYPE entry. "tar -xf" will automatically create "dbd/", but
rtems_tarfs_load() does not. Further, "foo.dbd" is then ignored without error.
It took me awhile to figure out what was going on...
This can be worked around by "tar -cf image.tar dbd st.cmd", or more explicitly
"tar --no-recursion -cf image.tar dbd dbd/foo.dbd st.cmd", to include an DIRTYPE
entry for "dbd". (without necessarily including all of its contents.)
[1]
https://epics.anl.gov/tech-talk/2021/msg01192.php
[2]
https://urldefense.com/v3/__https://lists.rtems.org/pipermail/users/2010-March/055394.html__;!!P4SdNyxKAPE!U6VAZxrAeNU1ltIFOQ4OVGtETAw5w-CLeKbpFrwWxmOwDLoUlylnQyJqrpasmP8$