Hello to everyone.

This will be a long and high technical post about a nice toy that comes
back from the past. So,keep ready to brush up some old knowledge.

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:



   1.

   ChromeOS signed binary (vos chained u-boot)
   2.

   Partition 2 not used
   3.

   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



   1.

   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 (kde 5). 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 :


[image: r/qemu_kvm - Invalid accelerator kvm / error: kvm run failed
Function not implemented ERRORS trying to virtualize a guest OS on the ARM
Chromebook running with a relatively recent kernel version and KVM enabled]
<https://preview.redd.it/16v71vcg4bhb1.png?width=1366&format=png&auto=webp&s=e2a412d999e44407b3f1c7d6e963f97eaa47fc48>


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 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.

So,please help me. Very thanks.


-- 
Mario.

Reply via email to