MTOOLs for Bochs and Win32 and/or DOS

I use Bochs 2.3.x with a few modifications of my own to test my OS and thought that I needed a few tools to help me out.

Have a look here for a list of image files you may want to use to test your OS' FS code with.

Yes, there is a set of MTOOLs for Bochs already made. However, as far as I can tell, you have to download and install a *nix emulator just to run the tools.

So, here are some tools I made. I figured that if I benefitted from them, why shouldn't others that use Bochs and Win32 be able to use them also. :)


The contents of MTOOLS.ZIP (555k) are:

BXIMAGE.EXE  "Bochs Image" Creator
- This is included from the Bochs package.  It simply creates blank sectors of image space.  For example, it will create an empty floppy or hard drive image of a specified size.  The image will be "empty".

MKDOSFS.EXE  "Make DOS FS"  v00.14.15
A utility to create a FAT disk image of specified size.
- Floppy  or  Harddrive up to 1024meg of FAT12, FAT16, or FAT32[1].
- I have done some work with the FAT32 stuff, but it is not completed.
- Now includes an option to create an empty MBR, then start the DOS partition at LBA 63.

IMGINIT  "Image Initalize"  Alex Frounze 17 Jan 2009
- Creates three types of FAT12/16/32 images, including a hard drive image with extended partitions and multiple FAT partitions.  Very useful in testing your partition parser.  (see IMGCPY for copying to and from these images)

IMGCPY  "Image Copy"  Alex Frounze 17 Jan 2009
- Copies files to and from FAT images, including creating directories.

MDEL.EXE  "Delete file"  v00.10.01
- A utility to delete an existing file from a FAT disk image.

MDIREX.EXE  "Directory Extended"  v00.10.01
A utility to view a FAT disk images directory and FAT contents.
- Displays the BPB, ROOT, and each occupied ROOT entries FAT chain.

MGETIMG.EXE  "Get Disk Image"  v00.20.00
A utility to create a disk image from logical drives. (multiple formats).
- Logical Drives include floppies and partitions on hard drives.
- Now will handle large partition sizes (total sectors more than 32-bits)

MPUTIMG.EXE  "Put Disk Image"  v00.20.00
A utility to write a disk image to a floppy drive. (multiple formats).
Source and Executables included for:
 - Will write to a USB Thumb Drive, and as long as
    your BIOS will boot USB Thumb Drives as 1.44 floppies, you can use it
    instead of a floppy disk.

MBOOTCD.EXE  "Create a CDROM Image with boot options"  v00.10.10
Create a CDROM image capable of booting with only a ROOT and a single file.
 - Added the Effective Date to the Primary Volume Descriptor.  Some hardware wasn't booting the CD with out it.
 - Fixed a few minor errors, but now more specification correct.

MGETCD.EXE  "Get Disk Image of Physical CD"  v00.10.10
A utility to create a disk image from a CD.
- Compiled with VC++ 6.0 as a Win32 console app
- 27May2004: Now checks for multi-session disks.  I still think it isn't reading quite enough sectors, but I am working on it.
- **** Now Requires a WinXP machine ****

MCDINFO.EXE  "Get CD Info"  v00.10.20 
A utility to get the info from a CD.  Displays much more information now.
Also allows a filename on the command line to use an ISO image instead.
- Compiled with VC++ 6.0 as a Win32 console app
- *** Requires a WinNT machine ****

MMAKECD.EXE  "Make 9660 CD from directory"  v00.10.00 
This is the utility by Philip J. Erdelsky from http://alumnus.caltech.edu/~pje/cdmake.txt. I modified it and added to it to make it a bit more detailed.
- Compiled with VC++ 6.0 as a Win32 console app
- *** Requires a WinNT machine ****

MAPPEND.EXE  "Append Sectors to Disk Image" v00.10.05
Append sectors to a disk image so that it has an even number of cylinders, heads, and spt. For example, if you get a disk image that BOCHS panics that the disk geometry doesn't match your bochrc.txt file, then use this to append enough sectors to the end of the image so that you have a cylinder value of X, a head value of 16, and a SPT value of 63.

