How to make a bootable IMG file and put your OS on USB

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
andrewthompson555
Member
Member
Posts: 27
Joined: Thu Oct 13, 2016 2:07 pm

How to make a bootable IMG file and put your OS on USB

Post by andrewthompson555 »

Hey guys, it's andrewthompson555. Want to put a bootloader onto a bootable IMG file but want more files in it? Sick and tired of getting many problems with trying to copy your kernel into your USB? You've come to the right place!

Anyway, whoever wants to make their OS work on the BIOS on a USB. This will make a FAT12 image! WARNING! This might stop Windows from letting you get data from the stick. Do 'format /q <USB DRIVE>' if this happens.

1) Download fat_imgen and Rufus
2) Put a BPB (BIOS Parameter Block) into your bootloader
3) Compile it with NASM
4) Put it in with the exe file of fat imgen
5) Do 'fat_imgen -c -f os.img -s boot.bin
6) Open Rufus
7) Select DD Image and your USB drive
8 ) Select the .img file by pressing that button near the create bootable option
9) Press the start and it will make your USB into FAT12 as well
10) Restart your PC and enable F12 boot manager in the BIOS
11) Search for USB FDD (There might be duplicate so try the bottom and top)
12) Kaboom! It's right there.
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: How to make a bootable IMG file and put your OS on USB

Post by Schol-R-LEA »

If you could expand on this somewhat - and either remove references to specific tools, or better yet, write approaches to handling each step using different toolchains (as about half of the devs here don't use Windows as their development host, even if they do use it as their main general-purpose system, and most of those who do use the binutils toolchain via Cygwin anyway) - this would be a useful addition to the wiki, which (on a cursory check) doesn't seem to cover this subject yet.

Note also that using floppy emulation on a USB has fallen out of favor, as most USB flash drives in the past several years are measured in the gigabytes rather then kilobytes, and even those which it was used for have all been too large to use FAT12 to support the full drive capacity. AFAICT, many USB drives of the past five years don't properly support floppy emulation at all. While FAT12 is useful as practice when starting out, I seriously don't recommend using it for most purposes today.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Post Reply