From: Ahmad Fatoum <a.fatoum@pengutronix.de> To: barebox@lists.infradead.org Cc: Peter Rosin <peda@axentia.se>, Ahmad Fatoum <a.fatoum@pengutronix.de> Subject: [PATCH master 1/5] fs: fat: pbl: support >32M alignment for first partition Date: Wed, 22 Sep 2021 08:49:57 +0200 [thread overview] Message-ID: <20210922065000.20970-2-a.fatoum@pengutronix.de> (raw) In-Reply-To: <20210922065000.20970-1-a.fatoum@pengutronix.de> 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@pengutronix.de> --- 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(§or[MBR_Table + MBR_StartSector]); + *bootsec = get_unaligned_le32(§or[MBR_Table + MBR_StartSector]); return filetype_mbr; } -- 2.30.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-09-22 6:59 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-09-22 6:49 [PATCH 0/5] ARM: at91: sama5d3_xplained: migrate to DT Ahmad Fatoum 2021-09-22 6:49 ` Ahmad Fatoum [this message] 2021-09-22 6:49 ` [PATCH master 2/5] ARM: at91: at91sam9263ek: add device tree check for board code Ahmad Fatoum 2021-09-22 6:49 ` [PATCH 3/5] Documentation: boards: at91: remove done TODOs Ahmad Fatoum 2021-09-22 15:29 ` Sam Ravnborg 2021-09-22 6:50 ` [PATCH 4/5] ARM: at91: sam9_smc: register driver earlier Ahmad Fatoum 2021-09-22 6:50 ` [PATCH 5/5] ARM: AT91: migrate sama5d3-xplained to DT Ahmad Fatoum 2021-10-01 13:36 ` [PATCH 0/5] ARM: at91: sama5d3_xplained: migrate " Sascha Hauer
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210922065000.20970-2-a.fatoum@pengutronix.de \ --to=a.fatoum@pengutronix.de \ --cc=barebox@lists.infradead.org \ --cc=peda@axentia.se \ --subject='Re: [PATCH master 1/5] fs: fat: pbl: support >32M alignment for first partition' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox