Reputation: 137
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
Upvotes: 1
Views: 594
Reputation: 16379
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
Upvotes: 0
Reputation: 5684
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. ;-)
Upvotes: 1