Several of Microsoft's filesystems reserve space in the boot sector to store the LBA of the first sector in the partition. Formatting tools usually populate that field with the correct value automatically. If you're not using one of those filesystems, you can still do something similar, but you'll have to figure out some way to write the correct LBA.
PeterX wrote:
eekee wrote:
Just for completeness, I'm mentioning a problem I never had: Lilo's documentation hinted that it could have trouble determining the BIOS's view of the disks because it ran within Linux. I'm sure it won't be a problem if you're making a disk image. I never had the problem in years of running it on a wide variety of machines.
When you use the LBA disk read interrupt, you don't have that problem, even on a real hardware disk.
I think the LILO documentation is actually talking about the drive number you have to put into DL to use INT 0x13 to read the disk. On ancient hardware without BIOS PnP support, the BIOS might pass garbage in DL instead of the correct drive number.
PeterX wrote:
If you use CHS, you need to determine the disk geometry (sectors per track, number of heads) on your host OS.
That really only works for floppy disks, since the geometry of a floppy disk is a physical property of the disk. For other media, the BIOS might perform translation, so you need to use INT 0x13 AH=0x08 to figure out what geometry the BIOS wants you to use. You can't use values presented by your host OS since host might not know what translation the BIOS will use, and even if it does the translation will be different on different computers. For USB flash drives, the translation might change even on the same computer, since some BIOSes will choose different translations depending on the content of the drive!