Skip to content

Instantly share code, notes, and snippets.

@alex-pat
Created January 26, 2018 08:28
Show Gist options
  • Save alex-pat/6e4aedf94eab926a74bd3b9c4074e1d4 to your computer and use it in GitHub Desktop.
Save alex-pat/6e4aedf94eab926a74bd3b9c4074e1d4 to your computer and use it in GitHub Desktop.
Run qemu
qstrt() {
if [ "$1" == "help" ]; then
echo 'qstrt <kernel> <image> [gui [nokvm]]'
return
fi
local _QEMGUI="-nographic"
local _QEMCON="console=ttyS0"
local _QEMKVM="-enable-kvm"
if [ "$3" == "gui" ]; then
_QEMGUI=""
_QEMCON=""
fi
test "$4" == "nokvm" && _QEMKVM=""
xhost + >/dev/null
sudo qemu-system-x86_64 -kernel "$1" \
-drive file="$2",index=0,media=disk,format=raw \
-append "root=/dev/sda single $_QEMCON" \
$_QEMKVM $_QEMGUI
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment