termux-packages
termux-packages copied to clipboard
[Package]: crosvm
Why is it worth to add this package?
Snapdragon 8 Gen 2 and higher processors support a new hypervisor called Gunyah
:/data/data/com.termux/files/home # uname -a Linux localhost 5.15.94-android13-8-27940245-abX916BXXU1BWK6 #1 SMP PREEMPT Wed Nov 15 07:38:57 UTC 2023 aarch64 Toybox :/data/data/com.termux/files/home # ls -l /dev/gunyah crw------- 1 root root 10, 121 2022-08-14 08:12 /dev/gunyah
but qemu does not support this hypervisor. Qualcomm worked with crosvm. It would be amazing to run VMs at hypervisor speeds using crosvm on these processors.
Home page URL
https://crosvm.dev/
Source code URL
https://github.com/google/crosvm
Packaging policy acknowledgement
- [X] I certify that I have read Termux Packaging Policy and understand that my request will be denied in case of violation.
Additional information
No response
AFAIK for this you must rebuild kernel with KVM support. That is a nogo. @licy183 what do you think?
No, I don't think so, it uses Gunyah instead of KVM https://developer.qualcomm.com/blog/gunyah-hypervisor-software-supporting-protected-vms-android-virtualization-framework I am not really an expert, I am just looking for ways to run VMs efficiently
crosvm repo contains a few Gunyah mentions. Maybe it can work.
Emmm... It may work but I'm afraid that it needs root permission.
According to this: https://github.com/quic/gunyah-hypervisor/issues/24 It's probaby not supported on mobile phones CPUs, so you may close this. You might understand better than me what they ar talking about and better decide.
hmm there are two components. This SM8550 chip is fairly new (newer then the sc8280xp I'm typing on), and /dev/gunyah means its gunyah-aware in the sense that it may interact with it. Gunyah itself neeeds to be loaded from the boot rom before Android even starts. So Android is a guest of Gunyah (they call it PVM, primary-os virtual machine). But only if this tablet is shipped with it. Gunyah is also fairly new. My attempts with Gunyah were trying out the x86 quemu demonstrator (this worked here), and integrating the gunyah patches into my kernel. But, since my device didn't have Gunyah running from the rom, no effect. Would be containers (docker, lxd) enough for what you have in mind?
hmm there are two components. This SM8550 chip is fairly new (newer then the sc8280xp I'm typing on), and /dev/gunyah means its gunyah-aware in the sense that it may interact with it. Gunyah itself neeeds to be loaded from the boot rom before Android even starts. So Android is a guest of Gunyah (they call it PVM, primary-os virtual machine). But only if this tablet is shipped with it. Gunyah is also fairly new. My attempts with Gunyah were trying out the x86 quemu demonstrator (this worked here), and integrating the gunyah patches into my kernel. But, since my device didn't have Gunyah running from the rom, no effect. Would be containers (docker, lxd) enough for what you have in mind?
My wish is to run an arm64 Linux VM (ideally RedHat) using hardware acceleration. For now I am using qemu with the option -tcg If anyone knows something better please let me know, I will be grateful.
I have Snapdragon 8 generation 3 and I also have this file in /dev. It seems to me that if we gave termux virtualization permissions via adb, we would be able to run the VM on the phone.
The main difference I see between this and termux or containers is the ability to redirect phone components, e.g. USB. Termux enables USB but it doesn't work as well as with virtualization.
A little more about this hypervisor https://youtu.be/hLdUCrlheKg?si=MrocW4lCtN3n3bSg
No update regarding this I pressume as I don't see any mention or changelog. This could be a really nice addition, I am really dumbfound that there is nothing out yet that uses gunyah as even modern Samsung devices seem to have it enabled by default.
AFAIK for this you must rebuild kernel with KVM support. That is a nogo. @licy183 what do you think?
In the current android kernel, the KVM module is enabled by default(GKI). But unfortunately, it requires the linux kernel be loaded into EL2, and currently both Qualcomm and Mediatek loads kernel into EL1 instead of EL2.
So it's impossible to enable KVM at Qualcomm/Mediatek chip(even with unlocked bootloader).
But since 8Gn2 and 8Gen3, Qualcomm loads Gunyah into the EL2, and the linux kernel in EL1 can communicate with Gunyah to request it to create another VM in EL1.
In this case, crosvm is just a userspace client can communicate to gunyah driver to create vm, it's reasonable to me to add crosvm to termux package.