• Status Closed
  • Percent Complete
  • 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 cockroach - 2020-04-03
Last edited by speachy - 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;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;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  speachy
2020-04-06 22:21
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Applied, see 63bf8e4a


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…

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.

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


Available keyboard shortcuts


Task Details

Task Editing