MSECTCPY.EXE  "Sector Copy"  v00.10.00 
This utility will copy a given binary file to a specified location in another given binary file.
In other words, copy a smaller file to an offset within a larger image file.
Used for writing MBR's, boot code, and other fixed offset items to your image file.

DUMP.EXE  "Dump a files contents"  v01.75.00, is now located here.

MKE2FS.EXE  "Make an Ext2 file system" v00.04.14
A utility to format a partition or a file to the Ext2 File System by Matt <mattwu [at] 163.com>
I found this and the source at:
   http://sourceforge.net/project/showfiles.php?group_id=43775&package_id=36151&release_id=604095 inside the Ext2Fsd-0.46a.src.zip file.  I am only including the .exe and readme.txt file.  For the source, grab the zip file at SF.
The home page he has listed http://ext2.yeah.net is broken.
The latest code looks to be at http://ext2fsd.svn.sourceforge.net/viewvc/ext2fsd/trunk/Mke2fs/


MAKE_VMDK.EXE  "Make a .VMDK file"  v00.10.00
Okay, this isn't a tool for bochs, but this will allow you to take your hard disk images from bochs and use them in VMware's Workstation v6.0.  It creates a .vmdk config file to tell VMware what type of image you are using.  It is an MFC MS WinXP Dialog App but should work on Win95+.



Most utilities come with source code.  I compiled them with (except were noted): 
 DJGPP      (creates a DOS .EXE that requires a DPMI)
 VC++ 6.x   (creates a Windows .EXE that requires Win32)
 QC2.5      (creates a DOS .EXE that will run on TRUE DOS)

All utilities come with a pre-compiled version using DJGPP with the above requirements for DJGPP .EXE's, except were noted above.


[1]Please note that I currently only use FAT12 with these tools.  I have coded the FAT16 and FAT32 into these utilities, but it is unknown if they work correctly.  If you use FAT16 or FAT32 and these utilities, please let me know if you had to make some modifications to get them to work.  Thanks.

*** Contact info can be found here. 
Here is the executable and source to a small utility to delete the second FAT from a freshly formatted DOS 1.44m floppy disk. I use it to test my FAT code for use of only one fat on the disk. However, I don't know of any DOS format util that will format a disk with only one FAT, so... :-) Please read the comments in the onefat.asm source file.

tolow.zip - version 1.04a
- A utility to change all long filenames to lower case. Must be in a DOS session under Win9x/WinXP.
Will not work in True DOS.
- - Only changes filenames in current directory.
- - Use TOLOW /? to get version.
- - Use TOLOW /d to change all directory names in current directory also. (lower case D)
- - One parameter at a time and the parameter must be the first item on the line.
i.e: TOLOW /d. No extra spaces between TOLOW and /?

Go to https://sites.google.com/site/chitchatvmback/vfd for a tool to allow your WinXP machine to use disk images as if they were the actual floppy drive. Good tool.

Links to other tools:
- http://www.ii.pw.edu.pl/~borkowsm/unddi.htm
- PartCopy can be found at http://geezer.osdevbrasil.net/johnfine/index.htm
- Winimage 8.50
Read and write fat images, read NTFS images, and other great tools.
You must register after a short period of using it.
Great tool though.



I have spent little time on these utilities. Just enough time to make them work and document them a little. My goal is not to make them wonderful utilities. My goal is to use them for testing my OS. If I need one of the utilities to do something more, I will add to it then and not until then :).

However, if you want to modify them for your own use, send me the modified file and I may post it here for all to use. I give credit where credit is due...

You may use these utilities as you see fit. You may do what you would like with the source code. However, please note that I release them for others for the use with Bochs and nothing else. So if you use them for something else, please don't complain to me if they do not work for your interest. :) Sorry, but they are released for use with Bochs. In other words,
*** USE AT YOUR OWN RISK ***


Enjoy,

Ben