Qemu
por Miguel Teixeira
Tenho usado tanto pessoalmente como profissionalmente. Devido à magnitude dos docs, decidi começar a minha própria cheat sheet.
Nunca te esqueças que a qualquer flag addicional, o velho help providencia todas as opções.
Install
On ubuntu
sudo apt install qemu
On arch
sudo pacman -Sy qemu-full
Everywhere
brew install qemu
Desktop
Create an image
sudo qemu-img create -f qcow2 /var/lib/libvirt/images/yournamehereforvirtaccess.qcow2 20G
Run your image with cdrom on first boot
sudo qemu-system-x86_64 # Newer pc’s only
-enable-kvm # Not sure but speed
-m 4G # Ram
-smp 4 # The number of cores
-boot menu=on # Good to have when kernel breaks
-drive file=/var/lib/libvirt/images/your_imagecreated.qcow2 # Get your images here for GUI access with VirtMan
-cpu host # For the cpu config to match the host’s
-vga virtio -display sdl,gl=on # Sauce: Denshi for this one
-soundhw hda # Audio driver should match the host
-cdrom /Documents/Isos/ # Your boot Iso
And just remove -cdrom
sudo qemu-system-x86_64 -enable-kvm -m 4G -smp 4 -boot menu=on -drive file=/var/lib/libvirt/images/your_imagecreated.qcow2 -cpu host -vga virtio -display sdl,gl=on
Be sure to not pick Weyland but instead choose Xorg on the Session Menu. Results in less crashes.
Android stuff
As of writing this there are currently 2 emulator in sdk’s:
- sdk/tools/emulator
- sdk/emulator/emulator
How to list your devices
“$ANDROID_HOME”/emulator/emulator -list-avds
As far as setting your local env, order here is important:
export ANDROID_HOME=~/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=:$PATH:~/Library/Android/sdk/platform-tools export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/tools export ANDROID_SDK_ROOT=~/Library/Android/sdk export ANDROID_AVD_HOME=~/.android/avd
At least when running on emulators, avd is faster at booting.
To run on a single, faster emulation be sure to select the /emulator/emulator Eg:
“$ANDROID_HOME”/emulator/emulator -avd “Nexus_5X_API_28” -gpu on -memory 2500