Page 1 of 1

Creating a virtual floppy to boot from on GNU/Linux

Posted: Tue Jul 22, 2014 10:26 pm
by NerdicViking
So I've been following a tutorial (http://www.brokenthorn.com/Resources/OSDev6.html) to get into OS development. I've learned quite a lot, but the tutorial has a major shortcoming: it's made for Windows only! I know that the tutorial is possible to do from Linux, and up until the point I am at I have been able to figure out what to do, but now I have a problem. I need to create a virtual floppy disk that I can boot into using QEMU. It's worked fine with a single file (using:

Code: Select all

$ nasm boot1.asm -o boot.bin
$ dd if=/dev/zero of=boot.img bs=512 count=2880
$ dd status=noxfer conv=notrunc if=boot1.bin of=boot.img
$ qemu -fda boot.img
). Once I added a second file, however, it stopped working. I tried using the same dd command (the second one in shown here) with STAGE2.SYS (output of boot2.asm), though this did not work. I could see that the second file was not there by hexediting boot.img. It seemed to boot just fine, but no error messages were displayed. Nothing was printed out. Here is the pastebin of the full code:
boot1.asm: http://pastebin.com/NBJidft6
boot2.asm: http://pastebin.com/mY9FBDwF

Re: Creating a virtual floppy to boot from on GNU/Linux

Posted: Tue Jul 22, 2014 10:41 pm
by ScropTheOSAdventurer
I may be nit-picking when I mention this, but your boot signature should be 0x55AA instead of 0xAA55 due to the x86 being little endian.

Re: Creating a virtual floppy to boot from on GNU/Linux

Posted: Tue Jul 22, 2014 11:07 pm
by Combuster
NerdicViking wrote:I tried using the same dd command (the second one in shown here) with STAGE2.SYS
So you're writing both files to the same part of the floppy image? What do you think would happen in that case? (hint: use seek/skip)