MOVED TO A NEW REPO: https://github.com/raspiduino/a6lte-kvm. THIS REPO IS NO LONGER MAINTAINED!!!
Warning: Super long text ahead, be careful not to mess up your brain :))
The FIRST thing to do BEFORE doing ANYTHING is to backup your data!
Your warranty is now void. It might be vaild again if you flash stock firmware from Samsung Smart Switch or firmware from [samfw.com](https://samfw.com/), but I am NOT sure.
I am not responsible for bricked devices, dead SD cards,
thermonuclear war, or you getting fired because the alarm app failed. Please
do some research if you have any concerns about features included in this
kernel before flashing it! YOU are choosing to make these modifications, and if
you point the finger at me for messing up your device, I will laugh at you.
Disclaimer template credit: XDA forum :)
This is the stock kernel source for SM-A600G, originally from Samsung Opensource page with the file SM-A600G_SEA_PP_Opensource.zip
, and the source has been patched for KVM support (so you can run VMs on your phone with qemu-kvm
).
For running VMs on your phone, probably Windows 10/11 ARM :) , but we need to patch the guess OS first. See XDA thread.
Originally from @sleirsgoevy 's patch for SM-A600FN here
The XDA discussion can be found here
In case you don't want to build it yourself, I have built one for you in release
- You cannot set any type of lock screen. This is Magisk bug. You can try some solutions here. I cannot confirm (yet) if any of solutions in the link work.
- Power button cannot wake phone up if you put it into lockscreen mode. You can still turn on the phone using power button, capture the screen using power button + volume down but screen capture menu won't open. Temporary fix for this: install black screen app on Google Play. I don't know what's best, you have to try :) I use this one, just randomly picked :)
- If you turn your phone into lockscreen mode, power button cannot wake up your phone (see the above bug). To reset your phone, hold power button + volume down for 7 sec and it will reset. If you hold for 18 sec, it will come to "Force download mode", and you have to hold power button + volume down for 7 sec again.
- Volume up/down won't open volume menu when you click them, but they still work.
- The kernel only detect 4 cores / 8 cores of the Exynos 7870 SoC. I will try to fix this. In the log I can found some lines about
failed to hotplug cpu 4
. Maybe there is something I turn of by mistake whenmake menuconfig
. You might not face this. - @sleirsgoevy confirm that Linux boot on KVM but require special patch for DTB (device tree blob), Windows not boot (yet).
- On first boot, Chrome won't work. You have to update Chrome on Google Play, then it will work.
- There will be some notifications about "Unauthorize action...", just ignore it. It's just Samsung stock ROM detect root. If you feel annoying, try Security log agent fix
You can use the precompiled and patched img file at release to skip Building :)
- Step 0: Get a Linux PC (or WSL). If you don't have one, use the FREE Google Cloud Shell with a lot of preinstalled tools (and may also faster than your computer :D)
- Step 1: Get the toolchain by
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 && cd aarch64-linux-android-4.9 && git checkout ndk-release-r19
. Also installbc
if you don't have it yet. On Debian-based distributions usesudo apt install bc
, on Redhat-based usesudo rpm install bc
- Step 2: Clone this repo by
cd .. && git clone https://github.com/raspiduino/sm-a600g-kvm && cd sm-a600g-kvm
- Step 3: Setup environment variable
export CROSS_COMPILE=../aarch64-linux-android-4.9/bin/aarch64-linux-android- ANDROID_MAJOR_VERSION=p ARCH=arm64
- Step 4: Make menuconfig by
make exynos7870-a6lte_defconfig && make menuconfig
- Step 5: Goto
Boot options
and then turn off all options which hasTIMA
andRKP
. Then click exit to go back to main menu. EnableVirtualization
by pressing the space key. GotoVirtualization
menu and enableKernel-based Virtual Machine (KVM) support
. After that, exit menuconfig and save.config
file. - Step 6: Run
make Image -j8
to build. You can replace-j8
by-j[NUMBER OF THREAD TO RUN]
- Step 7: Download latest Magisk apk and change the
.apk
extension to.zip
. Extract zip and look intolib
here you can find the binary tools for your architecture. On PC you extractlib/x86/libmagiskboot.so
- Step 8: You need to extract the stock
boot.img
from stock rom. You can get stock rom from samfw.com or from my release page :). Then usemagiskboot unpack boot.img
, replace stock kernel with our compiledImage
inarch/arm64/boot/Image
and repackboot.img
usingmagiskboot repack boot.img new-boot.img
- Step 9: Open your phone (or any phone), install latest Magisk apk. Open the Magisk app, select Install, click Next, choose patch a file, then transfer the new-boot.img to that phone, patch it using Magisk. The output should be in Download folder.
Or all in one line to build but not patch :). I will include the build script later...
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9 && cd aarch64-linux-android-4.9 && git checkout ndk-release-r19 && sudo apt install bc && cd .. && git clone https://github.com/raspiduino/sm-a600g-kvm && cd sm-a600g-kvm && export CROSS_COMPILE=../aarch64-linux-android-4.9/bin/aarch64-linux-android- ANDROID_MAJOR_VERSION=p ARCH=arm64 && make exynos7870-a6lte_defconfig && make menuconfig && make Image -j8
After get the patched img file, it's now time for installing.
- Step 1: Transfer the patched img file to your Windows PC (to use Odin, in Linux you need Heimdall) and rename it to
boot.img
. Add the file to tar using 7-zip ortar
command then loadtar
file to AP in Odin. Flash your phone and when it saysPASS!
, you are doing well! - Step 2: It will automatically reboot your phone and come with a screen say "Unable to verify your phone, please reset...", accept and reset it. After reset it will lead you to Android setup, just setup the device but DO NOT set any kind of password or screen lock.
- Step 3: After get into Android, open Magisk app in App list and allow it to install (and reboot). After reboot open Magisk app again, select Extension, search for "SELinux Permissive" and install it and allow it to reboot.
- Step 4: After reboot, open Play Store and install Linux Deploy and VNC viewer (I recommend RealVNC's). Open Linux Deploy app, goto "Configure" and select Debian distro, arch armhf, set username to
root
, set the password for it then enable SSH and VNC. Come back to main menu and click Install. Wait for 10 minutes and when it says "Deploy!", click the play button to deploy it. Note: you can also select the arch to be arm64, but this often failed withcannot find /system/bin/sh
(eventhough it's right there) orBad system call
. So use armhf for sure :). Why this fail? Well, Samsung release this phone with aarch64 kernel but aarch32 Android system! See more at XDA thread. - Step 5: Open VNC app, connect to
localhost:5900
. Enter the password you have set for root account. This should bring up a desktop environment. Open terminal, rundpkg --add-architecture arm64
thenapt update
thenapt install qemu-system-arm:arm64 -y
. Let it do its job for a few minutes. After installing, runchmod 666 /dev/kvm
. - Step 6: QEMU KVM should work now, to test that, use
qemu-system-aarch64 -M virt -cpu host --enable-kvm -monitor stdio
. Then a QEMU monitor prompt should bring up. Typeinfo kvm
. If it returnkvm support: enabled
, then congratulation! You now have KVM on your phone! - Step 7: Go and try Windows 10 or 11 ARM!
- Step 8: In case something wrong, you can always reflash stock
boot.img
to undo anything :)
Remember: If you can get into Download mode in your Samsung phone, it will NEVER brick :) . I have reflashed my Samsung phone with stock rom 3 times when trying this :) so don't be panic, it WON'T help :)
This instruction will be updated later, so don't worry :)
- Linux now boot with a custom DTB. See how to boot [here](Post in thread 'Is Samsung Galaxy A6 (Exynos 7870) suppor KVM?' https://forum.xda-developers.com/t/is-samsung-galaxy-a6-exynos-7870-suppor-kvm.4295775/post-85601873)
- U-boot with EFI support now boot
- 32-bit ARM (AArch32) not boot
- Windows and EDK2 for booting Windows not boot yet. I am working on a patch for it.
- MacOS on ARM is not tested until someone finds a way for booting it on QEMU.
- ReactOS port for ARM will be tested soon.
You need root to run KVM or to access /dev/kvm
See Linux's License here.