Page 3 of 3
Re: Can't rune the simplest of bootloader on a real PC
Posted: Sun Mar 01, 2020 6:56 am
by Octocontrabass
Schol-R-LEA wrote:With USB drives, as others have already said, there are to ways to handle the disk: it can either emulate a floppy, or it can emulate a hard disk. I don't know off-hand how this is handled, but I will say that a) emulating a floppy limits the total usable size of the drive, and b) IIUC, most newer Legacy BIOS and UEFI BIOS have dropped support for floppy emulation.
The earliest USB-boot-capable PCs provided a BIOS setting to choose the emulation mode. Most legacy BIOSes and some UEFI CSMs automatically detect the mode based on the contents of the drive. Some UEFI CSMs only support hard disk emulation. UEFI without a CSM can't use legacy boot code at all, but your flash drive will need to be partitioned if you want to put a UEFI bootloader on it.
I haven't seen any PCs that limit the usable size of the flash drive when booting in floppy disk emulation mode, but I'm not sure if this is true of every PC.
Re: Can't rune the simplest of bootloader on a real PC
Posted: Sun Mar 01, 2020 10:44 am
by Schol-R-LEA
Octocontrabass wrote:Schol-R-LEA wrote:With USB drives, as others have already said, there are to ways to handle the disk: it can either emulate a floppy, or it can emulate a hard disk. I don't know off-hand how this is handled, but I will say that a) emulating a floppy limits the total usable size of the drive, and b) IIUC, most newer Legacy BIOS and UEFI BIOS have dropped support for floppy emulation.
The earliest USB-boot-capable PCs provided a BIOS setting to choose the emulation mode. Most legacy BIOSes and some UEFI CSMs automatically detect the mode based on the contents of the drive. Some UEFI CSMs only support hard disk emulation. UEFI without a CSM can't use legacy boot code at all, but your flash drive will need to be partitioned if you want to put a UEFI bootloader on it.
I haven't seen any PCs that limit the usable size of the flash drive when booting in floppy disk emulation mode, but I'm not sure if this is true of every PC.
I seem to recall it being a problem on some systems, and I assumed it was a general limitation rather than a flaw or quirk in a specific implementation. I remember that there was a period where a flash drive of what were at time larger sizes had to be partitioned, because the USB support couldn't handle a drive over 512MiB. I am not certain why this was the case, or even if it really was the case at all or if it was only certain systems which had this problem.
Note that this was more than a decade after they had solved similar size issues for spinning rust.
It is also possible I am mixing things up, however - I seem to recall being told long ago that USB floppy emulation only worked with very small drives (16MiB or less) because it required them to be formatted as FAT12, but even then that explanation didn't make sense to me since such tiny drives were only around for the first year or so in which flash drives were on the market (and even then, most of those first generation jump drives were at least 64MiB). I had dismissed that claim at the time, but I think it may have been lurking in my hindbrain and I'd somehow glommed on to it when writing that.
Anyway, thanks for the correction.
Re: Can't rune the simplest of bootloader on a real PC
Posted: Sun Mar 01, 2020 4:37 pm
by bzt
Hi,
I think both of you is right. Probably the best is to forget about floppies alltogether, specially if Octocontrabass is right about the lack of emulation (and I believe he is).
In the MS-DOS era when real floppies were a common thing and my biggest hard drive was 20Megabytes in capacity an you had to park it, I do remember that I could put a VBR on the disk, and an MBR on the diskette, and both worked, the BIOS didn't care (I had machines with PhoenixBIOS, AMIBIOS, and CompaqBIOS which was a rebranded something). But that was a looooong time ago, and it was the real stuff, not some emulated legacy CSM mode. I also do remember that years later when I had my first AT with a 80M hard drive and I've put LILO on it without MBR partitions nor BPB it worked (then I quickly reinstalled the whole thing because I realized it's better if I have separate /usr, /var, etc. partitions).
TBH, I've never used floppy emulation mode with USB, and I've never put a VBR with BPB in the first sector of an USB drive ever. I've always used an MBR (lately PMBR) and I have never experienced any problems with booting using that setup. So my advice is, always create an MBR with a single partition that covers the whole disk (or PMBR which has an EFI GPT partition record), and you can safely forget about BPB. If you want to use FAT, put it on the first partition, and not on the entire disk, and you don't have to worry about buggy BIOSes manipulating the BPB area in the first sector.
Cheers,
bzt