From e9b9aac1c5b7169fdd2dcd3393a0ff089c3c849b Mon Sep 17 00:00:00 2001 From: Thomas Gazagnaire Date: Wed, 24 Jun 2026 17:54:43 -0700 Subject: [PATCH] fat: write a non-zero CHS geometry in the boot sector marshal set sectors_per_track and heads to 0. Some int 0x13 and legacy tools reject a zero CHS geometry, so write the conventional 63 sectors/track and 255 heads (consistent with the existing 0xf8 fixed-disk media descriptor). The values are convention; the requirement is that they are non-zero. --- src/fat_boot_sector.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fat_boot_sector.ml b/src/fat_boot_sector.ml index 7d75a22..05ff86b 100644 --- a/src/fat_boot_sector.ml +++ b/src/fat_boot_sector.ml @@ -72,8 +72,8 @@ let marshal (buf: Cstruct.t) t = set_t_total_sectors_small buf 0; (* means use total_sectors_large *) set_t_media_descriptor buf fat_id; set_t_sectors_per_fat buf t.sectors_per_fat; - set_t_sectors_per_track buf 0; (* not used *) - set_t_heads buf 0; (* not used *) + set_t_sectors_per_track buf 63; + set_t_heads buf 255; set_t_hidden_preceeding_sectors buf t.hidden_preceeding_sectors; set_t_total_sectors_large buf t.total_sectors; (* no boot code yet *)