gunyah-hypervisor icon indicating copy to clipboard operation
gunyah-hypervisor copied to clipboard

can I use this on rooted Galaxy Tab S9 Ultra

Open codrutpopescu opened this issue 1 year ago • 21 comments

The CPU is Snapdragon 8 Gen 2 and the Tab S9 Ultra has 16 GB of memory. I am trying to find ways to use this device to run VMs. I would like to use Gunyah but I don't know how to install it.

codrutpopescu avatar Feb 10 '24 18:02 codrutpopescu

Try slbounce?

jglathe avatar Feb 27 '24 16:02 jglathe

Try slbounce?

slbounce won't work on SD8G2 because hypervisor does not support secure-launch feature. Qualcomm implements this feature in X Elite hyp(also gunyah) As far as I can see it... codes in this repo are more likely for simulator platform...? Gunyah on qualcomm phones are more likely for secure use case and needs signature to load a vm.

sunflower2333 avatar Feb 29 '24 17:02 sunflower2333

SD8G2 (SC8180XP) boots WoA, though. So... thats what's needed for slbounce. At least worth a try. I have a Volterra running on EL2 this way.

jglathe avatar Feb 29 '24 20:02 jglathe

SD8G2 here is SM8550 Mobile Platform, not SC8180XP or 8cx gen2 Compute Platform... On sc8180 and sc8280 their hyp is still QHEE based which already has secure-launch feature. (that means you can use slbounce get EL2, or windows can get hyper-v). On platform Lahaina(SMx3xx, e.g. SM8350, SM7325) and newer, Qcom starts using Gunyah to replace their QHEE. But they did not port secure-launch feature for that(which means you can not use slbounce to get EL2). They didn't add this feature until the SC8380(also known as the X Elite or x1e80100)'s hyp. (By the way, not only SM8550's hyp does not support , but SM8650'hyp also does not support this feature.)

On this topic, you can not replace hypervisor on your phone because it need qcom's signature. You can use Qemu to run it on your rooted Galaxy Table S9 Ultra.

sunflower2333 avatar Mar 01 '24 01:03 sunflower2333

Thanks for pointing that out, my bad.

jglathe avatar Mar 01 '24 05:03 jglathe

Thanks for clarifying! So the only option currently available for SM8550 is to compile the kernel with KVM support and use QEMU?

codrutpopescu avatar Mar 01 '24 05:03 codrutpopescu

Thanks for pointing that out, my bad.

Sorry i'm not sure with crosvm... iirc someone tried the linux patch on sm8550 and seems can not get it work properly...

sunflower2333 avatar Mar 01 '24 05:03 sunflower2333

Unfortunately I cannot help but I would like to second this issue. I am trying to enable either KVM or Gunyah on my Galaxy Tab S8 Ultra to be able to run Windows on Arm virtual machines with hardware acceleration.

Famous8 avatar Mar 05 '24 03:03 Famous8

Upon looking at the Galaxy Tab S8 kernel source code, it seems KVM and Gunyah are enabled in the GKI (General Kernel Image), however I am receiving many errors when trying to compile the unchanged source code of the kernel using the provided materials. I will let you know if I am able to flash the GKI successfully and be able to use KVM.

Famous8 avatar Mar 10 '24 00:03 Famous8

I have a Tab s9 and on the stock kernel I tried this in root shell via termux

apex/com.android.virt/bin/crosvm --log-level=debug run "/data/data/com.termux/files/home/vm2/vmlinux"                                                                             <
[2024-03-23T00:49:49.735761079+05:30 INFO  crosvm] crosvm started.
[2024-03-23T00:49:49.736413214+05:30 INFO  crosvm] CLI arguments parsed.
[2024-03-23T00:49:49.736705610+05:30 DEBUG crosvm::crosvm::sys::unix] creating hypervisor: Gunyah { device: Some("/dev/gunyah") }
[2024-03-23T00:49:49.737004256+05:30 ERROR crosvm] exiting with error 1: failed to create vm

Caused by:
    Invalid argument (os error 22)

Still debugging, but so far looks like its having trouble starting the kernel or crosvm is having issues with gunyah. Will update

subashsn avatar Mar 22 '24 19:03 subashsn

I was still never able to get a kernel image working. Each time a boot loop appeared. Perhaps I need to factory reset the operating system before installing a kernel. I think KVM maybe able to work as it is enabled in the GKI

Famous8 avatar Mar 22 '24 19:03 Famous8

I tried the android13-5.15 GKI and it worked, higher versions didn't boot. But still didn't see a /dev/kvm. So I think we only have gunyah for now, which is fine as they seem to have done everything needed for it to be in AVF and work with crosvm too.

