Here's the full QEMU command line that I use when I boot FreeDOS after
I install it. This has a bunch of other options, such as to support
sound and to use a second virtual disk as my D: drive.

qemu-system-i386 -enable-kvm -m 32 -rtc base=localtime -audiodev
pa,id=snd -machine pcspk-audiodev=snd -device sb16,audiodev=snd
-device adlib,audiodev=snd -hda /opt/freedos/FD14-rc3/freedos.qcow2
-hdb /home/jhall/virtualmachines/mystuff.qcow2 -cdrom
/opt/freedos/FD14-rc3/FD14LIVE.iso -boot menu=on


You can also see my paths. I keep my FreeDOS stuff under /opt/freedos
on Linux so it doesn't get backed up when I backup my Linux home
directory. I can just re-download the FreeDOS install CD; I don't need
to back that up.

I have all my personal files on the 'mystuff.qcow2' virtual disk so I
don't have to backup/restore my data whenever I reinstall a fresh
version of FreeDOS (like the next monthly test release). I keep the
'mystuff.qcow2' virtual disk under my home directory, because that's
something I want to backup when I backup my Linux home directory.

On Sun, Mar 9, 2025 at 9:41 AM Jim Hall <jh...@freedos.org> wrote:
>
> On Sun, Mar 9, 2025 at 7:50 AM hms--- via Freedos-user
> <freedos-user@lists.sourceforge.net> wrote:
> >
> > Hi there
> [..]
> >
> > I have been using QEMU and FreeDos up to now. There are several
> > drawbacks compared with dosemu2. Copying a large number of files to the
> > image and retaining file timestamps is a problem. I achieve this by
> > first copying to the access drive, then starting FreeDos in QEMU and
> > then using XCOPY to transfer files to the C: Drive (image). This takes
> > considerable time. I have had little to no success exporting files.
> > Writing to the access drive usually crashes QEMU. And finally, FreeDos
> > under QEMU is slightly slower than dosemu2. The stability of dosemu2
> > remains to be seen.
>
>
>
> I use QEMU to run FreeDOS on my Linux system, and it is admittedly a
> bit difficult to get used to because you need to "configure" or
> "build" the virtual machine using command line options.
>
> Here are the commands I use:
>
> (1) To create a new virtual disk, such as to install a fresh copy of
> FreeDOS, I might type this: (I'll make it 20MB for this example
> because I'm actually typing the commands while I install a new FreeDOS
> instance .. but change that to 500MB if you want to use a bigger
> virtual disk)
>
> $ qemu-img create -f qcow2 freedos.qcow2 20M
>
> You'll see output that looks like this:
> Formatting 'freedos.qcow2', fmt=qcow2 cluster_size=65536
> extended_l2=off compression_type=zlib size=20971520 lazy_refcounts=off
> refcount_bits=16
>
>
> (2) To install FreeDOS 1.4 rc3 with the LiveCD, you need to "build" a
> virtual machine with some memory, and configured with at least the
> LiveCD and the virtual disk. Don't forget to use KVM or it will be
> REALLY SLOW:
>
> $ qemu-system-i386 -enable-kvm -m 32 -cdrom FD14LIVE.iso -hda
> freedos.qcow2 -boot order=d
>
> This configures the virtual machine with 32MB memory, and uses the
> FreeDOS 1.4 rc3 LiveCD and the virtual hard disk I just made in step
> 1. The '-boot order=d' tells QEMU to boot only from the CD drive
> (which is always referred to in the 'order=' option as 'd' .. the
> first hard disk is always referred to as 'c' .. the first floppy is
> always referred to as 'a' .. the network is always referred to as
> 'n'). You can give '-cdrom' and '-hda' in either order.
>
>
> (3) Go through the usual FreeDOS installation process. Because I'm
> using a small (20MB) virtual disk, I just did the "plain DOS"
> installation.
>
> (4) When the install is finished, use the "Return to DOS" option and
> type 'shutdown' at the DOS prompt inside FreeDOS to stop the virtual
> machine.
>
> (5) Now that you've installed FreeDOS, anytime you want to run
> FreeDOS, you start QEMU by booting from the virtual disk. You can
> optionally configure the machine to use the LiveCD or the BonusCD, so
> you can use FDIMPLES to install other packages. Here's the command
> line to use the LiveCD, but boot from the virtual disk:
>
> $ qemu-system-i386 -enable-kvm -m 32 -hda freedos.qcow2 -cdrom
> FD14LIVE.iso -boot order=c
>
>
> You can use other options too. For example, to use the Linux local
> time as your virtual machine time, add the '-rtc' option like this:
>
> $ qemu-system-i386 -enable-kvm -m 32 -hda freedos.qcow2 -cdrom
> FD14LIVE.iso -boot order=c -rtc base=localtime
>
>
> You said you don't require sound, so I won't show the options to
> configure that (it requires a few options to connect everything
> together) but that's possible too. I emulate a PC speaker,
> SoundBlaster16, and AdLib.
>
>
> If you need to copy files to (or from) the FreeDOS virtual disk, you
> should only do this WHEN THE VIRTUAL MACHINE IS NOT RUNNING. Otherwise
> you will corrupt the virtual disk. I find the easiest way to do this
> is with the 'guestmount' tool from libguestfs-tools. (If you don't
> have this by default on your system, you can install it with your
> Linux package manager.)
>
> The 'guestmount' command has a particular command line. First, you
> "add" a virtual disk to work with, using the '-a' option. Then you
> need to give a partition in the virtual disk that you want to mount,
> using the '-m' option. Note that the '-m' option uses "/dev/sda1"
> notation to mean the first partition in the virtual disk, even though
> this isn't really your system's /dev/sda1.
>
> For a reasonably sized virtual disk like 20MB or 500MB, FreeDOS
> configures the disk with just one partition. That means if I wanted to
> exchange files with my freedos.qcow2 disk, I need to "mount" the
> "/dev/sda1" partition on that virtual disk to a directory (which I'll
> call 'freedos') like this:
>
> $ mkdir freedos
> $ guestmount -a freedos.qcow2 -m /dev/sda1 freedos
>
>
> This might take a second, so don't panic if it doesn't return right away.
>
> Now I can copy files to/from the FreeDOS virtual disk, using a Linux
> file manager or from the command line. If you want to preserve file
> timestamps, don't forget to use '-p' (preserve) with the 'cp' command
> on Linux. I can even edit a new file on the virtual disk using Linux
> 'ed', because it's just another Linux directory at this point:
>
> $ ed freedos/hello.bat
> freedos/hello.bat: No such file or directory
> i
> @ECHO OFF
> ECHO Hello World!
> .
> w
> 28
> q
>
>
> ..but I should probably use 'unix2dos' to convert that to DOS format,
> because that's a text file that has Linux line endings:
>
> $ unix2dos freedos/hello.bat
> unix2dos: converting file freedos/hello.bat to DOS format...
>
>
> Then unmount the directory, and you can use the virtual disk in QEMU as 
> normal.
>
> $ guestunmount freedos
>
>
>
> And not that it matters, but my HELLO.BAT file works fine after I
> created it on the FreeDOS virtual disk from Linux:
>
> C:\>type hello.bat
> @ECHO OFF
> ECHO Hello World!
>
> C:\>hello
> Hello World!


_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to