开发者

OS bootstraping process

I try to understand os bootstraping process. Some questions are not clear to me. One of them is :开发者_JS百科 How does bootstrap code in Volume boot record know about absolute LBA address of 0 sector of patition where Volume boot record resides?


Within the VBR is a structure called a BIOS Parameter Block, named after the BIOS, the bottom-half of the traditional MS-DOS kernel structure. Within the BIOS Parameter Block is a field denoting the number of hidden sectors between the partition and the (MBR-style) partition table entry that encloses it. The VBR code simply reads that field out of itself and adds it to the Volume-relative Block Address to produce the LBA to read from the disc.

This is why it is impossible to boot operating systems such as Windows NT, MS/PC/DR-DOS, and OS/2 from secondary partitions directly, without assistance. In primary partitions, the BPB field is simply the start LBA of the start of the volume, because the partition table that it is relative to is the primary MBR in block #0 of the disc, and everything works. In secondary partitions, because of a quirk of MS-DOS version 3 that everyone has had to remain compatible with ever since, the BPB field is only the offset of the "logical drive" within the "extended partition" containing it, and the boot code doesn't work because it looks for the rest of the boot volume in completely the wrong place on the disc.

Boot managers provide assistance by fixing up the BPB on the fly. The VBR code of course reads the in-memory copy of itself, not the on-disc copy. So boot managers simply adjust the field of the BPB for secondary partitions to the correct absolute value, as they are loading the VBR into memory. Then everything works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