简体   繁体   English

操作系统开发 - 使用qemu从软盘驱动器启动

[英]OS Development - booting from floppy drive using qemu

I have been reading BrokenThorn's OS development tutorial and am at the part of creating and loading the second stage bootloader. 我一直在阅读BrokenThorn的操作系统开发教程,我正在创建和加载第二阶段引导加载程序。 The tutorial is for Windows, but I am doing this in Linux(Ubuntu 13.04). 本教程适用于Windows,但我在Linux(Ubuntu 13.04)中这样做。

This is what I have done: 这就是我所做的:

  • Created file floppy.img under ~/Documents/floppy with the mkfs.vfat command 使用mkfs.vfat命令在~/Documents/floppy下创建文件floppy.img
  • Compiled by boot.asm file using nasm giving me boot.bin 使用nasm编译boot.asm文件给我boot.bin
  • Then I ran this command : dd if=boot.bin of=~/Documents/floppy/floppy.img bs=512 count=1 然后我运行了这个命令: dd if=boot.bin of=~/Documents/floppy/floppy.img bs=512 count=1

Thus I have the floppy image with the first stage bootloader. 因此,我有第一阶段bootloader的软盘映像。 On starting that using qemu, it works fine. 在使用qemu开始时,它工作正常。

However, after I create the second stage bootloader, (if I am correct)I would have to mount the floppy.img and copy stage 2 on to the mounted filesystem. 但是,在我创建第二阶段引导加载程序后,(如果我是正确的)我将必须安装floppy.img并将第2阶段复制到已安装的文件系统上。 In such a case, how can one boot a mounted floppy using qemu ? 在这种情况下,如何使用qemu启动已安装的软盘? Is it even possible ? 它甚至可能吗? If not, how do I work with the second stage bootloader. 如果没有,我如何使用第二阶段引导加载程序。

Please forgive me for any stupid assumption/question as I am new with this. 请原谅我任何愚蠢的假设/问题,因为我是新手。

Where is your problem? 你的问题在哪里? You mount the image: 你装载图像:

mount -oloop ~/Documents/floppy.img /mnt/floppy

Copy the stage2: 复制stage2:

cp stage2.bin /mnt/floppy

Unmount it: 卸下它:

umount /mnt/floppy

And launch it with QEMU: 并使用QEMU启动它:

qemu -fda ~/Documents/floppy.img

Voilà! 瞧!

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

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