File system from list of files?

Chris Johns chrisj at rtems.org
Wed Sep 22 05:01:32 UTC 2004


Peter Dufault wrote:
> 
> Is there a utility that I can run on Unix (or whatever development host 
> I'm using) where I can specify a list of files, and the utility will 
> generate C code that will implement a read-only POSIX filename file 
> system under RTEMS?
> 

Yes but not directly from ROM and not using C code. The files are placed 
into the IMFS (or what ever filesystem you have).

1) Create a tar file of the files you wish to access:
     $ tar cf files.tar config.c

2) Turn the tar file into an object file (m68k target):
     $ m68k-rtems-ld -r -o files.o -b binary files.tar

3) Link the object file into your application.

4) In you application untar the files using:

  #include <rtems.h>
  #include <rtems/untar.h>

  /*
   * These are created by the linker when linking a binary file.
   */
  extern int _binary_files_tar_start;
  extern int _binary_files_tar_size;

  void
  files_untar ()
  {
    Untar_FromMemory ((unsigned char *) (&_binary_files_tar_start),
                     (int) &_binary_files_tar_size);
  }

-- 
  Chris Johns



More information about the users mailing list