qsp-x86/user-provided-linux 5 Miscellaneous Notes
QSP-x86 Target Guide  / 

4 Simulated Machines

Simics scripts for starting QSP x86 machines are located in the [project]/targets/qsp-x86/ directory, while the actual configuration scripts can be found in the targets/qsp-x86/ directory in the corresponding add-on package.

4.1 Machine Scripts and Parameters

The following parameters can be set before the running of each script.

4.1.1 firststeps.simics

Example x86 machine referred to by different documents going with Simics. It is identical to qsp-clear-linux.simics but with some harmless warnings disabled.

4.1.2 qsp-clear-linux.simics

Script that boots Clear Linux image with UEFI.

4.1.3 qsp-dvd-boot.simics

Starts a virtual machine that boots from a DVD or CD-ROM ISO file, using a UEFI BIOS. This script can be used to install an operating system on a QSP-x86 machine.

4.1.4 qsp-hdd-boot.simics

Starts a virtual machine that boots from the HDD set by a given craff file.

4.1.5 qsp-usb-boot.simics

Starts a virtual machine that boots from a USB ISO file. This script can be used to install an operating system on a QSP-x86 machine.

4.2 Target Setup

4.2.1 Preparation

Download and install the following packages:

After installing the packages, run project-setup to create or update your project.

Package 4094 adds the default Clear Linux image to the qsp-clear-linux- scripts, where Clear Linux is a Linux distribution optimized for Intel® x86 processors. Some other things to note about the distro setup:

Package 8112 enables the user to pick a more modern CPU by setting:

$cpu_comp_class = "x86QSP2"

before loading the target script. Look for other options in the script files for atom, client, modern, server or what scripts are available in the package at the moment.

If you want to connect and transfer data with the real network, you will need to set up a TAP interface; see ***MANUAL-TODO: Replace cite with proper link Ethernet Networking — User's Guide, section 4.3.1.

When building your own images, you will have to use the add-directory command which will add the directory where you store your images to Simics's search path.

4.2.2 Install from DVD, example with Microsoft Windows 7

You will need a DVD-image of Windows 7 before starting the installation. See also the ***MANUAL-TODO: Replace cite with proper link Installing Microsoft Windows 7 on the x86-X58-ICH10 target application note.

If you are using a Windows host you will need a separate program to create the image. If you are using a Linux host you should be able to create an image of your Windows 7 DVD by running the following command as root at the command-prompt:


$ dd if=/dev/cdrom of=win7dvd.iso

The working directory for this guide will be [simics]/targets/qsp-x86/. Put the created win7dvd.iso image in the images directory.

Create a new script called win7inst.simics to set up a disk and the DVD-image. It will use a script called qsp-dvd-boot.simics to boot the DVD and should look something like the following:


  $iso_image = "win7dvd.iso"
  $disk_size = (80 * 1024 * 1024 * 1024)
  run-command-file "%script%/qsp-dvd-boot.simics"

Set disk_size to match the size wanted for the disk (Windows 7 will require about 11 to 20 GB of space). Creating a larger disk will not consume more space on the host as the image is compressed with the craff utility. If not specified, the default size is 20 GB.

Make sure you have plenty of swap-space on your drive. You can set your swap directory through the command set-image-memory-limit in Simics.

Now run the created script and the Windows DVD should start booting. Follow the directives during the installation. After choosing a disk to install to, the installation will continue for quite a long time.

When the installation is completed, Windows is going to be rebooted. Simics does not handle reboots, so instead the CPU will end up in HLT state. Continue running the simulation until HLT state is displayed at Simics CLI when the simulation is stopped.

To save what has been installed to the disk-image, use the command save-persistent-state inst. The command saves the current states of all persistent media such as disks and flash memories. The disk contents will now be saved in the inst directory.

Once the current disk contents is saved, Simics can be exited and the file inst/board.disk.hd_image.craff will contain the current image of the Windows-installation disk.

If a checkpoint is saved at any time during the installation you will have to merge the persistent state saved at the end with the checkpointed disk using craff utility.

The new image can now be booted. To do this create a script named qsp-w7-pro.simics which contains the image just created. The scripts should look something like:


  $disk_image = "inst/board.disk.hd_image.craff"
  $disk_size = (80 * 1024 * 1024 * 1024) # same size as used earlier
  $machine_name = "board"
  run-command-file "%simics%/targets/qsp-x86/qsp-system.include"
  instantiate-components

  # set a time quantum that provides a reasonable boot time
  $system.cell->time_quantum = 0.0001

  $system->system_info = "QSP-x86 - Windows 7 Professional"
  enable-real-time-mode