I think the error is actually related to the kernel image I am using to start crosvm, will dig more and keep you posted.

A description of my setup:

  • Voltage 14 GSI (Rooted with Magisk)
  • Latest samsung kernel (android13-5.15)
  • Termux (with root shell)

Update:

  • tried --disable-sandbox - Didn't help
  • tried using all sorts of vmlinuz / vmlinux / Image didn't help

subashsn avatar Mar 22 '24 19:03 subashsn

I downloaded the open source Android 14 kernels for the Tab S8 Ultra from Samsung's website and tried to compile it but my tablet went into a boot loop, so I had to revert back to the previous kernel. I'm just running stock firmware, rooted by Magisk, alongside the stock kernel, which is Android 12.

Famous8 avatar Mar 22 '24 19:03 Famous8

Tried cat /dev/gunyah and got this cat: /dev/gunyah: Invalid argument

Looks like this is where the below error comes from i.e when crosvm tries to use gunyah

apex/com.android.virt/bin/crosvm --log-level=debug run "/data/data/com.termux/files/home/vm2/vmlinux"                                                                             <
[2024-03-23T00:49:49.735761079+05:30 INFO  crosvm] crosvm started.
[2024-03-23T00:49:49.736413214+05:30 INFO  crosvm] CLI arguments parsed.
[2024-03-23T00:49:49.736705610+05:30 DEBUG crosvm::crosvm::sys::unix] creating hypervisor: Gunyah { device: Some("/dev/gunyah") }
[2024-03-23T00:49:49.737004256+05:30 ERROR crosvm] exiting with error 1: failed to create vm

Caused by:
    Invalid argument (os error 22)

Not sure how to resolve this. Would really appreciate your help @quic-cvanscha . Ty!

subashsn avatar Mar 22 '24 20:03 subashsn

Tried cat /dev/gunyah and got this cat: /dev/gunyah: Invalid argument

Looks like this is where the below error comes from i.e when crosvm tries to use gunyah

apex/com.android.virt/bin/crosvm --log-level=debug run "/data/data/com.termux/files/home/vm2/vmlinux"                                                                             <
[2024-03-23T00:49:49.735761079+05:30 INFO  crosvm] crosvm started.
[2024-03-23T00:49:49.736413214+05:30 INFO  crosvm] CLI arguments parsed.
[2024-03-23T00:49:49.736705610+05:30 DEBUG crosvm::crosvm::sys::unix] creating hypervisor: Gunyah { device: Some("/dev/gunyah") }
[2024-03-23T00:49:49.737004256+05:30 ERROR crosvm] exiting with error 1: failed to create vm

Caused by:
    Invalid argument (os error 22)

Not sure how to resolve this. Would really appreciate your help @quic-cvanscha . Ty!

https://issuetracker.google.com/issues/280625917 According to conversations between Samsung and Google engineers, Samsung does not plan to enable AVF for their devices, so maybe a different device will be needed! Or you can try setting the correct permissions for /dev/gunyah. chmod 660 /dev/gunyah

luxontw avatar Apr 07 '24 11:04 luxontw

I could never do that! I love my tablet too much haha. I'll figure out some way to enable such soon.

Famous8 avatar Apr 07 '24 19:04 Famous8

Have you tried with the 6.1 Update?

Soranokuni avatar Apr 11 '24 09:04 Soranokuni

hi need help on samsung s9 ultra to format manual remove lock can someone help

Aiman1102-star avatar Sep 09 '24 21:09 Aiman1102-star

it doesnt work for me, i tried on SD8G3 with oneplus 12, the kernel version is: Linux localhost 6.1.57-android14-11-o-ga23ceff5d55d #1 SMP PREEMPT Mon Aug 19 11:22:00 UTC 2024 aarch64 Android
try compile crosvm and QEMU with gunyah fork on termux, failed.
compile crosvm on chroot container with command cargo build --features=gunyah, tried run, but got these error:

sudo ./crosvm --log-level=debug run linux --disable-sandbox
syslog init failed: guess of fd for syslog connection was invalid
syslog init failed: guess of fd for syslog connection was invalid
[2024-09-29T03:45:36.341635551+00:00 DEBUG crosvm::crosvm::sys::linux] creating hypervisor: Gunyah { device: Some("/dev/gunyah") }
[2024-09-29T03:45:36.388822478+00:00 ERROR crosvm] exiting with error 1: failed to create vm

Caused by:
    Cannot allocate memory (os error 12)

tried run QEMU got these error

sudo ./qemu-system-aarch64 -nographic --accel gunyah -machine virt
qemu-system-aarch64: failed to add mem (Cannot allocate memory)

looks like doesnt work anymore

wwlWang avatar Sep 29 '24 03:09 wwlWang