crozone / ipodloader2

Bootloader for classic iPods. Supports Rockbox, iPod Linux, and stock iPod OS.
44 stars 1 forks source link

Bootloader fails to load files that are addressed deep into a FAT32 partition #1

Closed crozone closed 4 years ago

crozone commented 4 years ago

The bootloader currently exhibits an issue where files located at very high FAT32 cluster addresses will be read as corrupt files. This issue is not easily spotted because it only manifests itself when files important to the bootloader (ipodloader.conf and kernels) are moved to a very high cluster index. Fresh drives without any music or other data on them will not exhibit these issues.

A very notable and frustrating failure case is the boot menu becoming corrupt. This is caused when ipodloader.conf is modified when the drive has many GB of data already on it. If the file is increased in size enough to cause a relocation, it may be relocated to the end of the drive. It will be read as corrupt data by the bootloader.

Previously it was suspected that the iPod hardware was itself corrupting the filesystem on these large drives, but examining the FAT32 filesystem structure with disk utilities and verifying the structure manually with hex tools shows that the filesystem itself is actually intact. Furthermore the Apple OS and Linux FAT32 drivers appear to be able to read all files on the drives just fine, as can a host Windows machine when the iPod is mounted.

It is therefore highly likely that fat32.c is the culprit, especially given it already has other known issues.

crozone commented 4 years ago

The issue is obvious... ata2.c does not support LBA48 addressing. Implementing LBA48 addressing will fix the issue.

crozone commented 4 years ago

Fixed in 42b272129d777e9d7c82a69a2e90454ebb42547c