View Single Post
Posts: 946 | Thanked: 1,650 times | Joined on Oct 2009 @ Germany
Originally Posted by ruskie View Post
Seems by default: the mmcblk0p1 partition will get exported over usb mass storage. This is the reason I kept it at 2gb vfat.
this can be fixed.

Here are the steps to get rid of your VFAT partition and to replace it with
a image on your ext3 partition. With this solution you can take pictures with the camera
app and the image is automatically exported as USB mass storage.

This example creates a 256MB image called /home/user/FAT.
You may also create a much larger image file.
Since it is created as a sparse file, only the real allocated space in the VFAT image
will be used on your ext3 partition (like a VM image).

create the image:
cd /home/user
umount MyDocs
dd if=/dev/zero of=FAT bs=1M seek=256 count=0 # small 256MB image
losetup /dev/loop0 FAT
mkfs.vfat -F32 /dev/loop0
if you want to test it:
vi /etc/fstab # replace /dev/mmcblk0p2 with /dev/loop0
mount MyDocs
now edit the relevant scripts:

/usr/sbin/ (after line 95)
if [ "x$STR" = "x" ]; then
echo $DEV > $LUN0
alternatively if you want to keep your 2GB fat partition: DEV=/dev/mmcblk0p2

/usr/sbin/ (just before the exit 0 at the end)
mount /home/user/MyDocs
exit 0
ideally, we should fix ke-recv to do this:

make sure you have no vfat partition or set it to type 83,
otherwise you have to edit /usr/lib/genfstab.awk and comment out the vfat line.

/etc/event.d/rcS-late (insert first after sfdisk cmd and the second before the other comment)
sfdisk -l /dev/mmcblk0 | awk \
-v home_opts="$home_opts" -v fat_opts="$fat_opts" \
-f /usr/lib/genfstab.awk > $tmp_fstab
echo "/dev/loop0 /home/user/MyDocs vfat $fat_opts 0 0" >> $tmp_fstab
test -f "$LOFILE" && losetup /dev/loop0 "$LOFILE"
/bin/mount /home/user/MyDocs
# We can safely continue booting now.
you may also use this directly:
echo "$LOFILE /home/user/MyDocs vfat loop,$fat_opts 0 0" >> $tmp_fstab
but then loop0 would not be reserved.
by careful with typos in this script - they may lead to bricked device!
you can extract the script part and try to execute to check for errors.

now reboot and try taking pictures and mounting per USB.
Good luck!

Last edited by titan; 2009-12-13 at 10:48.

The Following 14 Users Say Thank You to titan For This Useful Post: