A simple FAT32 bootloader written in assembly to boot from USB drives.

This is an assignment done by me for a second year project  in the university. The goal was to write a bootloader that can boot the given OS ( JOSH ) from a pen drive which is having FAT32 file system( We were supplied with a bootloader that could boot only from a FAT12 file system ). 


What this bootloader can do:


It can load the first file( which should be a file less than 4096 bytes) which is located in a USB drive with a FAT32 file system to the memory and hand over the execution to that program.


Download location:




Steps to use the Bootloader:


Included in the README file in gitHub. 



More information can be found in the pdf in the doc folder. 

Share Button

15 thoughts on “A simple FAT32 bootloader written in assembly to boot from USB drives.

  1. Nice clean code. Some comments:
    * Need to use the “-I” switch with mkdosfs, and target e.g. /dev/sdb (not /dev/sdb1), to avoid creating partitions on the USB disk
    * Code does not enable A20 line, may not work on older BIOS
    * Before calling BIOS int functions, some bootloaders use ‘stc’ to make sure errors are detected
    * You are using 0:0xffff as stack – this is unaligned. Better to use a 4-byte aligned SP value
    * It would be nice to enable Protected Mode before jumping to the next stage

  2. I have tried some of your code.

    I am working on windows but when I look at your PDF document that your provided on github.

    It has common command at line 4 and 5. Why is like that ?

  3. I’ve been getting my feet wet with assembly and bootloaders for a few days now, and this blog entry is the 2nd listing when I Google ‘assembly usb bootloader’ (the first is Wikipedia’s article on x86 assembly/bootloaders).

    This is definitely an awesome example and is exactly the sort of base I’ve been looking for to hash out my own ideas, thanks!

  4. hi professional programmer, i like for the project that is very good,but i have one problem how can copy the code bootloader and code kernel me into the flash memory,i am try and used the virtualbox give me error,and told me not botabled see that image ,please help me i waiting .

Leave a Reply

Your email address will not be published. Required fields are marked *