目前,我尝试用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
请参阅此答案以获取更多信息:https://stackoverflow.com/a/34108769/5269447