Search code examples
assemblyusbnasmboot

How to create bootable usb drive , with bootsector written in nasm?


i have the following simple code :

    mov ah ,  0x0e    
    mov al , `h`    
    int 0x10    
    mov al , `1`    
    int 0x10    
    jmp $
    
    
    
    times 510-($-$$) db 0 
    dw 0xaa55

I then compile it and run it normally in qemu:

    nasm -fbin boot_sect.asm -o boot_sect.iso 
    qemu-system-x86_64 -drive format=raw,file=boot_sect.iso

After padding zeros until 14 MB i create a bootable usb. My issue is that this usb does not boot on my laptop. Is the problem related to my laptop or is it because of the usb?


Solution

  • The issue wasn't actually the code as i thought inititialy . I only had to change to the csm mode from bios settings and then boot from usb .