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 :)
It worked!
I will soon update a new screenshot.
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
Trust me, there are absolutely no virus here :). Why should one insert a virus into an opensource project?
- 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. No lock screen means less security. You can develop your own app to replace the lock screen (I might make one some day) or you can use the lock screen feature on Game Booster on the bottom right of Linux Deploy app.
- 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 aboutEDIT: Fixed in latest commit thanks to Henris3330, see this.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. Update: link is dead, use this instead.
- 16/2/2022: There is a bug in
dtc
tool, you should refer to this comment to patchdtc
. A fix will be released in this repo later! - 20/2/2022: Windows ARM requires some registers to be trapped. See this for more details.
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/a6lte-kvm && cd a6lte-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
. CPU hotplug will not work, so you have to disable it by disable all hotplug config (you might want to open the.config
in editor and edit it manually). 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/a6lte-kvm && cd a6lte-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
- U-boot with EFI support now boot
- EDK2 (or OVMF) works with a patch.
- 32-bit ARM (AArch32) not boot
- Windows not tested. 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
- Linux Deploy is based on
chroot
, which will provide access to hardware so it will require root. The opposite is Termux, it uses proot (emulate fake system call).
See Linux's License here.