Vipul Gupta
Vipul is a software engineer at balena and a documentarian running his docs initiative called Mixster. He advocates strongly for open-source, cheesecakes and party parrots.
@vipulgupta2048
Chip shortage. What's that?
@vipulgupta2048
@vipulgupta2048
We-pull
@vipulgupta2048
CO2 sensors, farms, smart dustbins, cars, locks, your room, home devices...
@vipulgupta2048
Underwater drones, satellites, parking, and your talking wireless speakers
@vipulgupta2048
@vipulgupta2048
But, when someone parks their ship the wrong way around...
The world loses their mind ...
And events like these don't help...
@vipulgupta2048
It's also well supported
What really is QEMU? How does it work? How does it accomplish this dark magic?
@vipulgupta2048
And, QEMU can be overwhelming
Like you know you have to go to the 5th floor
... But which staircase will get me to there. No clue.
I am here to help, let's start with
➜ ~ screenfetch
vipulgupta2048@pop-os
OS: Pop 22.04 jammy
Kernel: x86_64 Linux 6.4.6-76060406-generic
##### Uptime: 4h 14m
####### Packages: Unknown
##O#O## Shell: fish 3.6.1
####### Resolution: 1920x1080
########### DE: GNOME 41.4
############# WM: Mutter
############### WM Theme: Sweet
################ GTK Theme: Pop-dark [GTK2/3]
################# Icon Theme: candy-icons-master
##################### Font: Fira Sans Semi-Light 10
##################### Disk: 228G / 307G (79%)
################# CPU: Intel Core i7-10510U @ 8x 800MHz
GPU: Intel Corporation CometLake-U GT2
RAM: 8328MiB / 15623MiB
QEMU emulates specifications, not machines.
Check Virtualization status in the system
➜ egrep -c '(vmx|svm)' /proc/cpuinfo
16
If the value is more than 0, then your system has an Intel VT-x (vmx) processor or AMD-V (svm) processor.
Check if we have the KVM module in the system
➜ lsmod | grep kvm
kvm_intel 528384 0
kvm 1347584 1 kvm_intel
And, we got the KVM modules needed by QEMU when we need it. To be explained more later.
Some important, other optional to install in your distro
qemu-system-aarch64
KVM
bridge-utils
libvirt
qemu-monitor
Disclaimer
Use a GUI if you want to!
Full comparison list of alternatives because it's perfectly fine to use Virt-manager, parallels, VirtualBox, Hyper-V (for Windows)
This is the command to start your RPi Machine
qemu-system-aarch64 -enable-kvm \
-machine raspi3b -cpu cortex-a53 \
-dtb bcm2710-rpi-3-b.dtb \
-m 1G -smp 4 \
-kernel kernel8.img \
-sd ./Downloads/rpi.img \
-append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" \
-device usb-net,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-no-reboot -nographic \
Kernel module used with QEMU to provide direct hardware virtualization and boost performance
qemu-system-aarch64 -enable-kvm \
-machine raspi3b -cpu cortex-a53 \
-m 1G -smp 4 \
-dtb bcm2710-rpi-3-b.dtb \
-kernel kernel8.img \
-sd ./Downloads/rpi.img \
-append "rw earlyprintk loglevel=8 console=ttyAMA0,115200
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" \
-device usb-net,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-no-reboot -nographic \
Specifying machine model, memory allocation & cores
qemu-system-aarch64 -enable-kvm \
-machine raspi3b -cpu cortex-a53 \
-m 1G -smp 4 \
-dtb bcm2710-rpi-3-b.dtb \
-kernel kernel8.img \
-sd ./Downloads/rpi.img \
-append "rw earlyprintk loglevel=8 console=ttyAMA0,115200
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" \
-device usb-net,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-no-reboot -nographic \
Specifying the hardware layout of RPi3, informing QEMU what hardware is available to virtualize.
qemu-system-aarch64 -enable-kvm \
-machine raspi3b -cpu cortex-a53 \
-m 1G -smp 4 \
-dtb bcm2710-rpi-3-b.dtb \
-kernel kernel8.img \
-sd ./Downloads/rpi.img \
-append "rw earlyprintk loglevel=8 console=ttyAMA0,115200
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" \
-device usb-net,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-no-reboot -nographic \
Options to configure network connections with host computer, GUI, and SSH ports
qemu-system-aarch64 -enable-kvm \
-machine raspi3b -cpu cortex-a53 \
-m 1G -smp 4 \
-dtb bcm2710-rpi-3-b.dtb \
-kernel kernel8.img \
-sd ./Downloads/rpi.img \
-append "rw earlyprintk loglevel=8 console=ttyAMA0,115200
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" \
-device usb-net,netdev=net0 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-no-reboot -nographic \
VM1
VM2
VM4
VM3
Autokit
(controller)
Feedback on changes
Developing and testing software
on target architecture
in a CI/CD pipeline
?
QEMU
?
?
?
?
?
?
?
?
?
?
?
Hardware Protoyping
Build software, before hardware gets ready
Testing firmware changes before releases
Testing Operating Systems on virtual devices
Questions? Collaborate? Work with us? Reach out!
Vipul Gupta
Reviews cheesecakes, solves GitHub issues & runs memeservice.
Feedback please + Link to the slides
By Vipul Gupta
In this session, we will focus on the basics of virtualization, and how it differs from emulation, containerization, what is QEMU, and alternatives like KVM & libvirt and more. The talk was presented to folks attending Open Source Summit 2023 in Bilbao, Spain
Vipul is a software engineer at balena and a documentarian running his docs initiative called Mixster. He advocates strongly for open-source, cheesecakes and party parrots.