Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi,
I'm really new to linux so bear with me on this one. I enjoy developing a hobby OS which I've done on my Windows computer for a while now, I use vfd to emulate a floppy drive, a self-made version of RaWrite to write .bin files to the virtual floppy and then bochs to emulate a computer running the os from the virtual floppy. I want to do the exact same thing on Ubuntu but havent found neither a equivalent of vfd nor RaWrite, so how can I get the .bin files on to some medium that bochs (atleast I managed to find bochs for linux ) can run from?
So, in short, what i need is:
1. A program that tricks the computer to belive that it has a floppy drive.
2. Aprogram that lets me write data to a given CHS address, on the virtual floppy.
You're falling into the trap of thinking Windows and Linux are the same, or at least operate the same. If you have a floppy image, you can mount it as you'd mount anything (more or less). As for the second, that also already exists (It exists in a better way than RaWrite on Windows, too).
You want to look at the man pages for mount and dd.
In linux the basic tools are files, for everything. Even devices are special types of files.
Any file can be a floppy, you can just create an empty file with dd, use /dev/zero as your if, and any file name as your of, this one will contain your floppy image, you can format the file as you would do with a device like /dev/hda1 with whatever fs you prefer, and mount it in loopback mode (mount -oloop). Once mounted you can put whatever you want into the file. If you already have a working floppy image, just put it wherever you want and instruct bochs to use that file as the boot image. If bochs can't do that, then mount the image file in loopback mode and use the mount point as your floppy drive.
Thanks for answering,
Well, I've managed to mount a virtual floppy drive,
Code:
# create a image of Zeros of length 2048 bytes
dd if=/dev/zero of=floppy.img bs=1024 count=2048
#make the image of ext2 file system
mkfs.ext2 floppy.img
#create a mount point
mkdir floppy.d
#mount the image to the mount point
mount -o loop floppy.img floppy.d
but this does'nt really solve my problem because in order for my 'os' to work i need to be able to specify exactly where on the floppy to write data to, for instance the boot sector needs to be on CHS 001, furthermore it seems that mount needs you too specify a filesystem for the disk and really don't want that, I just want it too apear as if you've inserted a completely blank floppy.
For writing the boot sector to sector 1 on the emulated floppy i tried this:
Thanks for answering,
Well, I've managed to mount a virtual floppy drive,
Code:
# create a image of Zeros of length 2048 bytes
dd if=/dev/zero of=floppy.img bs=1024 count=2048
#make the image of ext2 file system
mkfs.ext2 floppy.img
#create a mount point
mkdir floppy.d
#mount the image to the mount point
mount -o loop floppy.img floppy.d
but this does'nt really solve my problem because in order for my 'os' to work i need to be able to specify exactly where on the floppy to write data to, for instance the boot sector needs to be on CHS 001, furthermore it seems that mount needs you too specify a filesystem for the disk and really don't want that, I just want it too apear as if you've inserted a completely blank floppy.
True, if you want to write raw to the floppy image just use dd. It can write anything to any offset you want and you don't need to have a mounted disk nor even a fs inside it.
Quote:
For writing the boot sector to sector 1 on the emulated floppy i tried this:
Also, i'm not sure that the emulated floppy is /dev/loop0 but if I understand mtab right it should be.
You can just dd straight to the image file, no need to attach it to a loop device, specially if you don't plan to mount it at all (and specially if it's not mountable at all).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.