Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bugs
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System iPod 5G
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Stefan Ott - 2020-04-03
Last edited by Solomon Peachy - 2020-04-06

FS#13194 - Fix FAT sanity check on file systems with 2048 bytes per sector

I recently installed a new, larger SD card in my 5th-gen iPod and, unfortunately, Rockbox did not want to boot with that card. After a bit of digging, I found out that Rockbox was unhappy with my FAT, namely it thought that my file system’s cluster size was too large.

After some more digging I realized that this happens because my file system is using 2048 bytes per sector. In https://git.rockbox.org/?p=rockbox.git;a=blob;f=firmware/drivers/fat.c#l1129 this makes the value bpb_secperclus 4 times as large as it should be (secmult is 4 if we use 2048 bytes per sector). As a consequence, a file system with 2048 bytes per sector and 64 sectors per cluster will have a value of 2048 * 64 * 4 = 512k rather than the maximum of 128k allowed at https://git.rockbox.org/?p=rockbox.git;a=blob;f=firmware/drivers/fat.c#l394 – and Rockbox will fail to start.

I’m not sure whether or not multiplying the value with 4 is a reasonable thing to do, but it seems that the FAT code has been doing that for a long while and is working reasonably well. However, it would seem that in order to support large disks with 2048 bytes per sector, that check should be adjusted.

Attached you will find a patch that divides the value by the same multiplier that is initially used when checking it for sanity. Whether this is the right solution, I cannot say, but it is one that works for me.

Closed by  Solomon Peachy
2020-04-06 22:21
Reason for closing:  Accepted
Additional comments about closing:  

Applied, see 63bf8e4a

Admin
Solomon Peachy commented on 2020-04-05 21:57

Hey, can you get yourself into gerrit and submit patches there?

But as far as this patch is concerned, the functionality is sane as-is, but you need to put in a code comment saying why you’re doing that, and how it’s a workaround, etc etc…

Stefan Ott commented on 2020-04-05 22:01

I wish I could, but unfortunately gerrit won’t let me login with my openid.

I’ll add proper comments to the code and attach a new path.

Stefan Ott commented on 2020-04-06 21:55

Here we go with a new patch, this time it includes a comment.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing