The qemu-system-x86_64
command is used to launch a QEMU virtual machine with various settings and devices, including graphics, network, and storage configurations. By combining different options, such as CPU, memory, and device specifications, the command can be customized to create a virtual machine with specific hardware requirements.
qemu-system-x86_64 -vga std -nographic -vnc :1 -enable-kvm -m 3072 -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,$MY_OPTIONS\
-machine pc-q35-2.11 \
-smp 4,cores=2 \
-usb -device usb-kbd -device usb-tablet \
-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \
-drive if=pflash,format=raw,readonly,file=OVMF_CODE.fd \
-drive if=pflash,format=raw,file=OVMF_VARS-1024x768.fd \
-smbios type=2 \
-device ich9-intel-hda -device hda-duplex \
-device ide-drive,bus=ide.2,drive=Clover \
-drive id=Clover,if=none,snapshot=on,format=qcow2,file=./'Mojave/Clover.qcow2' \
-device ide-drive,bus=ide.1,drive=MacHDD \
-drive id=MacHDD,if=none,file=./mac_hdd.img,format=qcow2 \
-device ide-drive,bus=ide.0,drive=MacDVD \
-drive id=MacDVD,if=none,snapshot=on,media=cdrom,file=./'Mojave.iso' \
-netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:AB:F8:B7
#!/bin/bash
QEMU_ARGS=(
# General Options
"-vga" "std"
"-nographic"
"-vnc" ":1"
"-enable-kvm"
"-m" "3072"
"-cpu" "Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,$MY_OPTIONS"
# Machine Options
"-machine" "pc-q35-2.11"
# Multiprocessing Options
"-smp" "4,cores=2"
# Display and Input Options
"-usb"
"-device" "usb-kbd"
"-device" "usb-tablet"
# Apple-Specific Options
"-device" "isa-applesmc,osk=\"ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc\""
# Firmware Options
"-drive" "if=pflash,format=raw,readonly,file=OVMF_CODE.fd"
"-drive" "if=pflash,format=raw,file=OVMF_VARS-1024x768.fd"
# SMBIOS Options
"-smbios" "type=2"
# Audio Options
"-device" "ich9-intel-hda"
"-device" "hda-duplex"
# IDE Drive Options
"-device" "ide-drive,bus=ide.2,drive=Clover"
"-drive" "id=Clover,if=none,snapshot=on,format=qcow2,file='./Mojave/Clover.qcow2'"
"-device" "ide-drive,bus=ide.1,drive=MacHDD"
"-drive" "id=MacHDD,if=none,file='./mac_hdd.img',format=qcow2"
"-device" "ide-drive,bus=ide.0,drive=MacDVD"
"-drive" "id=MacDVD,if=none,snapshot=on,media=cdrom,file='./Mojave.iso'"
# Networking Options
"-netdev" "tap,id=net0,ifname=tap0,script=no,downscript=no"
"-device" "vmxnet3,netdev=net0,id=net0,mac=52:54:00:AB:F8:B7"
)
for arg in "${QEMU_ARGS[@]}"; do
echo "$arg"
done
QEMU System x86_64 Command
This command is used to launch a QEMU virtual machine with various settings and devices.
qemu-system-x86_64
: The QEMU system x86_64 emulator.-vga std
: Use the standard VGA graphics adapter.-nographic
: Do not use the graphical display, but instead use a text console.-vnc :1
: Enable VNC on display 1.-enable-kvm
: Enable the KVM accelerator.-m 3072
: Allocate 3072 MB of RAM to the virtual machine.-cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,$MY_OPTIONS
: Specify the CPU model and features.-machine pc-q35-2.11
: Use the pc-q35-2.11 machine type.-smp 4,cores=2
: Create a virtual machine with 4 CPUs and 2 cores.-usb
: Enable USB support.-device usb-kbd
: Add a virtual USB keyboard.-device usb-tablet
: Add a virtual USB tablet.-device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"
: Add an Apple-specific device with an OSK (Operating System Key) string.-drive if=pflash,format=raw,readonly,file=OVMF_CODE.fd
: Load the OVMF code firmware from a file.-drive if=pflash,format=raw,file=OVMF_VARS-1024x768.fd
: Load the OVMF variables firmware from a file.-smbios type=2
: Set the SMBIOS type to 2 (Desktop).-device ich9-intel-hda
: Add an Intel HDA (High Definition Audio) device.-device hda-duplex
: Add a HDA duplex device.-device ide-drive,bus=ide.2,drive=Clover
: Add an IDE drive with device Clover on bus ide.2.-drive id=Clover,if=none,snapshot=on,format=qcow2,file=./'Mojave/Clover.qcow2'
: Load the Clover drive image from a file.-device ide-drive,bus=ide.1,drive=MacHDD
: Add an IDE drive with device MacHDD on bus ide.1.-drive id=MacHDD,if=none,file=./mac_hdd.img,format=qcow2
: Load the MacHDD drive image from a file.-device ide-drive,bus=ide.0,drive=MacDVD
: Add an IDE drive with device MacDVD on bus ide.0.-drive id=MacDVD,if=none,snapshot=on,media=cdrom,file=./'Mojave.iso'
: Load the MacDVD drive image from a file.-netdev tap,id=net0,ifname=tap0,script=no,downscript=no
: Create a network device with TAP interface.-device vmxnet3,netdev=net0,id=net0,mac=52:54:00:AB:F8:B7
: Add a VMXNET3 network device with MAC address 52:54:00:AB:F8:B7.