Run this script and the installation will continue from the disk. Windows will then complete the installation and again a reboot is needed. When the CPU once again reaches HLT state, stop the simulation and save the current state by running the command save-persistent-state inst2. Notice however, Simics will only save the difference compared to the last used image and not the whole image. You must merge the disk-image used to boot with the new state of the image using the craff utility located in the [simics]/bin directory. Run the following command to join the two craff files from the saved persistent states:


$ craff -o images/inst.craff inst/board.disk.hd_image.craff inst2/board.disk.hd_image.craff 

The created images/inst.craff image will be used to once again boot Windows for the last step of the installation. Modify the script qsp-w7-pro.simics that was used for the most recent boot to instead use the new image:


  $disk_image = "inst.craff"

Boot again and there will be more options for setting up Windows. Follow the instructions but when asked to configure time-settings just press Next (system time can be set in the startup-script). Windows 7 should now be up and running, at this point the final image should be saved, so Windows needs to be shut down.

Once at HLT state, after stopping the simulation, repeat the same procedure as before to save a disk-image, using save-persistent-state win-final. The craff utility is used to make the final disk-image:


$ craff -o images/win7.craff images/inst.craff win-final/board.disk.hd_image.craff

The created win7.craff image can now be used to boot Windows, all that is needed is to modify the qsp-w7-pro.simics script to use this image. The intermediate persistent states can now be deleted.

Instead of saving an image using save-persistent-state you can use a read/writable image instead of the DVD image, which lets changes to be written directly to the disk. Read more about read/writable images and saving changes to images in ***MANUAL-TODO: Replace cite with proper link Simics User's Guide.

Yet another option is the checkpoints-merge utility; that is because a saved persistent state is a checkpoint with only the persistent data saved. See the ***MANUAL-TODO: Replace cite with proper link Simics User's Guide for more information.

4.2.3 Install from DVD, example with Ubuntu 22.04 LTS

You will need a DVD-image before starting the installation. Download ubuntu-22.04-desktop-amd64.iso from https://ubuntu.com/download/desktop.

A script called qsp-dvd-boot.simics will be used to boot the DVD.

Create a new script called dvd_install.simics to set up a disk and the DVD-image. It should look something like:


  $iso_image = "ubuntu-22.04-desktop-amd64.iso"
  $disk_size = 80 * 1024 * 1024 * 1024
  run-command-file "targets/qsp-x86/qsp-dvd-boot.simics"

Set disk_size to match the size wanted for the disk. Creating a larger disk will not consume more space on the host as the image is compressed with the craff utility.

Make sure you have plenty of swap-space on your drive. You can set your swap directory through the command set-image-memory-limit in Simics.

The created script can now be run and the DVD should start booting. Follow the directives during the installation. The installation process takes considerable time, which might include reboots.

Having finished the installation, the OS will be up and running, and to save a clean install disk image the systems must be halted. Now Shutdown the system. The simulation will automatically stop when the system is shut down. This can typically be identified as a message from a device that sleep state is not implemented or as an I/O operation outside of the defined address space. At this point save the disk image using save-persistent-state os-install-final.

Now you can create a script for running the installed workload. It should look something like this:


  $disk_image = "os-install-final/board.disk.hd_image.craff"
  $disk_size = 80 * 1024 * 1024 * 1024
  $machine_name = "board"
  run-command-file "targets/qsp-x86/qsp-system.include"
  instantiate-components

  # set a time quantum that provides a reasonable boot time
  set-time-quantum cell = $system.cell seconds = 0.0001

  $system->system_info = "QSP-x86 - My Own OS Install"
  enable-real-time-mode

Saving of the final disk content will be quite slow if the host system ran out of memory and was forced to use disk as backing storage during the installation.

4.2.4 Using a Prepared Disk Image

To run a machine from an existing disk image, create a small script that looks something like this:


  $disk_image = "my_disk_image.img"
  $machine_name = "board"
  run-command-file "targets/qsp-x86/qsp-system.include"
  instantiate-components

  # set a time quantum that provides a reasonable boot time
  set-time-quantum cell = $system.cell seconds = 0.0001

  $system->system_info = "QSP-x86 - My Own Disk Image"
  enable-real-time-mode
qsp-x86/user-provided-linux 5 Miscellaneous Notes