Handling FDD/HDDs easily

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
Locked
AUsername
Member
Member
Posts: 54
Joined: Sun Feb 01, 2009 9:07 pm

Handling FDD/HDDs easily

Post by AUsername »

Hello, about 2-3 weeks ago I switched to a new computer, yay! Lots of RAM, space, and raw power. Except for the small little fact that it's an x64 machine.

The problem? It can't run partcopy, debug, VFD, VDK at all. So there goes most of the tools I used to develop an OS. Luckily for me WinImage still worked, at the time I didn't really think of how this would help me since I used WinImage mostly for packaging the beta/final releases of my OS. Turns out that WinImage has as command line interface which allows you to add/delete files and directories to a floppy OR hard drive image.

Since WinImage works with both FAT12 and FAT32, if you're using FAT32 for your HDD filesystem then this method will take the pain out of writing your own tools or using other tools that don't work as well. You just need to write a proper partition.

So if you've switched to an x64 computer and can't work with floppies anymore, or you're looking for a way to easily write files and directories to your hard drive image then this is for you.

Step 1: Get WinImage
This is pretty simple, download WinImage from here (winima85).

Step 2: Install
If I need to tell you how to install something you shouldn't be in OSDev in the first place.

Step 3: Setup your environment
1. Click Start -> Control Panel -> System & Security -> System.
2. In the left side panel click "Advanced System Settings"
3. When the window pops up click the tab labeled "Advanced" and then the button "Environment Variables..."
4. Scroll down the list until you find "PATH", select it and hit "Edit"
5. Append a "C:\Program Files\WinImage\" to the string.

Image

6. Exit everything out and you're ready to continue.

Step 4: Create a floppy image
1. Open up WinImage.
2. Click File -> New.
3. Click the kind of floppy your OS has, or will, be using. I chose 1.44MB.
4. Click File -> Save.
5. Save it in C:\ or somewhere else you feel it's safe, from what I've seen WinImage doesn't like long directories so I put my image here. Name it "floppya.ima".

Image

Note: If you can't save you may need to turn off UAC, or run as admin.

Step 5: Setup the bootsector
1. Click Image -> Boot Sector Properties.
2. You should see a screen like this:

Image

3. Click "Open" and open your boot sector. Since WinImage also shows the OEM name and serial this can be a small way to check if your BPB is aligned properly.
4. Click OK, and save the image.

Step 6: Writing files to the disk
Now that your boot sector is done, it's ready to be written too, assuming the BPB is written properly, so this can also be a little backup that your BPB is correct.

Note: If UAC is turned on then depending on what directory your image is in, WinImage will fail to write to it. For this reason I suggest turning it off, or running it in admin.

1. Open the command prompt and cd to the directory containing the file you're planning on copying, for me this will be my second stage bootloder. Type "winimage <Path to image> <Filename> /I /H /Q".
2. This will copy <Filename> into <Path to image>. "/I" is inject, "/H" is hide the WinImage window, "/Q" is quit after execution (save automatically).

Image
Image

Step 7: Setting up Bochs
1. Open your Bochs configuration file.
2. Append "floppya: 1_44="C:\floppya.ima", status=inserted" somewhere in the file.
3. Save and exit out.

Step 8: Testing
1. Run Bochs
2. ...
3. Profit.

Image

Note: A very annoying message will popup every time you use WinImage to write to the image. Registering professional will fix this.

