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 =
  1. | Usb of B0_std.Fpath.t
    (*

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

    *)
  2. | Usb_cdrom of B0_std.Fpath.t
    (*

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

    *)
  3. | Virtio_blk of B0_std.Fpath.t
    (*

    On Windows this needs the viostor driver.

    *)
  4. | Virtio_scsi of B0_std.Fpath.t
    (*

    On Windows this needs the vioscsi driver.

    *)
  5. | Virtio_scsi_cdrom of B0_std.Fpath.t
    (*

    On Windows this needs the vioscsi driver.

    *)
  6. | Sata of B0_std.Fpath.t
    (*

    On Windows this needs no drivers.

    *)
  7. | Sata_cdrom of B0_std.Fpath.t
    (*

    On Windows this needs no drivers.

    *)
  8. | Nvme of B0_std.Fpath.t
    (*

    On Windows this needs no drivers.

    *)

The type for drives and the path to their disk image files.

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

drives 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.

Ad-hoc munging logic

val scrape_arch_of_filepath : B0_std.Fpath.t -> B0_std.Os.Arch.t option

scrape_arch_of_filepath file tries to determine an architecture from file by starting from the end of the path.

Higher-level

val cmd : guest_arch:B0_std.Os.Arch.t -> mem:string -> images:B0_std.Fpath.t list -> graphic:bool -> use_usb_drives:bool -> use_nvme_drives:bool -> use_ramfb:bool -> no_virtio:bool -> no_usb_input:bool -> (B0_std.Cmd.t, string) Stdlib.result