freebsd-skq/sbin/fsck_msdosfs
ambrisko 37cb22f7f4 Make UEFI booting of 4Kn disks work:
-	convert boot1.efi to corrrectly calculate the lba for what the
	media reports and convert the size based on what FreeBSD uses.
	The existing code would use the 512 byte lba and convert the
	size using 4K byte size.
      -	make fsck_msdosfs read the boot block as 4K so the read doesn't
	fail on a 4Kn drive since FreeBSD will error out parition reads
	of a block.  Make the bpbBytesPerSec check a multiple of 512 since
	it can be 512 or 4K depending on the disk.  This allows fsck to
	pass checking the EFI partition on a 4Kn disk.

To create the EFI file system I used:
	newfs_msdos -F 32 -S 4096 -c 1 -m 0xf8 <partition>
This works for booting 512 and 4Kn disks.

Caveat is that loader.efi cannot read the 4Kn EFI partition.  This isn't
critical right now since boot1.efi will read loader.efi from the ufs
partition.  It looks like loader.efi can be fixed via making some of the
512 bytes reads more flexible.  loader.efi doesn't have trouble reading
the ufs partition.  This is probably a simple fix.

I now have FreeBSD installed on a system with 4Kn drives and tested the
same code works on 512.

MFC after:	1 week
2014-10-30 15:52:01 +00:00
..
boot.c Make UEFI booting of 4Kn disks work: 2014-10-30 15:52:01 +00:00
check.c newfs_msdosfs: Respect FSFIXFAT 2014-07-14 21:32:40 +00:00
dir.c msdosfs: Assorted fixes from other BSDs. 2014-07-14 20:58:02 +00:00
dosfs.h Make UEFI booting of 4Kn disks work: 2014-10-30 15:52:01 +00:00
ext.h newfs_msdosfs: Respect FSFIXFAT 2014-07-14 21:32:40 +00:00
fat.c msdosfs: Assorted fixes from other BSDs. 2014-07-14 20:58:02 +00:00
fsck_msdosfs.8
main.c Make sure that each va_start has one and only one matching va_end, 2012-05-29 01:48:06 +00:00
Makefile Make fsck and fsck_msdosfs WARNS=6 clean 2012-10-21 12:01:19 +00:00