guardianproject / lildebi

UNMAINTAINED please adopt! we can no longer maintain this
https://guardianproject.info/code
GNU General Public License v3.0
226 stars 55 forks source link

Running KVM on Samsung Galaxy S3 / S5 #205

Open ghost opened 8 years ago

ghost commented 8 years ago

I know this idea is quite ambitious and quite a long shot. But the geek in me would like to be able to run a modern kernel.

Booting mainline very unlikely There's probably no point in trying to compile a mainline kernel to work on my Samsung Galaxy S3/S5, as the phone has blob hardware drivers, and the kernels they use (especially the S3) are customized Android kernels.

So plan B is to boot the mainline kernel inside KVM :)

Samsung Galaxy S3 CPU: Exynos 4412 Quad (cpuid says SMDK4x12) (debian chroot working) 3.0.64 kernel S5 CPU: Qualcomm MSM8974-AC Snapdragon 801 (debian chroot not working yet) 3.4 kernel

These are Armv7 CPUs. Relevant reading on this topic is the early experiments getting the RaspberryPi 2 to boot in HYP mode instead of SVC mode. These days RbPi bootloader enters HYP automatically so this hack is no longer required for the RbPi. Basically the old bootloader started the kernel in SVC mode. So the hack-solution to get the CPU into HYP mode, was to compile this code to binary, then concatenate it onto the beginning of the linux kernel binary.

The main requirement is getting the phone to boot in HYP mode. I don't know if it's booting in HYP mode, likely it will be SVC mode.

The Hardkernel U3 uses the Exynos 4412 SoC http://www.hardkernel.com/main/products/prdt_info.php?g_code=G138733896281 You can see they support hyp mode on Uboot for it https://github.com/hardkernel/linux/blob/dc8cceddf4aa27d1703aca9f10a5552e3cce5d25/arch/arm/mach-exynos/headsmp.S

So somewhere in this repo, should be appropriate code /instructions that I could compile and concatenate onto the beginning of my kernel. https://github.com/hardkernel/u-boot

After figuring out how to get the CPU into HYP mode I'd recompile the CM kernel with KVM support.