Module Qemu

QEMU invocation logic fragments.

Base parameters

val guest_archs : B0_std.Os.Arch.t list

guest_archs are the guest archs supported by telvm.

val system : guest_arch:B0_std.Os.Arch.t -> (B0_std.Cmd.t, string) Stdlib.result

system determines the QEMU executable to run.

val system_version : B0_std.Cmd.t -> (string option, string) Stdlib.result

system_version cmd is the QEMU version of the system cmd or None if it cannot be found in the PATH.

val machine : guest_arch:B0_std.Os.Arch.t -> (string, string) Stdlib.result

machine determines the value of the -machine option.

val accel : host_os:B0_std.Os.Name.t -> host_arch:B0_std.Os.Arch.t -> guest_arch:B0_std.Os.Arch.t -> string

accel determines the value of the -accel option.

val cpu : host_arch:B0_std.Os.Arch.t -> guest_arch:B0_std.Os.Arch.t -> (string, string) Stdlib.result

cpu determines the value of the -cpu option.

val smp : string option -> string

smp dtermines the value of the -smp option. Defaults to "4".

val mem : string option -> string

mem dtermines the value of the -mem option. Defaults to "4G".

val base_cmd : system:B0_std.Cmd.t -> machine:string -> accel:string -> cpu:string -> smp:string -> mem:string -> B0_std.Cmd.t

base_cmd is the system executable with corresponding parameters

val auto_base_cmd : host_os:B0_std.Os.Name.t -> host_arch:B0_std.Os.Arch.t -> guest_arch:B0_std.Os.Arch.t -> smp:string option -> mem:string option -> (B0_std.Cmd.t, string) Stdlib.result

Bootloader parameters

val uefi_code : host_os:B0_std.Os.Name.t -> guest_arch:B0_std.Os.Arch.t -> (B0_std.Fpath.t, string) Stdlib.result

uefi_code determines the file where the UEFI blob stored.

val uefi_drive : uefi_code:B0_std.Fpath.t -> B0_std.Cmd.t

uefi_drive is a -drive option with uefi_code as read-only flash memory.

Networking parameters

val nic_virtio_net_pci : string

USB devices

See also Drives.

val device_usb_qemu_xhci : unit -> B0_std.Cmd.t

device_usb_qemu_xhci is the -device qemu-xhci. This gives the machine an USB xHCI controller. If the guest as an USB xHCI drivers gives access to USB devices out of the box. See usb_input_devices.

val usb_input_devices : unit -> B0_std.Cmd.t

usb_input_devices () are the usb-kbd and usb-tablet USB devices.

Drives

type drive_device =
  1. | Nvme
    (*

    On Windows this needs no drivers.

    *)
  2. | Sata
    (*

    On Windows this needs no drivers.

    *)
  3. | Sata_cdrom
    (*

    On Windows this needs no drivers.

    *)
  4. | Smb
    (*

    On Windows this needs no drivers.

    *)
  5. | Usb
    (*

    This needs device_usb_qemu_xhci. If the guest has an USB xHCI driver this works out of the box.

    *)
  6. | Usb_cdrom
    (*

    This needs device_usb_qemu_xhci. If the guest has an USB xHCI driver this works out of the box.

    *)
  7. | Virtio_9p_pci
    (*

    I don't think that's supported on Windows.

    *)
  8. | Virtio_blk
    (*

    On Windows this needs the viostor driver.

    *)
  9. | Virtio_scsi
    (*

    On Windows this needs the vioscsi driver.

    *)
  10. | Virtio_scsi_cdrom
    (*

    On Windows this needs the vioscsi driver.

    *)

The type for drives devices.

val drive_devices : drive_device list

drive_devices are all the cases of drive_device.

val drive_device_to_string : drive_device -> string

drive_device_to_string d is a string representation of d.

val drive_device_of_string : string -> (drive_device, string) Stdlib.result

drive_device_of_string s parses back the result of drive_device_to_string.

val drive_device_of_path : B0_std.Fpath.t -> (drive_device option * B0_std.Fpath.t, string) Stdlib.result

drive_of_path p is a drive from p it determines a kind of device by parsing a trailing :DEVICE.

type drive = drive_device * B0_std.Fpath.t

The type for drives a drive device and a path to the disk image.

val choose_drive_devices : use_virtio:bool -> (drive_device option * B0_std.Fpath.t) list -> (drive list, string) Stdlib.result

choose_drive_devices ~use_virtio has the logic to default drive devices. For now this is done on the list because we have the special case for the first drive. This also checks that the paths exists and are files or directories depending on the drive_device and realpath them some of the stuff like smb device doesn't like relative paths.

val drives_cmd : drive list -> B0_std.Cmd.t

drives_cmd is the list of drives attached.

These are specified in boot order. If you need to install on an empty disk image, put it first and the ISO afterwards, it will be skipped by the bootloader before install and picked up afterwards.

Graphics and serial

val device_virtio_gpu_pci : B0_std.Cmd.t

device_virtio_gpu_pci is -device virtio-gpu-pci. On Windows guests this need the viogpudo virtio driver.

val device_ramfb : B0_std.Cmd.t

device_ramfb is -device ramfb. A bit unclear when this is useful.

val no_graphic : B0_std.Cmd.t

no_graphic is -nographic. Only run through the console.

val display_none : B0_std.Cmd.t

display_none is -display none.

val serial : string option -> string

serial arg is an argument for -serial. If unspecified by default this is mon:stdout.

Higher-level

val cmd : guest_arch:B0_std.Os.Arch.t -> mem_size:string option -> use_virtio:bool -> drives:drive list -> graphic:bool -> use_ramfb:bool -> use_usb_input:bool -> (B0_std.Cmd.t, string) Stdlib.result