mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
up
This commit is contained in:
parent
67686fcada
commit
a574a3e737
101 changed files with 1344 additions and 527 deletions
111
quickemu
111
quickemu
|
@ -31,7 +31,7 @@ function ignore_msrs_alert() {
|
|||
echo
|
||||
echo " If you are unable to run macOS or Windows VMs then run the above 👆"
|
||||
echo " This will enable ignoring of unhandled MSRs until you reboot the host."
|
||||
echo " You can make this change permenant by running: 'quickemu --ignore-msrs-always'"
|
||||
echo " You can make this change permanent by running: 'quickemu --ignore-msrs-always'"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -235,6 +235,7 @@ function vm_boot() {
|
|||
local MAC_DISK_DEV="${MAC_DISK_DEV:-ide-hd,bus=ahci.2}"
|
||||
local NET_DEVICE="${NET_DEVICE:-virtio-net}"
|
||||
local OSK=""
|
||||
local SOUND=""
|
||||
local SMM="${SMM:-off}"
|
||||
local USB_HOST_PASSTHROUGH_CONTROLLER="qemu-xhci"
|
||||
local VGA=""
|
||||
|
@ -304,8 +305,8 @@ function vm_boot() {
|
|||
GUEST_CPU_THREADS=1
|
||||
GUEST_CPU_LOGICAL_CORES=${GUEST_CPU_CORES}
|
||||
fi
|
||||
local SMP="-smp cores=4,threads=1,sockets=1"
|
||||
#local SMP="-smp cores=${GUEST_CPU_LOGICAL_CORES},threads=${GUEST_CPU_THREADS},sockets=${HOST_CPU_SOCKETS}"
|
||||
|
||||
local SMP="-smp cores=${GUEST_CPU_LOGICAL_CORES},threads=${GUEST_CPU_THREADS},sockets=${HOST_CPU_SOCKETS}"
|
||||
echo " - CPU: ${HOST_CPU_MODEL}"
|
||||
echo -n " - CPU VM: ${HOST_CPU_SOCKETS} Socket(s), ${GUEST_CPU_LOGICAL_CORES} Core(s), ${GUEST_CPU_THREADS} Thread(s)"
|
||||
|
||||
|
@ -351,6 +352,9 @@ function vm_boot() {
|
|||
if [ -e "${VMDIR}/OVMF_CODE.fd" ] && [ -e "${VMDIR}/OVMF_VARS-1024x768.fd" ]; then
|
||||
EFI_CODE="${VMDIR}/OVMF_CODE.fd"
|
||||
EFI_VARS="${VMDIR}/OVMF_VARS-1024x768.fd"
|
||||
elif [ -e "${VMDIR}/OVMF_CODE.fd" ] && [ -e "${VMDIR}/OVMF_VARS-1920x1080.fd" ]; then
|
||||
EFI_CODE="${VMDIR}/OVMF_CODE.fd"
|
||||
EFI_VARS="${VMDIR}/OVMF_VARS-1920x1080.fd"
|
||||
else
|
||||
MAC_MISSING="Firmware"
|
||||
fi
|
||||
|
@ -468,7 +472,7 @@ function vm_boot() {
|
|||
|
||||
# Make any OS specific adjustments
|
||||
case ${guest_os} in
|
||||
batocera|*bsd|freedos|haiku|linux)
|
||||
batocera|*bsd|freedos|haiku|linux|*solaris)
|
||||
CPU="-cpu host,kvm=on"
|
||||
if [ "${HOST_CPU_VENDOR}" == "AuthenticAMD" ]; then
|
||||
CPU="${CPU},topoext"
|
||||
|
@ -484,6 +488,13 @@ function vm_boot() {
|
|||
if [ "${guest_os}" == "freedos" ] ; then
|
||||
# fix for #382
|
||||
SMM="on"
|
||||
SOUND_CARD="sb16"
|
||||
fi
|
||||
|
||||
if [[ "${guest_os}" == *"solaris" ]]; then
|
||||
MACHINE_TYPE="pc"
|
||||
USB_CONTROLLER="xhci"
|
||||
SOUND_CARD="ac97"
|
||||
fi
|
||||
|
||||
if [ -z "${disk_size}" ]; then
|
||||
|
@ -511,7 +522,7 @@ function vm_boot() {
|
|||
case ${macos_release} in
|
||||
ventura)
|
||||
if check_cpu_flag sse4_1 && check_cpu_flag avx2; then
|
||||
CPU="-cpu Haswell,vendor=GenuineIntel,kvm=on,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,+xsavec,+xgetbv1,+avx2,+bmi2,+smep,+bmi1,+fma,+movbe,+invtsc,+avx2"
|
||||
CPU="-cpu Haswell,kvm=on,vendor=GenuineIntel,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,+xsavec,+xgetbv1,+avx2,+bmi2,+smep,+bmi1,+fma,+movbe,+invtsc,+avx2"
|
||||
else
|
||||
echo "ERROR! macOS ${macos_release} requires a CPU with SSE 4.1 and AVX2 support."
|
||||
exit 1
|
||||
|
@ -677,32 +688,33 @@ function vm_boot() {
|
|||
local X_RES=1152
|
||||
local Y_RES=648
|
||||
if [ "${XDG_SESSION_TYPE}" == "x11" ]; then
|
||||
local LOWEST_WIDTH=""
|
||||
if [ -z "${SCREEN}" ]; then
|
||||
LOWEST_WIDTH=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f1 | sort | head -n1)
|
||||
X_RES=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f1 | sort | head -n1)
|
||||
Y_RES=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f2 | cut -d'x' -f2 | sort | head -n1)
|
||||
else
|
||||
LOWEST_WIDTH=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f1 | head -n1)
|
||||
X_RES=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f1 | head -n1)
|
||||
Y_RES=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f2 | cut -d'x' -f2 | head -n1)
|
||||
fi
|
||||
|
||||
if [ "${FULLSCREEN}" ]; then
|
||||
if [ -z "${SCREEN}" ]; then
|
||||
X_RES=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f1 | sort | head -n1)
|
||||
Y_RES=$(xrandr --listmonitors | grep -v Monitors | cut -d' ' -f4 | cut -d'/' -f2 | cut -d'x' -f2 | sort | head -n1)
|
||||
else
|
||||
X_RES=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f1 | head -n1)
|
||||
Y_RES=$(xrandr --listmonitors | grep -v Monitors | grep "^ ${SCREEN}:" | cut -d' ' -f4 | cut -d'/' -f2 | cut -d'x' -f2 | head -n1)
|
||||
fi
|
||||
elif [ "${LOWEST_WIDTH}" -ge 3840 ]; then
|
||||
:
|
||||
elif [ "${SCREENPCT}" ] ; then
|
||||
X_RES=$(( X_RES*SCREENPCT/100 ))
|
||||
Y_RES=$(( Y_RES*SCREENPCT/100 ))
|
||||
elif [ "${X_RES}" -ge 3840 ]; then
|
||||
X_RES=3200
|
||||
Y_RES=1800
|
||||
elif [ "${LOWEST_WIDTH}" -ge 2560 ]; then
|
||||
elif [ "${X_RES}" -ge 2560 ]; then
|
||||
X_RES=2048
|
||||
Y_RES=1152
|
||||
elif [ "${LOWEST_WIDTH}" -ge 1920 ]; then
|
||||
elif [ "${X_RES}" -ge 1920 ]; then
|
||||
X_RES=1664
|
||||
Y_RES=936
|
||||
elif [ "${LOWEST_WIDTH}" -ge 1280 ]; then
|
||||
elif [ "${X_RES}" -ge 1280 ]; then
|
||||
X_RES=1152
|
||||
Y_RES=648
|
||||
else
|
||||
:
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -726,6 +738,8 @@ function vm_boot() {
|
|||
gtk|none|spice) DISPLAY_DEVICE="qxl-vga";;
|
||||
sdl|spice-app) DISPLAY_DEVICE="virtio-vga";;
|
||||
esac
|
||||
elif [ "${guest_os}" == "solaris" ]; then
|
||||
DISPLAY_DEVICE="vmware-svga"
|
||||
else
|
||||
DISPLAY_DEVICE="qxl-vga"
|
||||
fi
|
||||
|
@ -763,7 +777,7 @@ function vm_boot() {
|
|||
case ${DISPLAY_DEVICE} in
|
||||
bochs-display) VIDEO="${VIDEO},vgamem=67108864";;
|
||||
qxl|qxl-vga) VIDEO="${VIDEO},ram_size=65536,vram_size=65536,vgamem_mb=64";;
|
||||
ati-vga|cirrus-vga|VGA) VIDEO="${VIDEO},vgamem_mb=64";;
|
||||
ati-vga|cirrus-vga|VGA|vmware-svga) VIDEO="${VIDEO},vgamem_mb=64";;
|
||||
esac
|
||||
|
||||
# Configure multiscreen if max_outputs was provided in the .conf file
|
||||
|
@ -781,6 +795,16 @@ function vm_boot() {
|
|||
# Add fullscreen options
|
||||
VIDEO="${VGA} ${VIDEO} ${FULLSCREEN}"
|
||||
|
||||
# Build the sound hardware configuration
|
||||
if [ "${SOUND_CARD}" == "intel-hda" ]; then
|
||||
SOUND="-device intel-hda -device hda-duplex,audiodev=audio0"
|
||||
elif [ "${SOUND_CARD}" == "ac97" ] || [ "${SOUND_CARD}" == "es1370" ] || [ "${SOUND_CARD}" == "sb16" ]; then
|
||||
SOUND="-device ${SOUND_CARD},audiodev=audio0"
|
||||
elif [ "${SOUND_CARD}" == "none" ]; then
|
||||
SOUND=""
|
||||
fi
|
||||
echo " - Sound: ${SOUND_CARD}"
|
||||
|
||||
# Set the hostname of the VM
|
||||
local NET="user,hostname=${VMNAME}"
|
||||
|
||||
|
@ -909,7 +933,7 @@ function vm_boot() {
|
|||
-m ${RAM_VM} ${BALLOON}
|
||||
${VIDEO} -display ${DISPLAY_RENDER}
|
||||
-audiodev ${AUDIO_DEV}
|
||||
-device intel-hda -device hda-duplex,audiodev=audio0
|
||||
${SOUND}
|
||||
-rtc base=localtime,clock=host,driftfix=slew)
|
||||
|
||||
# Only enable SPICE is using SPICE display
|
||||
|
@ -1002,7 +1026,7 @@ function vm_boot() {
|
|||
fi
|
||||
|
||||
if [ "${network}" == "none" ]; then
|
||||
# Disbale all networking
|
||||
# Disable all networking
|
||||
echo " - Network: Disabled"
|
||||
args+=(-nic none)
|
||||
elif [ "${network}" == "restrict" ]; then
|
||||
|
@ -1229,6 +1253,7 @@ function vm_boot() {
|
|||
sdl) export SDL_MOUSE_FOCUS_CLICKTHROUGH=1;;
|
||||
esac
|
||||
echo "${QEMU}" "${SHELL_ARGS}" >> "${VMDIR}/${VMNAME}.sh"
|
||||
sed -i -e 's/ -/ \\\n -/g' "${VMDIR}/${VMNAME}.sh"
|
||||
${QEMU} "${args[@]}" > "${VMDIR}/${VMNAME}.log" &
|
||||
sleep 0.25
|
||||
fi
|
||||
|
@ -1308,6 +1333,7 @@ function usage() {
|
|||
echo " --fullscreen : Starts VM in full screen mode (Ctl+Alt+f to exit)"
|
||||
echo " --ignore-msrs-always : Configure KVM to always ignore unhandled machine-specific registers"
|
||||
echo " --screen <screen> : Use specified screen to determine the window size."
|
||||
echo " --screenpct <percent> : Percent of fullscreen for VM if --fullscreen is not specified."
|
||||
echo " --shortcut : Create a desktop shortcut"
|
||||
echo " --snapshot apply <tag> : Apply/restore a snapshot."
|
||||
echo " --snapshot create <tag> : Create a snapshot."
|
||||
|
@ -1317,7 +1343,7 @@ function usage() {
|
|||
echo " --viewer <viewer> : Choose an alternative viewer. @Options: 'spicy' (default), 'remote-viewer', 'none'"
|
||||
echo " --ssh-port <port> : Set ssh-port manually"
|
||||
echo " --spice-port <port> : Set spice-port manually"
|
||||
echo " --public-dir <path> : expose share directory. @Options: '' (default: xdg-user-dir PUBLICSHARE), '<directory>', 'none'"
|
||||
echo " --public-dir <path> : Expose share directory. @Options: '' (default: xdg-user-dir PUBLICSHARE), '<directory>', 'none'"
|
||||
echo " --monitor <type> : Set monitor connection type. @Options: 'socket' (default), 'telnet', 'none'"
|
||||
echo " --monitor-telnet-host <ip/host> : Set telnet host for monitor. (default: 'localhost')"
|
||||
echo " --monitor-telnet-port <port> : Set telnet port for monitor. (default: '4440')"
|
||||
|
@ -1329,6 +1355,7 @@ function usage() {
|
|||
echo " --keyboard_layout <layout> : Set keyboard layout."
|
||||
echo " --mouse <type> : Set mouse. @Options: 'tablet' (default), 'ps2', 'usb', 'virtio'"
|
||||
echo " --usb-controller <type> : Set usb-controller. @Options: 'ehci' (default), 'xhci', 'none'"
|
||||
echo " --sound-card <type> : Set sound card. @Options: 'intel-hda' (default), 'ac97', 'es1370', 'sb16', 'none'"
|
||||
echo " --extra_args <arguments> : Pass additional arguments to qemu"
|
||||
echo " --version : Print version"
|
||||
exit 1
|
||||
|
@ -1341,6 +1368,13 @@ function display_param_check() {
|
|||
fi
|
||||
}
|
||||
|
||||
function sound_card_param_check() {
|
||||
if [ "${SOUND_CARD}" != "intel-hda" ] && [ "${SOUND_CARD}" != "ac97" ] && [ "${SOUND_CARD}" != "es1370" ] && [ "${SOUND_CARD}" != "sb16" ] && [ "${SOUND_CARD}" != "none" ]; then
|
||||
echo "ERROR! Requested sound card '${SOUND_CARD}' is not recognised."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function viewer_param_check() {
|
||||
if [ "${VIEWER}" != "none" ] && [ "${VIEWER}" != "spicy" ] && [ "${VIEWER}" != "remote-viewer" ]; then
|
||||
echo "ERROR! Requested viewer '${VIEWER}' is not recognised."
|
||||
|
@ -1461,6 +1495,8 @@ keyboard="usb"
|
|||
keyboard_layout="en-us"
|
||||
# options: ps2, usb, tablet, virtio
|
||||
mouse="tablet"
|
||||
# options: intel-hda, ac97, es1370, sb16, none
|
||||
sound_card="intel-hda"
|
||||
|
||||
BRAILLE=""
|
||||
DELETE_DISK=0
|
||||
|
@ -1472,6 +1508,7 @@ PUBLIC=""
|
|||
PUBLIC_PERMS=""
|
||||
PUBLIC_TAG=""
|
||||
SCREEN=""
|
||||
SCREENPCT=""
|
||||
SHORTCUT=0
|
||||
SNAPSHOT_ACTION=""
|
||||
SNAPSHOT_TAG=""
|
||||
|
@ -1498,11 +1535,12 @@ KEYBOARD_LAYOUT=""
|
|||
MOUSE=""
|
||||
USB_CONTROLLER=""
|
||||
EXTRA_ARGS=""
|
||||
SOUND_CARD=""
|
||||
|
||||
# shellcheck disable=SC2155
|
||||
readonly LAUNCHER=$(basename "${0}")
|
||||
readonly DISK_MIN_SIZE=$((197632 * 8))
|
||||
readonly VERSION="4.6"
|
||||
readonly VERSION="4.8"
|
||||
|
||||
# TODO: Make this run the native architecture binary
|
||||
QEMU=$(command -v qemu-system-x86_64)
|
||||
|
@ -1551,6 +1589,22 @@ else
|
|||
SCREEN="${2}"
|
||||
shift
|
||||
shift;;
|
||||
-screenpct|--screenpct)
|
||||
if [ ! -z "${2##*[!0-9]*}" ] ; then
|
||||
if [[ ${2} -ge 25 && ${2} -lt 100 ]] ; then
|
||||
SCREENPCT=${2}
|
||||
else
|
||||
echo "screenpct invalid must be 25 <= pct < 100"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "screenpct needs to be an integer in range 25 <= pct < 100"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
shift
|
||||
shift;;
|
||||
-snapshot|--snapshot)
|
||||
SNAPSHOT_ACTION="${2}"
|
||||
if [ -z "${SNAPSHOT_ACTION}" ]; then
|
||||
|
@ -1635,6 +1689,10 @@ else
|
|||
EXTRA_ARGS="${2}"
|
||||
shift;
|
||||
shift;;
|
||||
-sound-card|--sound-card)
|
||||
SOUND_CARD="${2}"
|
||||
shift;
|
||||
shift;;
|
||||
-version|--version)
|
||||
echo "${VERSION}"
|
||||
exit;;
|
||||
|
@ -1737,6 +1795,11 @@ if [ -n "${VM}" ] && [ -e "${VM}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${SOUND_CARD}" ]; then
|
||||
SOUND_CARD="${sound_card}"
|
||||
fi
|
||||
sound_card_param_check
|
||||
|
||||
# Check if vm is already run
|
||||
VM_PID=0
|
||||
VM_UP=0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue