qemu-init

Some tools to make life with qemu more comfortable

User Tools

Site Tools


Config files
Basic configuration (rc-file)


Advanced configuration

The rc-file covers some basic parameters of qemu only. Some times it is required to add more or different parameters. This could be done with the  <name>-user.cfg  file (further called cfg-file). All options in this file will be passed to  qemu-system-* . The format is  VAR=VALUE , one per line. Line breaks are not allowed, empty lines will be ignored. All in a line after a # will be treated as comment and ignored.

The cfg-file will be read line by line! Thus each line have to be terminated!

The variable names could be freely chosen, but it is recommended to use unique ones overall. The examples below should give an overview how it works.

Ex.1) Replace the  BOOT  variable of the rc-file:

BOOT=
BOOT="$BOOT order=dc,menu=off"
BOOT="$BOOT -no-fd-bootchk"
# add a mouse
USB="-usb -device usb-tablet"

Ex.2) Add some custom options not covered in the rc-file:

BIOS=""
BIOS=$BIOS" -drive if=pflash,format=raw,readonly,file=/usr/local/lib/ovmf-x64/OVMF_CODE-pure-efi.fd"
BIOS=$BIOS" -drive if=pflash,format=raw,file=/tmp/my_vars.fd"
 
GPU="-device vfio-pci,host=01:00.0,multifunction=on,x-vga=on -vga none"
 
C1="-device virtio-scsi-pci,id=scsi"
C2="-drive file=/path/to/pluto.img,snapshot=off,format=qcow2,id=disk,if=none,aio=native,cache=none -device scsi-hd,drive=disk"
 
BALLOON="-device virtio-balloon-pci"

Ex.3) Add (an additional) monitor redirection via unix socket:

CC="-monitor unix:/tmp/pluto.sock,server,nowait"

Comparison of invalid and correct syntax

The following syntax is NOT allowed:

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

It have to be done similar to

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

or

QEMUGA1="-chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0"
QEMUGA2="-device virtio-serial -device virtserialport,chardev=qga0,name=sarge.guest_agent.0"
Last modified: 2020/04/01 09:22

Page Tools