Hello.
I see that you are experienced with qemu-kvm,I want to try to ask you what do you think about what I've got from the project that I've completed,but that does not work.
I've enabled KVM on a more recent kernel version,to be precise on the 5.4.244,on the old ARM Chromebook model xe303c12,following mainly this tutorial :
http://www.virtualopensystems.com/en/solutions/guides/kvm-on-chromebook/
This is how I have achieved the goal (or at least I think that I did) :
I have formatted my sd card following the procedure explained by the v.o.s website.
In the u boot source directory I did :
$ sudo ./scripts/sdcard.sh /dev/sdX
This erased all data and created 4 partitions in the sd-card, along with copying the u-boot binary to the first partition:
-
ChromeOS signed binary (vos chained u-boot)
-
-
EXT2 partition for u-boot files (here I have copied your zImage (converted in uImage and your exynos5250-snow.dtb files). I've got the zip file that you created for me one month ago,here :
https://github.com/quarkscript/linux-armv7-xe303c12-only/files/11615040/5.4.244-kvm.zip
I have decompressed it and I've got the zImage file that was stored inside the deb file.
Since I want to use u-boot,I have converted zImage into uImage using the following command :
mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux kernel" -d zImage uImage
4. EXT4 partition for userspace files. Here I have copied the devuan 4 userland files that I've got here :
https://drive.google.com/u/0/uc?id=1KSgE-3G2GEBzcYhk_JleVYWl6m061GdI&export=download
but I haven't used btrfs fs,but ext4. And I have extended the space on the partition from 1882M to 200 GB.
sudo dd if=nv_uboot-snow.kpart of=/dev/sdX1 (nv_uboot-snow.kpart taken from the vos website)
I wrote a little bash script that executes the command line :
dmesg > /root/Desktop/log
as soon as the desktop environment started. This is the content of the log file :
https://pastebin.ubuntu.com/p/GQ59sqt72v/
I read "kvm: Hyp mode initialized successfully". So I'm sure that kvm is working on the kernel version that I've used (5.4.244),infact :
![Screenshot_2023-08-04_14-50-02-1](https://private-user-images.githubusercontent.com/755339/259849284-f750d945-3476-4a2f-a434-855321a700f1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwMTMyMjQsIm5iZiI6MTcyMDAxMjkyNCwicGF0aCI6Ii83NTUzMzkvMjU5ODQ5Mjg0LWY3NTBkOTQ1LTM0NzYtNGEyZi1hNDM0LTg1NTMyMWE3MDBmMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzAzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcwM1QxMzIyMDRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yOTZlZTQzYzYxYTJmMmIzMmUyYTk0NTI3Yzk4ZTE3MjE5MzE5NDVmOGQwZmIzZjYxOTJkNzZiZjlmMWUyNjI4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.67c5Attgvke2ZluHmn6exwstRVjlrvFdLLY9t2vHfy8)
OK,now let's talk about how to virtualize a GUEST os.
I've installed virt-manager and I tried to create a new virtual machine. With my big surprise,I saw the warning :
KVM is not available. This may mean the KVM package is not installed or the KVM kernel modules are not loaded.
What could be the cause ? KVM seems to be running great. It is detected by kvm-ok and even virt-manager can establish a connection to QEMU / KVM. The qemu version installed is 5.2.0.
I conducted some further experiments :
In this example I've used qemu 5.2.0 installed by default by the devuan 4 :
qemu-system-arm \
-enable-kvm -serial stdio -kernel zImage \
-m 512 -M vexpress-a15 -cpu cortex-a15 \
-drive file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none \
-device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
-device virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55" \
-netdev type=user,id=net0 \
-append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
virtio_mmio.device=1M@0x4e000000:74:0 \
virtio_mmio.device=1M@0x4e100000:75:1 \
root=/dev/vda rw ip=dhcp --no-log"
qemu-system-arm: invalid accelerator kvm.
In this example I've compiled qemu-system-arm on ubuntu 12.04 as described by the vos tutorial and then I've copied the libraries produced on ubuntu 12.04 to the devuan 4 + 5.4 kernel installation :
/12.04/usr/local/bin/./qemu-system-arm \
-enable-kvm -serial stdio -kernel zImage \
-m 512 -M vexpress-a15 -cpu cortex-a15 \
-drive file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none \
-device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
-device virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55" \
-netdev type=user,id=net0 \
-append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
virtio_mmio.device=1M@0x4e000000:74:0 \
virtio_mmio.device=1M@0x4e100000:75:1 \
root=/dev/vda rw ip=dhcp --no-log"
(process:2843): GLib-WARNING **: 14:17:40.742: ../../../glib/gmem.c:497: custom memory allocation vtable not supported
error: kvm run failed Function not implemented
At this point I don't know what to do to enable the kvm acceleration,but I have a vague idea about the reason why it does not work.
The virtual open systems developers says :
The guests that we will create later will be based on the Versatile Express QEMU machine model. For we will use a different kernel branch specific to that platform:
In my opinion :
In the first experiment,KVM does not work because qemu 5.2.0 is too new and / or it is not patched by v.s.o developers.
In the second experiment,KVM does not work because the qemu version used by v.o.s is very old and it is not compatible with the kernel that I'm using, 5.4.244.
My final goal is to virtualize FreeBSD on the ARM Chromebook,but I think that I will never be able to do this. Maybe,with your help I will be able to virtualize Ubuntu. Maybe.
I've also got an answer by Peter Maidell,a very known qemu-kvm developer,which says :
You can't use KVM with the vexpress-a15 board. The only Arm guest machine that will work with KVM is the "virt" board.
Further, it looks like your host CPU is 32-bit. QEMU 5.2 dropped support for running KVM on 32-bit hosts, because this
support was dropped from host kernels in kernel version 5.7. Basically, 32-bit hosts are just too small to do anything
sensible with virtual machines, which is why the kernel (and in turn QEMU) dropped that support. If you want to play
around with Arm virtualization, use a 64-bit host (64-bit hosts can still use KVM to virtualize 32-bit guests if you want
32 bit guests)
I don't know if he read well what I said or if I didn't understand something,BUT :
point 1)
On the virtual open systems website they used the vexpress-a15 board. You can read by yourself what they say :
The guests that we will create later will be based on the Versatile Express QEMU machine model. For we will use a different kernel branch specific to that platform:
$ git checkout origin/kvm-vexpress-3.9
$ curl http://www.virtualopensystems.com/downloads/guides/kvm_on_chromebook/guest-config > .config
$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make zImage dtbs -j4
Then we can append the dtb file to the kernel image with:
$ cat arch/arm/boot/dts/rtsm_ve-cortex_a15x1.dtb >> arch/arm/boot/zImage
That way we only need to handle one file. Make sure to copy arch/arm/boot/zImage for later usage.
point 2)
On the devuan 4 host os that I have installed I'm using kernel 5.4,that's lower than 5.7,so the qemu support for it should be there.
point 3)
I tried -M virt like this :
qemu-system-arm \
-enable-kvm -serial stdio -kernel zImage \
-m 512 -M virt -cpu cortex-a15 \
but I've got the same error : qemu-system-arm: invalid accelerator kvm.