7.2 Working with Images 7.4 USB disks
Simics User's Guide  /  II Feature Overview  /  7 Moving Data in and out of the Simulation  / 

7.3 CD-ROMs and Floppies

7.3.1 Accessing a Host CD-ROM Drive

This is a Linux specific chapter. Accessing the CD-ROM of the host machine from inside the simulation is supported on Linux hosts. This is done by creating a cdrom-image object using the new-cdrom-image command. First, you should insert the CD in the host machine and figure out which device name it uses.

On a Linux host, this is typically /dev/cdrom, which is a symbolic link to the actual CD-ROM device, e.g., /dev/hdc. Note that you need read/write access to the CD-ROM device for this to work.

When you have the correct device file name, you create a cdrom-image object and insert it into the simulated CD-ROM drive:

simics> new-cdrom-image /dev/cdrom file_cd0
CDROM 'file_cd0' created
simics> cd0.insert file_cd0
Inserting media 'file_cd0' into CDROM drive

Note that you must replace /dev/cdrom with the correct host device name as mentioned above, and cd0 with the correct Simics object name. Use the list-objects command to find the correct object of class ide-cdrom.

The cd0.insert command simulates inserting a new disk into the CD-ROM drive, and there is also a corresponding cd0.eject command that simulates ejecting the disk.

7.3.2 Accessing a CD-ROM Image File

A file containing an ISO-9660 image can be used as medium in the simulated CD-ROM. This image file can be created from real CD-ROM disks, or from collections of files on any disk.

On Linux, an image can be created from a set of files with the mkisofs program. For example:

mkisofs -l -L -o image -r dir

On Windows, you can use a third-party product to create ISO-9660 images from files or from CD-ROMs, and a non-exhaustive list is given in figure 1. Note that many programs can read CD-ROMs in either "file" or "raw" mode ("raw" mode is often called "aspi"). If CD-ROMs are read using file mode, the resulting image will not be bootable.

WinImage http://www.winimage.com
Shareware, only copies images from real CD-ROM
WinISO http://www.winiso.com
Shareware
UltraISO http://www.ezbsystems.com/
Shareware
MagicISO http://www.magiciso.com
Shareware, can make images from files, CD-ROMs, and DVD-ROMs, and edit ISO images.
mkisofs http://wiki.osdev.org/Mkisofs
Part of the cdrtools package, free, need Cygwin
Figure 1. Windows Programs to Create ISO-9660 Images

Once you have an image file, a cdrom-image object can be created, and then inserted into a simulated CD-ROM device in the same way as above:

simics> new-cdrom-image myimage.iso
CDROM 'myimage' created
simics> cd0.insert myimage
Inserting media 'myimage' into CDROM drive

Note that cd0 above refers to the Simics object name of the CD-ROM drive. This may or may not be called cd0. To see which object name to use, try the list-objects command and look for an object of class ide-cdrom.

7.3.3 Accessing a Host Floppy Drive

This is a Linux specific chapter. It is possible to access a floppy on the host machine from within Simics if the host is running Linux. For example (assuming the floppy device object is called flp0):

simics> flp0.insert-floppy A /dev/fd0

Note: To boot directly from the floppy on a simulated x86 architecture you need to select the "A" drive to be the boot device (in, for example, enterprise-common.simics):

simics> system_cmp0.cmos-boot-dev A

7.3.4 Accessing a Floppy Image File

Sometimes it can be convenient to have copies of boot floppies as image files. On Windows, to create an image of a floppy you can use, for example, WinImage (see section 7.3.2 above).

On Linux, you can use the dd command:

dd if=/dev/fd0 of=floppy.img

It is then possible to use this image file in Simics:

simics> flp0.insert-floppy A floppy.img

Note: To boot directly from the floppy on a simulated x86 architecture you need to select the "A" drive to be the boot device (in, for example, enterprise-common.simics):

simics> system_cmp0.cmos-boot-dev A

Floppies are also a convenient way to move small amounts of data out of the simulated machine. Write the data to the simulated floppy inside the simulated machine, and then extract it from the image.

If it is formatted as a FAT file system, a floppy image can be manipulated with, for example, Mtools (Linux only, see section 7.2.5 for more information).

7.2 Working with Images 7.4 USB disks