IMFS question

Glen M Cornell cornell at
Fri May 10 16:13:07 UTC 2002

Chris Johns wrote:

> Glen M Cornell wrote:
>> Is there a utility or procedure to convert a directory of files into 
>> an in-memory file system?
> What I have done with a m68k target is make a tar file (not 
> compressed) of the files to serve. Then run:
>   m68k-rtems-ld -r -o pages-tar.o -b binary pages.tar
very cool.  I've been converting files to c code, then compiling - which 
could take a long time.  I use the following bourne shell function:

convert_file() {

  cat - <<EOF
 * File data for ${FILE}
static unsigned char file_${NAME}[] = {

  # Because a file may not be a text file, we can't place the
  # code in a string of bytes as characters.  Instead, we will
  # use od to print out the hexadecimal values of each character
  # as an element in an array of unsigned bytes:
  cat $FILE | /bin/od -v -t xC | cut -c9- |
    sed -e '/^[     ]*$/d' -e 's/\([0-9a-f][0-9a-f]\)/0x\1,/g'

  echo "};"
  echo ""

to essentially do the same thing as the ld trick.

However, what I'm looking to do is create the file system at compile 
time to avoid any startup-time penalties associated with creating the 
file system and creating/copying the directories and files.

More information about the users mailing list