LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 06-08-2009, 06:30 AM   #1
C++arl
LQ Newbie
 
Registered: Jun 2009
Posts: 14

Rep: Reputation: 0
VFD & RaWrite equivalents in lunix


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.

If you got any info/hints on this plz help!

~ C++arl
 
Old 06-08-2009, 10:03 AM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 70
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.
 
Old 06-08-2009, 10:19 AM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
jamescondron said it all.

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.
 
Old 06-09-2009, 08:00 AM   #4
C++arl
LQ Newbie
 
Registered: Jun 2009
Posts: 14

Original Poster
Rep: Reputation: 0
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:
Code:
sudo dd if=Programmering/fasm/OS2/bootr.BIN of=/dev/loop0 bs=512 count=1
Also, i'm not sure that the emulated floppy is /dev/loop0 but if I understand mtab right it should be.
 
Old 06-09-2009, 11:25 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by C++arl View Post
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:
Code:
sudo dd if=Programmering/fasm/OS2/bootr.BIN of=/dev/loop0 bs=512 count=1
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).
 
Old 06-10-2009, 05:47 AM   #6
C++arl
LQ Newbie
 
Registered: Jun 2009
Posts: 14

Original Poster
Rep: Reputation: 0
Yea, got it now, I dont even need a emulated floppy drive, I just use dd to write to a img file and then tell bochs too boot from that file. Thx all!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Vlsystem LIS2 VFD Display Kupo Linux - Hardware 3 05-14-2007 02:10 PM
Table of Equivalents: Windows & Linux Apps Compari Beetle B. Linux - Software 2 05-29-2005 03:27 PM
using rawrite osiris777 Linux - General 1 10-11-2003 12:53 PM
rawrite gabriel Linux - Newbie 2 05-17-2001 01:24 AM
Rawrite bob Linux - Newbie 2 02-16-2001 12:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration