Main Page | Report this Page
 
Linux Forum Index  »  Linux Embedded  »  How to export linux fs using USB MassStorage device...
Page 2 of 2    Goto page Previous  1, 2

How to export linux fs using USB MassStorage device...

Author Message
...
Posted: Sat Jul 18, 2009 7:17 am
Guest
On Jul 9, 7:49 am, Dan Danillo <dandani... at (no spam) ymail.com> wrote:

Quote:
I'm using an embedded linux system and want to make a part of the file
system accessible from a Windows System using USB mass storage.

I know about the usb gadget driver g_file_store. This however only
works with devices or files.
As I want to be able to access the mass storage from Windows the
device/partiton or file must be formated in fat.

Is there a solution out there which lets me map a part of the linux fs
(tempfs, jffs2, fuse) as a fat formated block device or file?

Create a fat filesystem inside an image file on your linux file
system. Point gadget at this storage space, and it will represent it
to the USB host as a mass storage device containing a fat filesystem.

What you can't do is modify the contents of that file while it's
mounted on another machine as a USB mass storage device - even if it's
mounted read only, the remote machine isn't expecting the contents of
the disk to go and change unexpectedly, as that could break any
caching of data or metadata by the remote system.

I think if you want the embedded device to be able to modify it while
it's mounted, then windows is going to have to see it is a shared file
system, like a network one. To do that, you'd either need to install
drivers on the windows system - for example, gadget's usb network
driver, and then install samba on the embedded device and treat it as
a windows share.
 
Michael Schnell...
Posted: Sat Jul 18, 2009 2:44 pm
Guest
Quote:
What you can't do is modify the contents of that file while it's
mounted on another machine as a USB mass storage device - even if it's
mounted read only, the remote machine isn't expecting the contents of
the disk to go and change unexpectedly, as that could break any
caching of data or metadata by the remote system.


That of course is very true and has not been discussed yet.

If installing something propriety on the Windows system is necessary,
maybe using "serial via USB" might be the easiest way to go.

-Michael
 
Dan Danillo...
Posted: Sun Jul 19, 2009 8:16 pm
Guest
On 18 Jul., 19:17, cs_post... at (no spam) hotmail.com wrote:
Quote:
Create a fat filesystem inside an image file on your linux file
system.  Point gadget at this storage space, and it will represent it
to the USB host as a mass storage device containing a fat filesystem.
Good idea, only problem is, that the file system I want to provide is

much bigger than my flash storage or my memory.
So statically creating the file system is out of the question.

Quote:

What you can't do is modify the contents of that file while it's
mounted on another machine as a USB mass storage device - even if it's
mounted read only, the remote machine isn't expecting the contents of
the disk to go and change unexpectedly, as that could break any
caching of data or metadata by the remote system.
I'm clear on that.

But if changes happen on the embedded device I still can unload
g_file_storage and start it again
 
Dan Danillo...
Posted: Sun Jul 19, 2009 8:17 pm
Guest
On 18 Jul., 22:44, Michael Schnell
<mschnell_at_bschnell_dot... at (no spam) aol.com> wrote:
Quote:
What you can't do is modify the contents of that file while it's
mounted on another machine as a USB mass storage device - even if it's
mounted read only, the remote machine isn't expecting the contents of
the disk to go and change unexpectedly, as that could break any
caching of data or metadata by the remote system.

That of course is very true and has not been discussed yet.

If installing something propriety on the Windows system is necessary,
maybe using "serial via USB" might be the easiest way to go.

-Michael

No, it must be simple mass storage.

Dan
 
Dan Danillo...
Posted: Sun Jul 19, 2009 8:19 pm
Guest
On 20 Jul., 08:16, Dan Danillo <dandani... at (no spam) ymail.com> wrote:

Imagine a mounted SD-Card combined with data from the embedded system.
Representing multiple partitions or devices are no option either.

Dan
 
Michael Schnell...
Posted: Mon Jul 20, 2009 2:43 pm
Guest
Dan Danillo wrote:

Quote:

No, it must be simple mass storage.


o some means needs to be introduced that the files don't change while a
connection is established.

-Michael
 
...
Posted: Mon Jul 20, 2009 6:52 pm
Guest
On Jul 20, 2:16 am, Dan Danillo <dandani... at (no spam) ymail.com> wrote:
Quote:
On 18 Jul., 19:17, cs_post... at (no spam) hotmail.com wrote:> Create a fat filesystem inside an image file on your linux file
system. Point gadget at this storage space, and it will represent it
to the USB host as a mass storage device containing a fat filesystem.

Good idea, only problem is, that the file system I want to provide is
much bigger than my flash storage or my memory.
So statically creating the file system is out of the question.

