Reputation: 23053
Recently I have written a bootloader in x86 Assembly. The bootloader does not do anything special right now, but I am planning to load my own kernel with this bootloader. I am able to write the bootloader to my FAT32 formatted USB Flash drive and it will be loaded by the BIOS correctly.
How can I make the USB Flash drive bootable by both BIOS and UEFI?
Upvotes: 4
Views: 2309
Reputation: 9282
Removable media does not need to be GPT formatted in order for UEFI to boot from it. You need to create efi/boot
folder on a FAT partition on a removable medium and place your UEFI bootloader there. File name must be bootx64.efi
for X86-64 architecture. Booting in Legacy or BIOS mode will be handled without changes - via MBR. In pure UEFI boot mode it will read /efi/boot/bootx64.efi
file.
Please note also, that FAT partition should be addressed by the first MBR partition entry and be active.
Upvotes: 7
Reputation: 644
To do this you will need to restart your computer. Once it first launches you have to press the boot options key. This is generally F2 or Del. From there you can choose which device your computer will boot from.
However, be careful and make sure you are 100% sure you know what you are doing. I would recommend instead you install a VM and use that as the test subject for the OS you are making. This way you do not have to restart your computer as much and there's less risk of damaging it.
Upvotes: -3