简体   繁体   English

简单的引导程序和boch

[英]Simple bootloader and bochs

I have a simple bootloader written in AT&T syntax. 我有一个用AT&T语法编写的简单引导程序。

[bits 16]
[org   0x7c00]
jmp   $
times 510-($-$$) db 0
dw    0xaa55

I use yasm -f bin -o boot.bin loader.s to compile it, and bochs to run. 我使用yasm -f bin -o boot.bin loader.s进行编译,然后运行。

dd if=boot.bin bs=512 of=floppy.img
bochs -q

But bochs said that there is no bootable device . 但是bochs说, no bootable device

So, I have the following questions: 因此,我有以下问题:

  1. How can I rewrite it with AT&T syntax (which construction I must use instead times 510-($-$$) db 0) ? 如何使用AT&T语法(必须改用times 510-($-$$) db 0)来重写它?
  2. What is wrong with bochs? Boch有什么问题?

Thanks! 谢谢!

PS Bochs was compiled with x86_64 support, but it doesn't work with bochs from the official arch repo. PS Bochs使用x86_64支持进行编译,但不适用于官方bochs中的boch。

I can't imagine why you're trying to write AT&T syntax if you don't know AT&T syntax! 我无法想象如果您不知道AT&T语法,为什么还要尝试编写AT&T语法! I think the "times" line would be... 我认为“时代”线是...

 .org 0x7DFE .word 0xAA55 

Bochs is probably looking for an entire 1.44M floppy image. Bochs可能正在寻找整个1.44M软盘映像。

I suggest you stick with the Intel syntax as it is usually more readable than AT&T. 我建议您坚持使用Intel语法,因为它通常比AT&T更易读。 For a few basic differences between them you can check this and this . 对于它们之间的一些基本区别,您可以检查thisthis

On Ubuntu, bochs needs bochs-x and bochs-sdl in order to run without errors. 在Ubuntu上,bochs需要bochs-xbochs-sdl才能正常运行。 Then you should be able to boot from your floppy image with: 然后,您应该能够使用以下命令从软盘映像启动:

bochs -q 'display_library: sdl' 'boot:a' 'floppya: 1_44=floppy.img, status=inserted'

Another option is to use qemu instead of bochs : 另一种选择是使用qemu代替bochs

qemu -fda floppy.img

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM