Overview: files
Basic configuration (rc-file)        man page of qemu-init(5)


Advanced configuration (cfg-file)

The cfg-file overwrites or extends qemu options not covered or not set in the rc-file. The format is flexible to a great possible extent. However, the following requirements are set by convention and have to be met:

qemu-init parses the cfg-file and builds a string which will be appended to  qemu-system-* . The option handling - overwrite or accumulate - will be done by qemu. The recommended way is to define qemu options with required parameters:

Example 1)

-device virtio-scsi-pci,id=scsi
-drive file=/path/to/<name>.img,snapshot=off,format=qcow2,id=disk,if=none,aio=native,cache=none
-device scsi-hd,drive=disk -device virtio-balloon-pci

This format could be used with qemu's  -readconfig </path/to/cfg-file option too.


The second format is to use a bourne shell compatible script style. This is similar to put a qemu command in a script file to start a virtual machine:

Example 2) All what could be used in a script:

#!/bin/sh
QEMU_AUDIO_DRV=alsa

# qga socket
QEMUGA="-chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 \
-device virtio-serial \
-device virtserialport,chardev=qga0,name=<name>.guest_agent.0"

# define boot parameter
BOOT=""
BOOT="-boot"
BOOT="$BOOT order=dc,menu=off"
BOOT="$BOOT -no-fd-bootchk"
RTC="-rtc base=localtime $BOOT"
# now build the command
qemu-system-x86_64 -cpu host \
-rtc base=localtime $QEMUGA $RTC

This is and could be an introduction of the cfg-file only. Variations1) are possible as well a mix of the formats. The qemu-init command line could be validated with  qemu-adm –config <name> .

1)
this could break the script to be used at the command prompt