Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore boot signature #102

Open
dbalsom opened this issue Nov 19, 2024 · 6 comments
Open

Ignore boot signature #102

dbalsom opened this issue Nov 19, 2024 · 6 comments

Comments

@dbalsom
Copy link

dbalsom commented Nov 19, 2024

    pub(crate) fn validate<E: IoError>(&self) -> Result<(), Error<E>> {
        if self.boot_sig != [0x55, 0xAA] {
            error!(
                "Invalid boot sector signature: expected [0x55, 0xAA] but got {:?}",
                self.boot_sig
            );
            return Err(Error::CorruptedFileSystem);

The absence of a boot signature does not mean there is not a valid filesystem on the disk.

@rafalh
Copy link
Owner

rafalh commented Nov 20, 2024

Official spec says this:

There is one other important note about Sector 0 of a FAT volume. If we consider the contents of the
sector as a byte array, it must be true that sector[510] equals 0x55, and sector[511] equals 0xAA.

Even if partition is not bootable it usually have a bootsector that prints an error. Have you found a non-conforming disk?

@dbalsom
Copy link
Author

dbalsom commented Nov 20, 2024

Yes there are many. Early PC/XT BIOS did not check, and subsequently many early (1980's) PC titles do not have the signature.

See: https://www.pagetable.com/?p=165

@rafalh
Copy link
Owner

rafalh commented Nov 20, 2024

As far as I know DOS 1.0 don't even have BPB in boot sector. I wasn't planning on supporting such old FAT implementations because it would add a lot of complexity...

@dbalsom
Copy link
Author

dbalsom commented Nov 20, 2024

DOS 1.0 specifically yes, but there are disks with BPB and no boot signature.

@dbalsom
Copy link
Author

dbalsom commented Nov 20, 2024

image

here is one example.

@dbalsom
Copy link
Author

dbalsom commented Nov 20, 2024

I can confirm that it rust-fatfs reads this fine if we disable the check, so I don't think its any extra work. I can understand if you don't want to deal with it if there is something nonstandard in the FAT itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants