Re: Boot sequence and MBR
Posted: Sat Oct 17, 2020 3:39 pm
It's mostly so it works on floppies too. Floppies don't have MBRs, and so I need to reserve sectors after the boot sector to get the filesystem right. For discs with MBR, the hidden sectors affect the partition table instead which would exclude those.bzt wrote:I got a bit confused about this part.rdos wrote:I prefer to use the hidden sector count in the BPB to place the second stage boot loader directly after the MBR. When I partition a disc for my operating system, I always create a MBR with 16 hidden sectors and then the actual partitions will be after that.
So, the MBR is the first sector of the disk. It does not store hidden sectors count, only a partitioning table. BPB is part of the file system (stored on the first sector of a FAT volume). So if you don't have partitions, just one single FAT file system, then BPB is indeed in the first sector, but then you don't have an MBR. If you have partitions, you also have an MBR, but then BPB is not on the first sector of the disk (rather in the first sector of the partition). So how can hidden sectors (given by BPB) mark the space directly after the MBR?
I only use GPT with EFI, and then the boot loader will be in the EFI system partition as an EFI file (or rather two, since there needs to be both a 32-bit and a 64-bit boot loader).bzt wrote: Just for the records, I prefer to have a simple starting "pointer" (first sector of the 2nd stage) in the 1st stage code, and then I can boot from a GPT partitioned disk too. It doesn't matter then if the 2nd stage is right after the MBR (before the first partition but after the GPT), after the VBR (in hidden sectors) or in a defragmented system file on the boot partition.