Create a disk image of desired size. I chose 50 MB
$ dd if=/dev/zero of=msdos622.img bs=1k count=0 seek=50000
Next boot from the DOS
boot media. I had a bootable CD image.
$ qemu -hda msdos622.img -cdrom DOS6.22_bootdisk.iso -boot d
From the DOS
prompt, create a partition on drive C
using fdisk
A:\> fdisk
After the partition is created the machine will be rebooted. Once you get the DOS
prompt back format the drive C
and make it bootable:
A:\> format c: /s
The /s
option of format
command transfers the system to the drive.
Next create a directory DOS
in C:\
and copy all the utilities into it:
A:\> mkdir c:\dos A:\> copy *.* c:\dos
DOS is ready to be used. Now in order to transfer your old games and programs, you need to mount it as loopback
device in linux. There is one problem with this. Since the image file has a partition table in it, when I tried to mount it, I got the following errors:
$ sudo mount msdos622.img /mnt -o loop -t msdos mount: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so
To work this around we need to calculate the offset size of the partition using the fidisk -ul
command:
$ fdisk -ul msdos622.img You must set cylinders. You can do this from the extra functions menu. Disk msdos622.img: 0 MB, 0 bytes 16 heads, 63 sectors/track, 0 cylinders, total 0 sectors Units = sectors of 1 * 512 = 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System msdos622.img1 * 63 98783 49360+ 6 FAT16
To calculate the offset we need to multiply the starting block (63 in our case) by 512. If the image has multiple partitions then the same approach can be used and each partition can be individually mounted on a separate mount point.
$ sudo mount -o loop,offset=32256 msdos622.img /mnt $ ls /mnt command.com dos drvspace.bin io.sys msdos.sys
Now you can copy your old dos games and other files to /mnt
.