Using tar to access files

Gedare Bloom gedare at gwu.edu
Tue Jun 30 16:48:42 UTC 2015


On Tue, Jun 30, 2015 at 1:10 AM, Nick Withers <nick.withers at anu.edu.au> wrote:
> On Tue, 2015-06-30 at 10:09 +0530, Sujay Raj wrote:
>> I need to access configurations files the for web server I am porting to
>> rtems.
>>
>> I create a tar archive , that contains the required folders and files ,
>> convert it into c source using rtems-bin2c , ( a header file and a c source
>> ) and link them with my project.
>>
>> In the init, I call
>>
>> sc = Untar_FromMemory((void *)TARFILE_START, (size_t)TARFILE_SIZE);
>
> I'm not familiar with that function but I use rtems_tarfs_load()
> successfully.
>
> Not sure whether it needs CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS or
> other resources off the top of my head.
>
> P.S. It'd probably be best to send help requests like this to the users
> list
>
I've used this Untar some. You might want to look into the file image
created, and even untar it with your host to see what it produces.

Here are the commands I use from an old repo (with CVS and SVN vc),
after placing the files in a directory called "files"

cd files
tar -cvf ../FileSystemImage --exclude CVS --exclude .cvsignore --exclude .svn .
cd ..
rtems-bin2c FileSystemImage FileSystemImage

This creates the .c and .h files I need so that I can use in my init():
Untar_FromMemory(FileSystemImage, FileSystemImage_size)

I also used
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 40
#define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK 512

All of this was awhile ago, but maybe these pointers will help you.

-Gedare

>> where TARFILE_START is the macro with the name of the array , TARFILE_SIZE
>> is the size of the array.
>>
>> But when I run the program, I get errors of the form
>>
>> "Untar: failed to create file <folder>/<filename>"
>>
>> for all the files in the tar archive (there are about 10 files, 10 errors).
>>
>> There are no build errors, and since my application recognizes files
>> present in the tar archive, I think possibly I am missing to initialize
>> something.
>>
>> Help would be really appreciated.
>>
>> Thanks and Regards,
>> Sujay Raj
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
>
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list