1

I have designed my custom bootloader (which showy my name only.) using assembly language and compiled it using NASM. Now I want to install it in USB.But not able to find any way for burning it. I have tested using different utilities like ISOtoUSB, Universal USB,rufus. Error is coming 'image is not bootable.'

But when I run the same on oracle virtual drive, it works perfectly.

I am doing some college project and strucked, I want to load that bootloader to usb and when I boot from usb, my bootloader should work.

Any idea please?

Here is my code:

[BITS 16]
[ORG 0x7C00]

main:
mov ax, 0x0000
mov ds,ax

mov si, string
call print
jmp $

print:
mov ah,0x0E
mov bh,0x00

.nextchar
lodsb
or al,al
jz .return
int 0x10
jmp .nextchar
.return
ret
string db 'Welcome to the Amul Bhatia Operating System Now Installing....',0
times 510-($-$$) db 0
dw 0AA55h

enter image description here

11
  • Maybe you forgot to include the boot signature, hard to tell if you don't show code. See? You forgot it. Commented Jan 29, 2017 at 13:11
  • @Jester - Just added the code, can you check now.. i Commented Jan 29, 2017 at 13:14
  • Yes, I have, you did not include the required boot signature of 55 AA at the end of your sector. Commented Jan 29, 2017 at 13:15
  • I appreciate it, if you could help ..How to add 55 AA, i followed one tutorial on youtube.. I have no idea of it,, Commented Jan 29, 2017 at 13:20
  • 2
    Did you change 512 to 510? Also, this is a boot sector, it won't show up as a file. Commented Jan 29, 2017 at 13:33

2 Answers 2

1

There's nothing wrong with your bootloader, except this:

times 512-($-$$) db 0

Replace by:

times 510-($-$$) db 0

The way you are doing, your bootloader will be 514 bytes instead of 512. ;-)

This is your bootloader running

Sign up to request clarification or add additional context in comments.

2 Comments

I rectified to 510 and tried to burn the same on USB. still not able to execute as bootloader
you are doing something else... your bootloader is fine and running with 510 ;-)
0

Even with the signature in place, you may find that some hardware will not boot your image. It seems that some BIOS implementations require a valid BPB (BIOS Parameter Block) to be present in your image.

You might consider replacing the first few lines of your boot loader with something like this:

bits 16

org 0                                   ; BIOS will load the MBR to this location.

bootStart:
                jmp             _start
                nop
                bootDrive       db      'MSDOS6.0'
                bpb
                bps                     dw      512
                spc                     db      8
                rs                      dw      1
                fats            db      2
                re                      dw      512
                ss                      dw      0
                media           db      0xf8
                spfat           dw      0xc900
                spt                     dw      0x3f00
                heads           dw      0x1000
                hidden          dw      0x3f00, 0
                ls                      dw      0x5142,0x0600
                pdn                     db      0x80
                cheads                  db      0
                sig                     db      0x29
                serialno        dw      0xce13, 0x4630
                label           db      'NO NAME'
                fattype         db      "FAT32"

_start:
                                                        ; set up the registers
                mov     ax, 0x07c0
                mov     ds, ax

4 Comments

I have replaced my code with yours, and tried to burn the iso file (generated from bin) to USB.. No success.
The system that you are booting on... Is it an EFI system? If it is, do you have CSM enabled?
And, of course, this isn't complete... this is simply showing the structure of the BPB... you would still need all of your boot code plus the MBR signature at the end.
Ohh , can you give me an complete example code for boot loader working on USB, mine works perfectly on oracle virtual box..and system is not EFI system

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.