[PATCH master 1/5] fs: fat: pbl: support >32M alignment for first partition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The LBA of the first absolute sector in a partition is a 32-bit
field at offset 0x8 of a partition entry. The first such partition
entry is at offset 446 of the MBR.

The DOS partition parser adheres to this scheme, but the FAT code
contains a very basic partition parser as well that kicks in when
a disk couldn't be mounted as FAT: It will seek to the first FAT
partition in a MBR and mount that. This only happens with FAT PBL,
because in barebox proper, we use the actual partition parser.

The partition parser in FAT assumed starting LBA to be a 16-bit
value and thus failed to load a first FAT partition located more
than 0x10000 sectors into the image. Fix this.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 common/filetype.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/filetype.c b/common/filetype.c
index 9edebb2cd831..8ffcd6adcd09 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -218,7 +218,7 @@ enum filetype is_fat_or_mbr(const unsigned char *sector, unsigned long *bootsec)
 		 * first partition so we could check if there is a FAT boot
 		 * sector there
 		 */
-		*bootsec = get_unaligned_le16(&sector[MBR_Table + MBR_StartSector]);
+		*bootsec = get_unaligned_le32(&sector[MBR_Table + MBR_StartSector]);
 
 	return filetype_mbr;
 }
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux