LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   File written, under FreeDOS, on spi flash (formatted as FAT12) is not found in Linux (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/file-written-under-freedos-on-spi-flash-formatted-as-fat12-is-not-found-in-linux-783016/)

Braiam 01-18-2010 12:16 PM

File written, under FreeDOS, on spi flash (formatted as FAT12) is not found in Linux
 
Hi all,

I have a development board which has an spi flash. Under linux, this flash is mounted as MTD block device. I'm using the formatting tool provided by manufacturer, called spitool.exe. If I write file to the flash when I want to read it under FreeDOS it is not found. Otherwise If I write file under FreeDOS it is not found under Linux. The flash is formatted as FAT12 disk. BIOS emulates the spi flash as a floppy disk. The superblock is written by the spitool.exe. Why is it occurring?
I read the flash in raw mode and I realized that the Directory Entry of the file (in root directory) was written at different byte offset when the file was written under FreeDOS in relation to Linux. Root Directory Entries can only be written starting at sector 13 up to sector 27. But under FreeDOS the Root Directory Entries was written starting at sector 41.
Any help will be appreciated.

GrapefruiTgirl 01-18-2010 12:28 PM

What is the mount command you use under Linux, to mount the gadget? The reason I ask is (though I don't know much about the deep down workings of the various FAT formats) I wonder if Linux is detecting it as the correct FAT version, and/or if not, could "wrong FAT version" account for the offset difference you discovered??

From `man mount` there is the option: fat=12

..which might force the correct FAT type (assumibng it's wrong to begin with, but again, I don't know whether the different FATs each use a different offset, leading to what you describe).

Sorry I can't offer anything further; I hope someone else has something to offer!

Sasha

Braiam 01-18-2010 01:47 PM

Quote:

Originally Posted by GrapefruiTgirl (Post 3831116)
What is the mount command you use under Linux, to mount the gadget? The reason I ask is (though I don't know much about the deep down workings of the various FAT formats) I wonder if Linux is detecting it as the correct FAT version, and/or if not, could "wrong FAT version" account for the offset difference you discovered??

From `man mount` there is the option: fat=12

..which might force the correct FAT type (assumibng it's wrong to begin with, but again, I don't know whether the different FATs each use a different offset, leading to what you describe).

Sorry I can't offer anything further; I hope someone else has something to offer!

Sasha

I added some "printk's" in FAT source file and I recompiled the FAT driver. One printk shows the FAT bits (12, 16 or 32). And it showed 12 bits for the FAT recorded on the flash (accordingly to FAT superblock).

Thank you for your response.


All times are GMT -5. The time now is 11:42 AM.