Ah, okay, point gadget at /dev/zero then...

Seriously, where were you planning to get the data from?

Wherever the data is coming form, if you can represent that as a block
device, you should be able to point gadget at it.
 
...
Posted: Mon Jul 20, 2009 7:03 pm
Guest
On Jul 20, 2:19 am, Dan Danillo <dandani... at (no spam) ymail.com> wrote:
Quote:
On 20 Jul., 08:16, Dan Danillo <dandani... at (no spam) ymail.com> wrote:

Imagine a mounted SD-Card combined with data from the embedded system.
Representing multiple partitions or devices are no option either.

How about some foolery in the SD drivers to make a local image file
containing the local data overlay some clusters on the SD-card, and
put a dummy file in it's FAT pointing to them?

Actually, it's probably better to write a wrapper translation driver
the wraps the SD block device and does the substitution. But i might
be tempted to try it by modifying the SD driver first...

I think the big problem would be if somebody else wrote to the card
and moved your dummy file - actually, that could be handled just by
finding it and telling the translator where it is. It's if they made
it non-contiguous that you'd be in pain.
 
Dan Danillo...
Posted: Wed Jul 22, 2009 8:10 pm
Guest
On 21 Jul., 06:52, cs_post... at (no spam) hotmail.com wrote:
Quote:
On Jul 20, 2:16 am, Dan Danillo <dandani... at (no spam) ymail.com> wrote:

On 18 Jul., 19:17, cs_post... at (no spam) hotmail.com wrote:> Create a fat filesystem inside an image file on your linux file
system.  Point gadget at this storage space, and it will represent it
to the USB host as a mass storage device containing a fat filesystem.

Good idea, only problem is, that the file system I want to provide is
much bigger than my flash storage or my memory.
So statically creating the file system is out of the question.

Ah, okay, point gadget at /dev/zero then...

Seriously, where were you planning to get the data from?

Wherever the data is coming form, if you can represent that as a block
device, you should be able to point gadget at it.

That was the plan.

sry I'm keept bussy here.

Dan
 
Dan Danillo...
Posted: Wed Jul 22, 2009 8:10 pm
Guest
On 20 Jul., 22:43, Michael Schnell
<mschnell_at_bschnell_dot... at (no spam) aol.com> wrote:
Quote:
Dan Danillo wrote:

No, it must be simple mass storage.

o some means needs to be introduced that the files don't change while a
connection is established.

-Michael

Yep, thats an issue, but first let me ghet started.

Dan
 
Dan Danillo...
Posted: Wed Jul 22, 2009 8:12 pm
Guest
On 21 Jul., 07:03, cs_post... at (no spam) hotmail.com wrote:
Quote:
On Jul 20, 2:19 am, Dan Danillo <dandani... at (no spam) ymail.com> wrote:

On 20 Jul., 08:16, Dan Danillo <dandani... at (no spam) ymail.com> wrote:

Imagine a mounted SD-Card combined with data from the embedded system.
Representing multiple partitions or devices are no option either.

How about some foolery in the SD drivers to make a local image file
containing the local data overlay some clusters on the SD-card, and
put a dummy file in it's FAT pointing to them?

Actually, it's probably better to write a wrapper translation driver
the wraps the SD block device and does the substitution.  But i might
be tempted to try it by modifying the SD driver first...

I think the big problem would be if somebody else wrote to the card
and moved your dummy file - actually, that could be handled just by
finding it and telling the translator where it is.  It's if they made
it non-contiguous that you'd be in pain.

Modify an existing driver - don't like that idea.
The data on the sd-card wont change, the data on the fs might change.
If I can notice that I can disconnect unload g_file store and load it
again.

Dan
 
...
Posted: Thu Jul 23, 2009 4:35 am
Guest
On Jul 23, 2:12 am, Dan Danillo <dandani... at (no spam) ymail.com> wrote:

Quote:
How about some foolery in the SD drivers to make a local image file
containing the local data overlay some clusters on the SD-card, and
put a dummy file in it's FAT pointing to them?
Actually, it's probably better to write a wrapper translation driver

Modify an existing driver - don't like that idea.

Then go with the wrapper driver?

Quote:
The data on the sd-card wont change, the data on the fs might change.
If I can notice that I can disconnect unload g_file store and load it
again.

Not sure the host PC is going to be really happy about you doing
that. It will survive the disconnect, probably at the cost of an
eventual error message to the user, but you may have to re-enumerate
to reconnect. I'd be worried about it not re-discovering you.
 
 
Page 2 of 2    Goto page Previous  1, 2
All times are GMT - 5 Hours
The time now is Sun Nov 22, 2009 3:21 am