Ok ive been working with bootstrappers and writing them in assembly for a little bit now and I can get it to work and understand how the bootsector works when it comes to hard disks and floppy disks but when dealing with flash memory like my USB flash drive im not sure what it takes or what tools i should use in order to be able to write a bootstrapper to them. I know its possible because I have booted linux from a flash drive before. I am just curious as to how they work when it comes to boot sectors and all that for writing an OS.

8 Years
Discussion Span
Last Post by NotNull

Download the GNU Fileutils

Assemble your bootloader as a binary image.

Use dd to write your bootloader to the boot sector
of a floppy.
dd if=Boot.bin bs=512 of=a:
["of=a:" Don't know if this is the right syntax under DOS for
DD, but the above link comes with documentation,
all else fails find another program for writing your boot loader
to a floppy, unless you alread have one...]

Then use mkbt to copy the bootsector of the floppy disk
to a flash drive:

mkbt -c a: Boot.bin
-C is copy bootsector mode
a: is the floppy drive

mkbt -x Boot.bin k:
k: ( or whatever) is your USB drive

For bootloader code over 512 bytes, make sure the first 512 bytes
will be able to load the rest of the boatloader (lest this limit does
not apply to flash drives) , check out second stage bootloaders,
where a second bootloader is used for large bootloaders.

Search on google for more info on writing out a boot loader
larger than 512 bytes to a floppy disk using DD,
if this applies in your case.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.