自定义引导加载程序不工作
Custom bootloader not working
我使用汇编语言设计了我的自定义引导加载程序(仅显示我的名字。)并使用 NASM 编译了它。现在我想将它安装在 USB.But 中,但找不到任何方法来刻录它。我已经使用不同的实用程序进行了测试,例如 ISOtoUSB、通用 USB、rufus。错误即将到来'image is not bootable.'
但是当我在 oracle 虚拟驱动器上 运行 时,它工作得很好。
我正在做一些大学项目并感到震惊,我想将该引导加载程序加载到 USB,当我从 USB 引导时,我的引导加载程序应该可以工作。
有什么想法吗?
这是我的代码:
[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
即使签名就位,您可能会发现某些硬件无法启动您的映像。似乎某些 BIOS 实现 需要 有效的 BPB(BIOS 参数块)出现在您的映像中。
您可以考虑将引导加载程序的前几行替换为如下内容:
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
你的引导加载程序没有任何问题,除了这个:
times 512-($-$$) db 0
替换为:
times 510-($-$$) db 0
按照您的方式,您的引导加载程序将是 514 字节而不是 512。;-)
我使用汇编语言设计了我的自定义引导加载程序(仅显示我的名字。)并使用 NASM 编译了它。现在我想将它安装在 USB.But 中,但找不到任何方法来刻录它。我已经使用不同的实用程序进行了测试,例如 ISOtoUSB、通用 USB、rufus。错误即将到来'image is not bootable.'
但是当我在 oracle 虚拟驱动器上 运行 时,它工作得很好。
我正在做一些大学项目并感到震惊,我想将该引导加载程序加载到 USB,当我从 USB 引导时,我的引导加载程序应该可以工作。
有什么想法吗?
这是我的代码:
[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
即使签名就位,您可能会发现某些硬件无法启动您的映像。似乎某些 BIOS 实现 需要 有效的 BPB(BIOS 参数块)出现在您的映像中。
您可以考虑将引导加载程序的前几行替换为如下内容:
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
你的引导加载程序没有任何问题,除了这个:
times 512-($-$$) db 0
替换为:
times 510-($-$$) db 0
按照您的方式,您的引导加载程序将是 514 字节而不是 512。;-)