📄 ch62.htm
字号:
<LI><TT>ems.sys</TT>
<P>
<LI><TT>cdrom.sys</TT>
</UL>
<P>From the command subdirectory, copy the following file:
<BLOCKQUOTE>
<P><TT>exitemu.com</TT>
</BLOCKQUOTE>
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading8<FONT COLOR="#000077"><B>TIP:</B> </FONT>The easiest way to
copy files from a Linux directory to an MS-DOS-formatted floppy is to use the <TT>mcopy</TT>
command. For example:
</DL>
<DL>
<DD><FONT COLOR="#0066FF">mcopy filename a:</FONT>
<HR>
</DL>
<PRE></PRE>
<H4 ALIGN="CENTER"><A NAME="Heading9<FONT COLOR="#000077">Configuring Parameters
in /etc/dosemu.conf</FONT></H4>
<P>Everything you need to configure DOSemu exists in the file <TT>/etc/dosemu.conf</TT>.
A user-specific configuration file can be created in a user's home directory named
<TT>~/.dosrc</TT>. Both of these files have the same format. I will refer to these
files interchangeably as <TT>dosemu.conf</TT>. A sample configuration file is in
the <TT>etc/</TT> subdirectory of the standard DOSemu distribution. Look for the
file named <TT>dosemu.dist</TT>.</P>
<P>The example file is several hundred lines long. Most of this configuration file
contains comments to help explain the configuration options. Anything to the right
of a <TT>#</TT> character is a comment. A <TT>#</TT> in the first column means that
the entire line is a comment. Sample configuration lines for nearly all supported
hardware and software options are contained in this file. Most DOSemu configurations
can be expressed in 25 to 30 lines.</P>
<P>Configuration parameters in <TT>/etc/dosemu.conf</TT> have two basic formats.
A parameter that needs just one value has the form parameter value. A parameter that
needs multiple values has the form parameter { value1 value2 ... }.
<H4 ALIGN="CENTER"><A NAME="Heading10<FONT COLOR="#000077">Getting DOSemu to
Run for the First Time</FONT></H4>
<P>One way to configure DOSemu is to copy the example configuration file to <TT>/etc/dosemu.conf</TT>
and then edit the parameters based on information in the comments. Another way is
to create a simple <TT>dosemu.conf</TT> file and add to it as needed. A bare-bones
file looks like this:</P>
<PRE><FONT COLOR="#0066FF">timint on
keyboard { layout us keybint on rawkeyboard on }
video { vga console }
cpu 80486
bootA
floppy { device /dev/fd0 threeinch }
</FONT></PRE>
<P>Use a text editor to make the following customizations to <TT>dosemu.conf</TT>
based on your actual hardware:
<UL>
<LI>Change the video line to <TT>cga</TT>, <TT>ega</TT>, or <TT>ma</TT> if you don't
have VGA.
<P>
<LI>Change the <TT>cpu</TT> to 80386 if you do not have a 80486 or Pentium.
<P>
<LI>If your boot floppy is a 5<SUP>1</SUP>/4-inch floppy, replace <TT>threeinch</TT>
with <TT>fiveinch</TT>.
</UL>
<P>Make sure your drive A floppy is not mounted under Linux, and insert your boot
floppy into drive A. Start DOSemu from a virtual console by typing <TT>DOS</TT>.
Your version of DOS will boot from drive A, and you should be at the familiar <TT>A:></TT>
prompt. If you are using an empty MS-DOS disk, you will soon run out of things to
do. To exit the DOSemu prompt, press Ctrl-Alt-Page Down, or use the <TT>exitemu.com</TT>
command provided on your boot floppy.
<H4 ALIGN="CENTER"><A NAME="Heading11<FONT COLOR="#000077">Configuring Disk
Options</FONT></H4>
<P>Most Linux users have DOS partitions on a hard drive. Some might even have a separate
hard drive dedicated to DOS. This section shows several ways to configure DOSemu
to access these drives as native DOS disks. You can abandon your boot floppy and
boot from a hard drive, even if you do not have an MS-DOS-formatted drive or partition
anywhere. Accessing a Dedicated MS-DOS Disk or Partition The easiest way to access
a hard drive is to configure the drive in your <TT>dosemu.conf</TT> file. The disk
or partition in question must be formatted for MS-DOS and be a primary partition.
Extended DOS partitions are not yet supported. Following is the format of the parameter
entry to access a hard drive:</P>
<PRE><FONT COLOR="#0066FF">disk { type "device" readonly }
</FONT></PRE>
<P>The type parameter can be <TT>partition</TT> or <TT>wholedisk</TT>, and the device
is the Linux device being accessed. Typical names would be <TT>/dev/hda1</TT> for
a partition or <TT>/dev/sda</TT> for an entire disk. The <TT>readonly</TT> qualifier
is optional, and as the name implies, it write-locks the disk or partition in question.
If you boot Linux from a hard drive using LILO, do not access that drive using <TT>wholedisk</TT>.
When DOSemu boots from that drive, it gives you a LILO prompt. Unfortunately, neither
LILO nor Linux runs from within a DOSemu session.</P>
<P>Following are some examples of valid entries for disks:</P>
<PRE><FONT COLOR="#0066FF">disk { partition "/dev/sda4" } # mount 4th partition
disk { partition "/dev/hda1" readonly} # mount 1st IDE partition readonly
disk { wholedisk "/dev/sda" } # mount the whole 1st SCSI disk
</FONT></PRE>
<DL>
<DT><FONT COLOR="#0066FF"></FONT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading12<FONT COLOR="#000077"><B>CAUTION: </B></FONT>Linux might
have other tasks also accessing disks. To avoid problems with file corruption, disks
mounted as read/write under Linux should be configured as read-only. Use <TT>umask=022</TT>
in the <TT>/etc/fstab</TT> entry for the <TT>dos</TT> partition:
</DL>
<DL>
<DD><FONT COLOR="#0066FF">/dev/hda1 /dos messydos umask=022</FONT>
<HR>
</DL>
<PRE></PRE>
<P>How to Access any Linux Directory from DOSemu A much safer way to access a DOS
directory is through the <TT>emufs.sys</TT> device driver. This driver enables you
to access any Linux subdirectory as a logical device under DOS. In your <TT>config.sys</TT>
of your boot device, simply add the lines</P>
<PRE><FONT COLOR="#0066FF">device = emufs.sys /c
</FONT></PRE>
<P>where /c is the Linux directory you want to mount. The next available drive letter
is used for this logical drive.</P>
<P>Any disk or device mounted in the Linux file system can be made available to DOSemu
as a logical disk through the <TT>emufs</TT> driver. Disks and directories do not
need to be DOS-formatted and can include CD-ROMs as well as NFS and IPX mounted disks.
Files in these directories, however, must be in the MS-DOS 6.0 format to be visible
under DOSemu.</P>
<P>With a logical device you can perform typical operations, such as read, write,
and delete files, and run executables. Utilities such as <TT>drvspace</TT>, <TT>undelete</TT>,
and <TT>defrag</TT> do not work on disks accessed through <TT>dosemufs</TT>.
<H4 ALIGN="CENTER"><A NAME="Heading13<FONT COLOR="#000077">Creating Diskimages</FONT></H4>
<P>DOSemu has an additional abstraction called a diskimage. A diskimage is a Linux
file that appears to DOS as a logical device. Either a floppy or a hard disk is supported
as a diskimage. A diskimage makes an ideal boot device because the size can be set
just large enough to boot MS-DOS. Unlike drives accessed by dosemufs, drives configured
by diskimages work with such utilities as <TT>undelete</TT>, <TT>scandisk</TT>, and
<TT>defrag</TT>. Creating Floppy Image Files A floppy disk file is easy to create
under Linux. The floppy image file does not need to do anything except exist initially.
To create an initial floppy image file, use the <TT>touch</TT> command; for example,</P>
<PRE><FONT COLOR="#0066FF">touch filename
</FONT></PRE>
<P>This new floppy will appear as an unformatted floppy when you boot DOSemu. Because
the size of the floppy is configured in DOSemu, formatting the floppy will expand
the image file to the expected size (1.44MB for a high-density 3<SUP>1</SUP>/2-inch
floppy). Accessing a Floppy Image Under DOSemu To use a floppy disk, you need to
specify the floppy geometry for the benefit of DOS:</P>
<PRE><FONT COLOR="#0066FF">floppy { heads 2 sectors 18 tracks 80 threeinch file /usr/dos/hdimage }
</FONT></PRE>
<P>This simulates a 1.44MB, 3<SUP>1</SUP>/2-inch floppy. A diskimage floppy can be
used in the same way as any floppy, except that it cannot be removed. Expect the
diskimage floppy to operate significantly faster than a real floppy, with formatting
taking only a few seconds.
<DL>
<DT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading14<FONT COLOR="#000077"><B>TIP:</B> </FONT>Some DOS utilities
that like to reboot MS-DOS, such as <TT>DRVSPACE</TT>, check to see whether you have
a floppy in drive A before allowing you to continue. Because you cannot eject a floppy
diskimage, you need to remove the floppy configuration and restart DOSemu.
<HR>
</DL>
<P>Creating Hard Diskimage Files Under Linux Hard diskimage files are more confusing
to configure than floppies. To initially create the hard disk file, use the command
<TT>mkhdimage</TT> found in the <TT>periph</TT> directory of the DOSemu distribution.
Instead of specifying the size of the image, you need to specify the number of heads,
sectors, and cylinders of the disk to create. Following is an example <TT>mkhdimage</TT>
command that creates a 10MB disk:</P>
<PRE><FONT COLOR="#0066FF">mkhdimage -h 8 -s 20 -c 128 > /usr/dos/hdimage
</FONT></PRE>
<P>To compute the size of a disk based on disk geometry, multiply headsxsectorsxcylindersx512
(number of bytes per sector under MS-DOS). Because these parameters do not represent
the real characteristics of a disk, the ratio of heads to sectors to cylinders does
not matter to DOSemu. However, MS-DOS recognizes only the first 1,024 cylinders of
a disk.</P>
<P>Because <TT>mkhdimage</TT> creates a file of only 128 bytes, no other check of
available space for the configured amount takes place. Do not configure a diskimage
drive larger than the available disk space. Accessing a Diskimage Under DOS To use
a diskimage as a logical hard drive, use the disk parameter with a type of <TT>image</TT>
rather than <TT>wholedisk</TT> or <TT>partition</TT>, as well as the name of the
Linux file used:</P>
<PRE><FONT COLOR="#0066FF">disk { image "/usr/dos/hdimage" }
</FONT></PRE>
<P>Like floppy diskimages, hard diskimages are not initially formatted. When a diskimage
file is initialized, it is also unpartitioned. Use the MS-DOS fdisk utility to create
a partition on the drive you configure. To avoid confusion and data loss, configure
DOSemu with only one real floppy and only the new hard diskimage for a hard drive.
Sometimes a new diskimage will appear to fdisk to have a partition created, but MS-DOS
is unable to access the partition. The easy fix is to delete the existing partition
and re-create it.</P>
<P>Hard diskimages are different from floppies in that disk space used under Linux
is allocated on demand. A newly formatted diskimage of any size takes up enough disk
space to store FAT information. The disk file grows as disk space is used under DOS.
An interesting observation is that if a diskimage is <TT>drvspace</TT>d under MS-DOS,
<TT>drvspace</TT> allocates the entire amount of space for its drive mapping.
<H4 ALIGN="CENTER"><A NAME="Heading15<FONT COLOR="#000077">Configuring Video
Options for the Virtual Consoles of Linux</FONT></H4>
<P>Linux's virtual console can support more than just text-mode virtual consoles.
Due to the direct-access nature of most DOS-based video, this is perhaps DOSemu's
biggest weakness. Not all video boards work correctly with DOSemu, and even fewer
work perfectly. The basic configuration for the video section with graphics looks
like this:</P>
<PRE><FONT COLOR="#0066FF">video { type console graphics chipset chipset_type memsize kb vbios_seg address
vbios_size=hex }
</FONT></PRE>
<P>If your video board is 100 percent VGA compatible, omitting everything past the
keyword <TT>graphics</TT> might work.</P>
<P>The following chipset keywords are supported:
<UL>
<LI><TT>et4000</TT>
<P>
<LI><TT>s3</TT> (801, 805, and 928)
<P>
<LI><TT>diamond</TT>
<P>
<LI><TT>trident</TT>
</UL>
<P>Video boards that do not have the BIOS configured at 0xC000 need the <TT>vbios_seg</TT>
to be set to the actual address. When in doubt, you can determine the video BIOS
starting address (<TT>vbios_seg</TT>) as well as the video BIOS size (<TT>vbios_size</TT>)
by using the Microsoft Diagnostics (MSD) utility that comes with MS-DOS and MS-Windows.</P>
<P>The following line allows DOS access to known video ports directly and helps compatibility:</P>
<PRE><FONT COLOR="#0066FF">allowvideoaccess on
</FONT></PRE>
<H4 ALIGN="CENTER"><A NAME="Heading16<FONT COLOR="#000077">Using DOSemu from
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -