This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: IDE + fatfs issues


> From: David Brennan
>
> On or about line 1885 of fatfs_supp.c within function fatfs_init()
> after reading the boot record, a number of fields are validated:
>     // Check some known boot record values
>     if (0x29 != boot_rec.ext_sig       ||
>         0x55 != boot_rec.exe_marker[0] ||
>         0xAA != boot_rec.exe_marker[1])
>         return EINVAL;
>
> I believe the first test is not always valid. On my Compact Flash
> card, formatted with FreeDOS v0.9 beta, this field is 0x00. According
> to Microsoft's documentation for fatfs, Windows NT requires this to be
> either 0x28 or 0x29. I found other documentation that states that if
> it is 0x29, then the next 3 fields are valid, but 0x00 was also valid.
> As a temporary fix, I just hacked out the first check. I can submit a
> "true" patch for this if requested. But I thought I would look for
> some opinions first.

You're certainly right about this. I've seen plenty of disks, mostly old
floppies, that don't have 29 and the other fields present. In my own code,
I've always checked for the 55AA at the end, and then ensured the number of
FATs is in 1-4, ensured the sector size is some small nonzero integral
multiple of 512, ensured the number of sectors per cluster is in 1-64, and
ensured the number of sectors per FAT is nonzero. I also used to check for a
short or near jump op-code in byte 0 (E9 or EB), but I suspect dummy x86
boot code isn't really required, so it might make sense to leave this test
out nowadays.

--

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]