Virtual floppy in Linux

Programming, for all ages and all languages.
Post Reply
Joseph1337
Posts: 1
Joined: Tue Sep 18, 2007 2:15 pm

Virtual floppy in Linux

Post by Joseph1337 »

Hello there

I`m trying to boot my little boot.bin in Bochs but I got a problem. My floppy doesn`t work so I was wondering if can I create a virtual floppy drive in linux and write to it in normal means(dd). Or sowewhow link /dev/fd0 to a created by my file that i can read/write data via dd and it acts like a normal floppy.
Thanks
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:

Post by Combuster »

"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 ]
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Virtual floppy in Linux

Post by pcmattman »

Joseph1337 wrote:I`m trying to boot my little boot.bin in Bochs but I got a problem. My floppy doesn`t work so I was wondering if can I create a virtual floppy drive in linux and write to it in normal means(dd). Or sowewhow link /dev/fd0 to a created by my file that i can read/write data via dd and it acts like a normal floppy.
Thanks
If your boot.bin is a valid FAT12 bootsector you can insert it as the first sector of the floppy image and then mount your floppy (via the method that Combuster provided) and read/write to it using your host OS.
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Yup that's easy

Post by DeletedAccount »

1) dd if=/dev/zero of=myos.img bs=1k count=1440
2) mkdosfs myos.img # mke2fs for ext2 etc ...
3) mount -o loop myos.img mydir


That's alll ...
When you are done ..

umount mydir
Post Reply