Creating a virtual floppy to boot from on GNU/Linux

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
NerdicViking
Posts: 1
Joined: Tue Jul 22, 2014 9:16 pm

Creating a virtual floppy to boot from on GNU/Linux

Post 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
User avatar
ScropTheOSAdventurer
Member
Member
Posts: 86
Joined: Sun Aug 25, 2013 5:47 pm
Location: Nebraska, USA

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

Post 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.
"Procrastination is the art of keeping up with yesterday."
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

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

Post 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)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply