From c50e02ec2e0ab324b404781a4c9f07afcde8d18b Mon Sep 17 00:00:00 2001 From: mintsuki Date: Wed, 13 Jul 2022 20:17:34 +0200 Subject: [PATCH] stage1: Improve compatibility of HDD bootsector --- stage1/hdd/bootsect.asm | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/stage1/hdd/bootsect.asm b/stage1/hdd/bootsect.asm index de49c283..6c58e526 100644 --- a/stage1/hdd/bootsect.asm +++ b/stage1/hdd/bootsect.asm @@ -8,8 +8,31 @@ start: ; Some BIOSes will do a funny and decide to overwrite bytes of code in ; the section where a FAT BPB would be, potentially overwriting ; bootsector code. - ; Avoid that by filling the BPB area with 0s - times 87 db 0 + ; Avoid that by filling the BPB area with dummy values. + ; Some of the values have to be set to certain values in order + ; to boot on even quirkier machines. + ; Source: https://github.com/freebsd/freebsd-src/blob/82a21151cf1d7a3e9e95b9edbbf74ac10f386d6a/stand/i386/boot2/boot1.S + .bpb: + times 3-($-$$) db 0 + .bpb_oem_id: db "LIMINE " + .bpb_sector_size: dw 512 + .bpb_sects_per_cluster: db 0 + .bpb_reserved_sects: dw 0 + .bpb_fat_count: db 0 + .bpb_root_dir_entries: dw 0 + .bpb_sector_count: dw 0 + .bpb_media_type: db 0 + .bpb_sects_per_fat: dw 0 + .bpb_sects_per_track: dw 18 + .bpb_heads_count: dw 2 + .bpb_hidden_sects: dd 0 + .bpb_sector_count_big: dd 0 + .bpb_drive_num: db 0 + .bpb_reserved: db 0 + .bpb_signature: db 0 + .bpb_volume_id: dd 0 + .bpb_volume_label: db "LIMINE " + .bpb_filesystem_type: times 8 db 0 .skip_bpb: cli