n00b
n00b

Reputation: 5722

Bootloader- how to find correct partition?

im writing a bootloader that looks for stage2 in FAT32. I have almost all the code working but for one thing - finding the correct partition or rather sector offset of my partition

the BIOS is kind enough to provide us with the drive number we were loaded from :

mov [_BOOTDRIVE], dl

however is there any way to get the sector of the partition we were loaded off from or does it have to be hardcoded some way ?

Upvotes: 0

Views: 379

Answers (1)

Ross Ridge
Ross Ridge

Reputation: 39591

When the MBR bootsector loads and executes the partition bootsector, it loads DL with the drive number and DS:SI with a pointer the entry in the partition table for the selected partition. Your bootloader can read that entry to determine the location of it's partition.

Upvotes: 1

Related Questions