Pre-requisites are:
- Kernel with KVM → Covered in other threads
- Updated libSDl2 built from sources
Due to a bug in the libSDL2 library available in 18.04, we need an upgraded version to be built from sources.
Download the libSDL2 sources of 19.04 from here:
https://launchpad.net/ubuntu/+source/libsdl2/2.0.9+dfsg1-1ubuntu1.19.04.1
Download the file:
libsdl2_2.0.9+dfsg1.orig.tar.xz
Extract and build:
sudo apt-get build-dep libsdl2-2.0-0
./configure
make
sudo make install
- Latest qemu built from sources (so as to enable virglrenderer)
Ensure you have all dependencies of the qemu configuration installed including the libvirglrenderer0 and libvirglrenderer-dev
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
./configure --target-list=aarch64-softmmu --enable-kvm --enable-sdl --enable-gtk --enable-virglrenderer --enable-opengl --enable-tools
Now the main hints I got from this post:
https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/
In that post, kvm is not used and the version of debian used is “jessie”. I updated it to “buster” and used kvm. Here is the installation command for a command line install and console only installation (don’t select any desktop environment during install)
Non-GUI Install
…/qemu/build/qemu-system-aarch64 -M virt -m 2048 -smp 2 -cpu host,aarch64=off -enable-kvm
-kernel installer-vmlinuz
-initrd installer-initrd.gz
-drive if=none,file=hda.qcow2,format=qcow2,id=hd
-device virtio-blk-device,drive=hd
-netdev user,id=mynet
-device virtio-net-device,netdev=mynet
-nographic -no-reboot
Now an easy way to extract the kernel and initrd is given here:
https://gist.github.com/shamil/62935d9b456a6f9877b5
use the partx command to mount individual partitions
To run the VM its the same command line except that the kernel and initrd is replaced by vmlinuz-4.19.0-14-armmp-lpae and initrd.img-4.19.0-14-armmp-lpae which are copied and additional qemu parameter of -append ‘root=/dev/vda2’
GUI-Install (use a 10G qcow2 image):
For GUI we need to use the EFI EDK2 BIOS which is provided in the qemu sources.
Look in foder pc-bios for the file edk2-arm-code.fd.bz2. Extract the edk2-arm-code.fd from it.
Command line for installation is as follows:
The -serial stdio is optional really (only to get and additional serial terminal)
…/…/qemu/build/qemu-system-aarch64 -M virt -m 2048 -smp 2 -cpu host,aarch64=off -enable-kvm
-kernel installer-vmlinuz -initrd installer-initrd.gz
-device usb-ehci -device usb-kbd -device usb-mouse -usb -serial stdio
-device virtio-gpu-pci,virgl=on,xres=1600,yres=900 -display sdl,gl=on
-drive if=none,file=hda2.qcow2,format=qcow2,id=hd
-device virtio-blk-device,drive=hd -netdev user,id=mynet
-device virtio-net-device,netdev=mynet
-bios edk2-arm-code.fd -no-reboot
Install an Xfce desktop for minimal resources.
Again running the changes required are as shown below
-kernel vmlinuz-4.19.0-14-armmp-lpae -initrd initrd.img-4.19.0-14-armmp-lpae -append ‘root=/dev/vda2’ \