We're planning to implement a USB File-Backed Gadget using
a RAM disk. Initially, we have implemented it using an ordinary file
with 16MB size with the following commands. I tried the same sequence
of commands on /dev/ram0 and on fdisk using 1024 cylinder and it seems
to work. Is this really how it should be done on a RAM disk ?
File :
fdisk settings
sectors/track - 8
heads - 16
cylinder - 256
Commands Sequence
1. dd if=/dev/zero of=/<file> bs=1M count=16 <- 16MB File
2. mkdosfs /<file>
3. fdisk /<file> <-
Create Partition
-> on expert mode set
- sector/track - 8
- heads - 16
- cylinder - 256
4. losetup -o <Start*sector size> /dev/loop/0 /<file>
Units = sectors of 1 * 512 = 512 bytes
(RAM disk -> 1024 bytes)
5. format partition : mkdosfs -F 16 /dev/loop/0
6. detach loop device : losetup -d /dev/loop/0
7. Mounting the file
mount -o loop /<file> /<mount point>
8. Copy some test files, then unmount.
9. modprobe g_file_storage file=/<file>
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source