我自己的引导加载程序有问题,从 .bin 到 .iso 的文件转换失败
Problem with my own bootloader, file convertion from .bin to .iso failed
目前我尝试用 nasm 编写自己的引导加载程序,但我并没有真正成功。
问题是,我想将我的 .bin 文件转换为 .iso 或另一个映像文件,以便 VM 识别它。
但我的转换程序说文件已损坏。
我的 .bin 文件是在 Linux 下使用 NASM 编译器编译的,正好是 512 字节大。
nasm boot.asm -f bin -o boot.bin
[BITS 16]
[ORG 0x7C00]
start:
mov SI, msg
call eachstring
jmp $
eachstring:
mov AL, [SI]
inc SI
OR AL, AL
je end
jne printchar
printchar:
mov AL, [SI];Parameter festlegen
mov AH, 0x0E;Opcode ein Zeichen auszugeben
mov BH, 0x00;Keine Seite
mov BL, 0x07
int 0x10
ret
end:
ret
msg db 'Hallo Welt', 0
TIMES 510 - ($ - $$) db 0;Füllt den restlichen Speicher
dw 0xAA55;Magic key
我希望有人能帮助我。 =(
提前致谢
此致
一个 .iso
因为这个太过分了,你的引导加载程序的填充使得你的 .bin
与软盘扇区的大小相同,所以使用软盘映像代替:
#Prepare an empty image, this is the maximum size of a floppy disk
dd if=/dev/zero of=boot.img bs=1024 count=1440
#Insert your .bin to the first sector of the floppy disk
dd if=boot.bin of=boot.img conv=notrunc
运行 这将生成可引导软盘映像 boot.img
查看此答案了解更多信息:
目前我尝试用 nasm 编写自己的引导加载程序,但我并没有真正成功。
问题是,我想将我的 .bin 文件转换为 .iso 或另一个映像文件,以便 VM 识别它。
但我的转换程序说文件已损坏。
我的 .bin 文件是在 Linux 下使用 NASM 编译器编译的,正好是 512 字节大。
nasm boot.asm -f bin -o boot.bin
[BITS 16]
[ORG 0x7C00]
start:
mov SI, msg
call eachstring
jmp $
eachstring:
mov AL, [SI]
inc SI
OR AL, AL
je end
jne printchar
printchar:
mov AL, [SI];Parameter festlegen
mov AH, 0x0E;Opcode ein Zeichen auszugeben
mov BH, 0x00;Keine Seite
mov BL, 0x07
int 0x10
ret
end:
ret
msg db 'Hallo Welt', 0
TIMES 510 - ($ - $$) db 0;Füllt den restlichen Speicher
dw 0xAA55;Magic key
我希望有人能帮助我。 =(
提前致谢
此致
一个 .iso
因为这个太过分了,你的引导加载程序的填充使得你的 .bin
与软盘扇区的大小相同,所以使用软盘映像代替:
#Prepare an empty image, this is the maximum size of a floppy disk
dd if=/dev/zero of=boot.img bs=1024 count=1440
#Insert your .bin to the first sector of the floppy disk
dd if=boot.bin of=boot.img conv=notrunc
运行 这将生成可引导软盘映像 boot.img
查看此答案了解更多信息: