Previous - Up - Next

7.2   CD-ROMs and Floppies

7.2.1   Accessing a Host CD-ROM Drive

Accessing the CD-ROM of the host machine from inside the simulation is supported on Linux and Solaris hosts. This is done by creating a file-cdrom object using the new-file-cdrom 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.

On a Solaris host, you need to specify the raw disk device, which can be found by using the mount command. The line that shows where the CD is mounted will look something like this:

    /cdrom/mydisk on /vol/dev/dsk/c0t2d0/mydisk read only/nosuid
       on Fri Jul 26 11:52:52 2002

This means that the corresponding raw disk device will be called /vol/dev/rdsk/c0t2d0/mydisk. Note the rdsk instead of dsk.

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

simics> new-file-cdrom /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 scsi-cdrom or 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.2.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.

An image can be created from a set of files with the mkisofs program, which is available on both Linux and Solaris. For example:

mkisofs -l -L -o image -r dir

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

simics> new-file-cdrom 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 scsi-cdrom or ide-cdrom.

7.2.3   Accessing a Host Floppy Drive

It is possible to access a floppy on the host machine from within Simics if the host is running Linux or Solaris. 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.2.4   Accessing a Floppy Image File

Sometimes it can be convenient to have copies of boot floppies as image files. To create an image of a floppy you can use the Unix command dd:

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 FAT filesystem, a floppy image can be manipulated with Mtools (see section 7.1.4 for more information).

Previous - Up - Next