mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] filetype: fix MBR detection
@ 2025-03-24 10:24 Sascha Hauer
  2025-03-24 10:24 ` [PATCH 2/2] filetype: fix FILETYPE_STRING misspelling Sascha Hauer
  2025-03-25  7:16 ` [PATCH 1/2] filetype: fix MBR detection Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-03-24 10:24 UTC (permalink / raw)
  To: Barebox List

is_fat_or_mbr() doesn't detect MBRs anymore because we return
filetype_unknown when it's not a FAT filesystem. Instead we may only
return early when it's explicitly a FAT filesystem, but continue
in the function in case it's not to properly detect a MBR.

Fixes: b25680a9c9 ("filetype: add file_detect_fs_type()")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/filetype.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/filetype.c b/common/filetype.c
index ce868223d5..80e6ceb845 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -243,9 +243,12 @@ enum filetype is_fat_or_mbr(const unsigned char *sector, unsigned long *bootsec)
 	if (bootsec)
 		*bootsec = 0;
 
-	if (file_detect_fs_fat(sector, 512) != filetype_fat)
+	if (get_unaligned_le16(&sector[BS_55AA]) != 0xAA55)
 		return filetype_unknown;
 
+	if (file_detect_fs_fat(sector, 512) == filetype_fat)
+		return filetype_fat;
+
 	if (bootsec)
 		/*
 		 * This must be an MBR, so return the starting sector of the
-- 
2.39.5




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] filetype: fix FILETYPE_STRING misspelling
  2025-03-24 10:24 [PATCH 1/2] filetype: fix MBR detection Sascha Hauer
@ 2025-03-24 10:24 ` Sascha Hauer
  2025-03-25  7:16 ` [PATCH 1/2] filetype: fix MBR detection Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-03-24 10:24 UTC (permalink / raw)
  To: Barebox List

The new Kconfig option checking if filetypes shall be printed as strings
was introduced as CONFIG_FILETYPE_STRING, but the check used
CONFIG_FILETYPE_STRINGS. Rename Kconfig option to match what is actually
checked for.

Fixes: 09702e4a00 ("filetype: make file type strings optional")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index 77d03f298c..ddc76b2033 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1309,7 +1309,7 @@ config PBL_OPTEE
 	  Allows starting OP-TEE during lowlevel initialization of the PBL.
 	  Requires explicit support in the board's lowlevel file.
 
-config FILETYPE_STRING
+config FILETYPE_STRINGS
 	bool "Print file types as strings"
 	default y
 	depends on FILETYPE
-- 
2.39.5




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] filetype: fix MBR detection
  2025-03-24 10:24 [PATCH 1/2] filetype: fix MBR detection Sascha Hauer
  2025-03-24 10:24 ` [PATCH 2/2] filetype: fix FILETYPE_STRING misspelling Sascha Hauer
@ 2025-03-25  7:16 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2025-03-25  7:16 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Mon, 24 Mar 2025 11:24:41 +0100, Sascha Hauer wrote:
> is_fat_or_mbr() doesn't detect MBRs anymore because we return
> filetype_unknown when it's not a FAT filesystem. Instead we may only
> return early when it's explicitly a FAT filesystem, but continue
> in the function in case it's not to properly detect a MBR.
> 
> 

Applied, thanks!

[1/2] filetype: fix MBR detection
      https://git.pengutronix.de/cgit/barebox/commit/?id=34d62c6804eb (link may not be stable)
[2/2] filetype: fix FILETYPE_STRING misspelling
      https://git.pengutronix.de/cgit/barebox/commit/?id=4ea15ea6801c (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-25  7:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-24 10:24 [PATCH 1/2] filetype: fix MBR detection Sascha Hauer
2025-03-24 10:24 ` [PATCH 2/2] filetype: fix FILETYPE_STRING misspelling Sascha Hauer
2025-03-25  7:16 ` [PATCH 1/2] filetype: fix MBR detection Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox