Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unable to mount the SD card formatted using the DIGITAL CAMREA on Linux box

1 view
Skip to first unread message

Srinivas G.

unread,
Jul 29, 2005, 7:30:39 AM7/29/05
to linux-kernel-Mailing-list
Dear All,

We have developed a Block Device Driver to handle the flash media
devices in Linux 2.6.x kernel. It is working fine. We are able to mount
the SD cards that are formatted on Windows systems, but we unable mount
the cards that are formatted using the DIGITAL CAMERA.

We have found one thing that the Windows and Digital Camera both are
formatting the SD cards in FAT12 only. But why we are not able to mount
the SD cards on Linux Box that are formatted using the Digital Camera.

Could any one explain the problem? It is great help to us.
Thanks in advance and we are looking forward a POSITIVE reply.

Thanks and Regards,
Srinivas G
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

linux-os (Dick Johnson)

unread,
Jul 29, 2005, 8:04:01 AM7/29/05
to Srinivas G., linux-kernel-Mailing-list

On Fri, 29 Jul 2005, Srinivas G. wrote:

> Dear All,
>
> We have developed a Block Device Driver to handle the flash media
> devices in Linux 2.6.x kernel. It is working fine. We are able to mount
> the SD cards that are formatted on Windows systems, but we unable mount
> the cards that are formatted using the DIGITAL CAMERA.
>
> We have found one thing that the Windows and Digital Camera both are
> formatting the SD cards in FAT12 only. But why we are not able to mount
> the SD cards on Linux Box that are formatted using the Digital Camera.
>
> Could any one explain the problem? It is great help to us.
> Thanks in advance and we are looking forward a POSITIVE reply.
>
> Thanks and Regards,
> Srinivas G

Execute linux `fdisk` on the device. You may find that the
ID byte is wrong.

Also, why do you need a special block device driver? The SanDisk
and CompacFlash devices should look like IDE drives.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.12 on an i686 machine (5537.79 BogoMips).
Warning : 98.36% of all statistics are fiction.
.
I apologize for the following. I tried to kill it with the above dot :

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to Deliver...@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

Norbert van Nobelen

unread,
Jul 29, 2005, 9:15:02 AM7/29/05
to Srinivas G., linux-...@vger.kernel.org
What camera is this?

Lennart Sorensen

unread,
Jul 29, 2005, 9:44:02 AM7/29/05
to linux-os (Dick Johnson), Srinivas G., linux-kernel-Mailing-list
On Fri, Jul 29, 2005 at 08:02:14AM -0400, linux-os (Dick Johnson) wrote:
> Execute linux `fdisk` on the device. You may find that the
> ID byte is wrong.
>
> Also, why do you need a special block device driver? The SanDisk
> and CompacFlash devices should look like IDE drives.

SD usually is secure digital (MMC compatible somewhat I believe). It
does not provide IDE unlike CompactFlash. SD uses a serial interface if
I remember correctly.

Len Sorensen

Lennart Sorensen

unread,
Jul 29, 2005, 1:44:32 PM7/29/05
to Mukund JB., linux-os (Dick Johnson), Srinivas G., linux-kernel-Mailing-list
On Fri, Jul 29, 2005 at 11:05:50PM +0530, Mukund JB. wrote:
> camera formatted info
> ----------------------
> Disk /dev/tfa0: 448 cylinders, 2 heads, 32 sectors/track
> Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0
>
> Device Boot Start End #cyls #blocks Id System
> /dev/tfa0p1 * 0+ 449 450- 14371+ 1 FAT12
> /dev/tfa0p2 0 - 0 0 0 Empty
> /dev/tfa0p3 0 - 0 0 0 Empty
> /dev/tfa0p4 0 - 0 0 0 Empty
> Warning: partition 1 extends past end of disk

Why excactly does the partition table say 450 cylinders when the kernel
believes it to be 448 cylinders? Someone is wrong. Either the device
was partitioned wrong and hence formated wrong, or whatever driver the
kernel is using to read it is broken and returns the wrong size for the
device.

I have never heard of /dev/tfa0p* either. What is that?

> Windows formatted info
> ----------------------
> Disk /dev/tfa0: 448 cylinders, 2 heads, 32 sectors/track
> Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0
>
> Device Boot Start End #cyls #blocks Id System
> /dev/tfa0p1 * 0+ 449 450- 14371+ 1 FAT12
> /dev/tfa0p2 0 - 0 0 0 Empty
> /dev/tfa0p3 0 - 0 0 0 Empty
> /dev/tfa0p4 0 - 0 0 0 Empty
> Warning: partition 1 extends past end of disk

Identical. Sure makes it look like a driver error on the linux side in
that case.

linux-os (Dick Johnson)

unread,
Jul 29, 2005, 2:07:02 PM7/29/05
to Mukund JB., Lennart Sorensen, Srinivas G., linux-kernel-Mailing-list

camera formatted info
----------------------
Disk /dev/tfa0: 448 cylinders, 2 heads, 32 sectors/track
Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/tfa0p1 * 0+ 449 450- 14371+ 1 FAT12
/dev/tfa0p2 0 - 0 0 0 Empty
/dev/tfa0p3 0 - 0 0 0 Empty
/dev/tfa0p4 0 - 0 0 0 Empty
Warning: partition 1 extends past end of disk

If it's 488 cylinders, then it should start at 0 and end at 447,
not 449.

It looks like some kind of driver error to begin with. The
fact that it sometimes works should be overlooked until the
driver returns the correct number of cylinders (the same
number that the formatting utility gets). Check to see if
your driver could return a different disk size under different
conditions.

On Fri, 29 Jul 2005, Mukund JB. wrote:

>
> Dear Lennart, Dick Johnson, Erik Mouw & All,
>
> Thanks for all ur precious support.
>
> The cannon camera (other devices too) formatted SD is indeed a partition
> FAT12. When I said
> sfdisk -l, it showed the fs ID as 1. 1 is indeed the FAT12 fs ID.
>
> Attached are the logs for win and camera device sfdisk -Vl /dev/tfa0.
>
> The SD card formatted in camera is partitioned FAT12 disk.
> Also, the SD card formatted in windows is partitioned FAT12 disk.
> (see the attachment)
>
> on ur suggestion I verified whether camera partition device has a valid
> FS ID. I verified. It is FAT12. It is the same for windows
> formatted device. The FS ID of both the formats is 1. i.e. FAT12.
>
> I has notion that my driver is not supporting partition devices. This
> makes this clean that my driver is supporting the partition devices
> (windows formatted SD). If both are partitioned where is the difference?
>
>
> So, can someone please help me telling what else could be missing that
> is creating this problem?
>
> Regards,
> Mukund Jampala


>
>
>> -----Original Message-----
>> From: linux-ker...@vger.kernel.org [mailto:linux-kernel-
>> ow...@vger.kernel.org] On Behalf Of Lennart Sorensen
>> Sent: Friday, July 29, 2005 7:08 PM
>> To: linux-os (Dick Johnson)
>> Cc: Srinivas G.; linux-kernel-Mailing-list
>> Subject: Re: Unable to mount the SD card formatted using the DIGITAL
> CAMREA
>> on Linux box
>>
>> On Fri, Jul 29, 2005 at 08:02:14AM -0400, linux-os (Dick Johnson)
> wrote:
>>> Execute linux `fdisk` on the device. You may find that the
>>> ID byte is wrong.
>>>
>>> Also, why do you need a special block device driver? The SanDisk
>>> and CompacFlash devices should look like IDE drives.
>>
>> SD usually is secure digital (MMC compatible somewhat I believe). It
>> does not provide IDE unlike CompactFlash. SD uses a serial interface
> if
>> I remember correctly.
>>

>> Len Sorensen
>> -
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel"
> in
>> the body of a message to majo...@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
>

Cheers,


Dick Johnson
Penguin : Linux version 2.6.12 on an i686 machine (5537.79 BogoMips).
Warning : 98.36% of all statistics are fiction.
.
I apologize for the following. I tried to kill it with the above dot :

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to Deliver...@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

linux-os (Dick Johnson)

unread,
Jul 29, 2005, 2:12:56 PM7/29/05
to Mukund JB., Lennart Sorensen, Srinivas G., linux-kernel-Mailing-list

On Fri, 29 Jul 2005, linux-os (Dick Johnson) wrote:

>
>
> camera formatted info
> ----------------------
> Disk /dev/tfa0: 448 cylinders, 2 heads, 32 sectors/track
> Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0
>
> Device Boot Start End #cyls #blocks Id System
> /dev/tfa0p1 * 0+ 449 450- 14371+ 1 FAT12
> /dev/tfa0p2 0 - 0 0 0 Empty
> /dev/tfa0p3 0 - 0 0 0 Empty
> /dev/tfa0p4 0 - 0 0 0 Empty
> Warning: partition 1 extends past end of disk
>
> If it's 488 cylinders, then it should start at 0 and end at 447,
> not 449.
>

Sorry typo, 487, not 447.

linux-os (Dick Johnson)

unread,
Aug 1, 2005, 8:12:53 AM8/1/05
to Mukund JB., Lennart Sorensen, Srinivas G., linux-kernel-Mailing-list

So where is the driver? There is obviously something wrong there,
yet you send copies of mount source. Mount works, it's your driver
that doesn't. You need to fix your driver. There are some very
common errors. For instance sectors start at 1, not 0, while
cylinders and heads start at 0. You need to look at your source-
code, first for the most common errors, then for others.

As a debugging aid, you can make a file-system on a file. Then
you can write the whole thing to the hardware using `cp` or `dd`.
If the resulting file-system mounts and works properly, it
may help find the problem.

On Mon, 1 Aug 2005, Mukund JB. wrote:

> Dear all,
>
> Below are my driver messages logged at initialization time & sfdisk call
> time.
>
> when module is initialized................
>
> TIFM INFO | TI init Routine Invoked!
> ReportMediaModel: ( SD card Details)
> Size = 14 [MB]
> mwCylinders = 450
> mwHeadCount = 2
> mwSectorsPerTrack = 32
>
> When the ioctl is invoked through the "sfdisk -lV /dev/tfa0"
>
> TIFM INFO | <tifm_ioctl> invoked!
> TIFM INFO | dev no. [ 0 ] sock no. [ 0 ]
> TIFM INFO | <GetGeometry_ioctl> geo.cylinders = 450
> TIFM INFO | <GetGeometry_ioctl> geo.heads = 2
> TIFM INFO | <GetGeometry_ioctl> geo.sectors = 32
> TIFM INFO | <GetGeometry_ioctl> geo.start = 0
>
> This means that I am giving the proper details to the user program but
> the sfdisk is printing it wrong (probably manipulation).
>
> And when I try to mount ......
>
> mount /dev/tfa0 /mnt
> FAT: bogus number of reserved sectors
> Mount: you must specify the filesystem type
>
> mount -tvfat /dev/tfa0 /mnt
> FAT: bogus number of reserved sectors
> Mount: wrong fs type, bad option, bas superblock on /dev/tfa0,
> or too many mounted file systems
>
> I have gone through the mount.c code in order to understand where I am
> exactly failing.
> mount is failing in guess_fstype_and_mount() in do_mount_syscall after
> issuing the mount sys call.
> I am attaching the source code of mount functionality which may be on
> some help to u in u8ndertaing why exactly its failing.

Lennart Sorensen

unread,
Aug 2, 2005, 9:43:32 AM8/2/05
to Mukund JB., linux-os (Dick Johnson), Srinivas G., linux-kernel-Mailing-list
On Mon, Aug 01, 2005 at 05:01:00PM +0530, Mukund JB. wrote:
> Dear all,
>
> Below are my driver messages logged at initialization time & sfdisk call
> time.
>
> when module is initialized................
>
> TIFM INFO | TI init Routine Invoked!
> ReportMediaModel: ( SD card Details)
> Size = 14 [MB]
> mwCylinders = 450
> mwHeadCount = 2
> mwSectorsPerTrack = 32

Well the 450 cylinders there is right, so why is the driver passing info
down to user space saying the device has 448 cylinders? Somehow you are
loosing 2 cylinders in your driver somewhere.

> When the ioctl is invoked through the "sfdisk -lV /dev/tfa0"
>
> TIFM INFO | <tifm_ioctl> invoked!
> TIFM INFO | dev no. [ 0 ] sock no. [ 0 ]
> TIFM INFO | <GetGeometry_ioctl> geo.cylinders = 450
> TIFM INFO | <GetGeometry_ioctl> geo.heads = 2
> TIFM INFO | <GetGeometry_ioctl> geo.sectors = 32
> TIFM INFO | <GetGeometry_ioctl> geo.start = 0
>
> This means that I am giving the proper details to the user program but
> the sfdisk is printing it wrong (probably manipulation).
>
> And when I try to mount ......
>
> mount /dev/tfa0 /mnt
> FAT: bogus number of reserved sectors
> Mount: you must specify the filesystem type

Well if the partition table/fs size is larger than the device currently
claims to be, the FS will fail and mount will fail. Nothing wrong in
mount, just broken device driver.

> mount -tvfat /dev/tfa0 /mnt
> FAT: bogus number of reserved sectors
> Mount: wrong fs type, bad option, bas superblock on /dev/tfa0,
> or too many mounted file systems
>
> I have gone through the mount.c code in order to understand where I am
> exactly failing.
> mount is failing in guess_fstype_and_mount() in do_mount_syscall after
> issuing the mount sys call.
> I am attaching the source code of mount functionality which may be on
> some help to u in u8ndertaing why exactly its failing.

Perhaps adding more debuging to your driver wherever user space calls in
to get the size of the device, to make sure you have the right
information passed along. Heads and sectors looks fine, but the
cylinder count needs fixing since it is currently reporting 2 less than
it really is. This has to be 100% a problem in the device driver.

0 new messages