I would like to learn how to write a bootloader for USB sticks and how it works. Preferably in a deeper way (e.g. machine code).
I have a few questions:
- Is there a good tutorial about this?
- Is this bootloader rewriteable?
Thanks in advance,
Z0q

Any tutorial that covers writing a bootloader for a floppy disk or hard disk using BIOS int 0x13 is equally applicable to USB flash drives. The BIOS will choose to emulate your flash drive as either a floppy disk or hard disk based on its contents. Floppy disk emulation may not allow you to access the entire flash drive, so you should use hard disk emulation. In order to use hard disk emulation, your flash drive must have a valid partition table with one bootable partition.z0q wrote:- Is there a good tutorial about this?
Is your USB flash drive rewritable?z0q wrote:- Is this bootloader rewriteable?
This is because you overwrote the FAT12 BPB. That data is necessary for operating systems to read and write files from a FAT12-formatted floppy disk. Reformatting the floppy disk will restore its original functionality, but erase your bootloader.z0q wrote:I remember that I could throw away floppies after writing to their boot sectors with a work in progress bootloader.
The Wiki has a page on Beginner Mistakes, and the second item reads:Is there a good tutorial about this?
You might want to read the rest of the wiki as well considering you have missed the basics.Is there a tutorial on..?
Because this place can not and does not cater for beginner developers, the question for some other place that does provide a tutorial, good explanations or easy to understand reading is often requested. However, they do not exist. Difficult subjects can not be described with light prose, just like there are enough things that are too complicated for a monkey to properly learn. If you have trouble reading official documentation, this would be a good time to practice.
"USB Booting Secret # 3" is wrong, BIOSes in floppy disk emulation mode will typically not provide LBA access. This is why hard disk emulation is the preferred mode for USB booting.M2004 wrote:Mike Gonta has written some stuff about usb booting:
You can write boot sector to the first sector of USB drive (without partitioning) with special disk image utilities such as "dd" in Linux. dd on Windows is also available (using some tools).z0q wrote:Thank you for your replies
Yes, it is rewriteable, but I have to write in the special Boot sector right? I remember that I could throw away floppies after writing to their boot sectors with a work in progress bootloader.
How can I write to the boot sector of the USB stick?