OSDev.org
https://forum.osdev.org/

Boot sector on a hard drive
https://forum.osdev.org/viewtopic.php?f=15&t=36796
Page 1 of 1

Author:  nexos [ Fri May 22, 2020 10:37 am ]
Post subject:  Boot sector on a hard drive

Hello,
I was wondering how you go about implementing a hard drive bootsector with FAT32. How would you put the BIOS parameter block on disk? How do you format it?
Thank you for your help

Author:  PeterX [ Fri May 22, 2020 10:53 am ]
Post subject:  Re: Boot sector on a hard drive

nexos wrote:
Hello,
I was wondering how you go about implementing a hard drive bootsector with FAT32. How would you put the BIOS parameter block on disk? How do you format it?
Thank you for your help

Why not let your favorite tool (like parted etc.) format the partition. And when you write code to the partition's bootsector, skip the BPB.

Something like this:
Code:
dd if=bb.bin of=/dev/sda1 bs=1 count=3
dd if=bb.bin of=/dev/sda1 bs=1 seek=96 skip=96

Note that I don't guarantee that 96 is correct, because there are several versions of BPB around (with different size).

Greetings
Peter

Author:  nexos [ Fri May 22, 2020 11:45 am ]
Post subject:  Re: Boot sector on a hard drive

Ok Thank you! That makes perfect sense.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/