[Adding directories is a bit trickier the directory will need something in it to be added to the image]
[To be continued]
(I am working on a tool that will make it a bit easier so you don't have to setup environment variables and so on)
ru2aqare
Member
Member
Posts: 342
Joined: Fri Jul 11, 2008 5:15 am
Location: Hungary

Re: Handling FDD/HDDs easily

Post by ru2aqare »

AUsername wrote:Hello, about 2-3 weeks ago I switched to a new computer, yay! Lots of RAM, space, and raw power. Except for the small little fact that it's an x64 machine.

The problem? It can't run partcopy, debug, VFD, VDK at all. So there goes most of the tools I used to develop an OS.
There is a Total Commander add-on that is an x64 port of VFD. It is pretty reliable, unless you forget to unmount the floppy image before hibernating XP (in which case it gets stuck, and cant access your image file until the next reboot). I used RaWrite/RaWriteNT or whatever it was called, and worked just fine (no installation and no administrator rights required). Also most emulators and virtual machine hypervisors have x64 ports now.
User avatar
ucosty
Member
Member
Posts: 271
Joined: Tue Aug 08, 2006 7:43 am
Location: Sydney, Australia

Re: Handling FDD/HDDs easily

Post by ucosty »

An alternative that I use to write stuff to floppy images is mtools. They're just command line tools that let you manipulate files in FAT formatted disks and disk images.
The cake is a lie | rackbits.com
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: Handling FDD/HDDs easily

Post by Combuster »

mtools +1. No nagware, can perform about any FAT-related task from the command line, and works perfectly from a build script.
"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 ]
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Handling FDD/HDDs easily

Post by Love4Boobies »

Oh, awesome! A tutorial on how to use Bochs and WinImage. It even tells us when to click "Ok". It's perfect; you see, I'm an expert programmer but I don't know how to install stuff or set environment variables. </sarcasm>
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
Creature
Member
Member
Posts: 548
Joined: Sat Dec 27, 2008 2:34 pm
Location: Belgium

Re: Handling FDD/HDDs easily

Post by Creature »

I've used WinImage myself for a while to adjust floppy images (and have decent 64-bit support), but now I simply switched to CD-images and mkisofs (from CDRTools) which works very well for me.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Handling FDD/HDDs easily

Post by Love4Boobies »

I use DAEMON Tools for mounting and InfraRecorder for burning. As for floppy disks, Virtual Floppy Disk and RawWrite for Windows. I find it more productive to use tools with graphical interfaces for things that aren't automated (like building from sources).
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Handling FDD/HDDs easily

Post by Owen »

Love4Boobies wrote:Oh, awesome! A tutorial on how to use Bochs and WinImage. It even tells us when to click "Ok". It's perfect; you see, I'm an expert programmer but I don't know how to install stuff or set environment variables. </sarcasm>
Please, if you're going to comment on someone's work, be constructive, or don't comment at all.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Handling FDD/HDDs easily

Post by Love4Boobies »

Owen wrote:
Love4Boobies wrote:Oh, awesome! A tutorial on how to use Bochs and WinImage. It even tells us when to click "Ok". It's perfect; you see, I'm an expert programmer but I don't know how to install stuff or set environment variables. </sarcasm>
Please, if you're going to comment on someone's work, be constructive, or don't comment at all.
I was being constructive by telling the OP that he wasted his time and that the information is useless to everyone here. :wink:
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
qw
Member
Member
Posts: 792
Joined: Mon Jan 26, 2009 2:48 am

Re: Handling FDD/HDDs easily

Post by qw »

Love4Boobies,
At least the AUsername was trying to be constructive. No sarcasm needed.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Handling FDD/HDDs easily

Post by Love4Boobies »

Didn't we move on already or are you just trying to start a flame?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
qw
Member
Member
Posts: 792
Joined: Mon Jan 26, 2009 2:48 am

Re: Handling FDD/HDDs easily

Post by qw »

Love4Boobies,
Relax, will you? I didn't see anybody "move on already". Sarcasm is never constructive, so why not just withdraw your comment and really move on?
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Handling FDD/HDDs easily

Post by Love4Boobies »

Oh, really? I thought that http://forum.osdev.org/viewtopic.php?f= ... 70#p170437 and http://forum.osdev.org/viewtopic.php?f= ... 71#p170439 were moving on. Perhaps a mod should lock this thread already.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
Locked