0

I have a phone (Samsung Galaxy A320F (AKA "A3 (2017)") with the stock ROM that contains a 64-bit armv8l kernel (Linux 3.18.14) and 32-bit userspace with 32-bit Android 8.0.0 platform. Some Android applications provide only 64-bit NDK-based libraries, which makes them incompatible with this setup.

I've tried transferring a few ELF64 binaries to the phone, like gdb, strace, gphoto2 along with libc.so.6, ld-linux-aarch64.so.1 and other parts of glibc. They run fine, so I'm confident in the kernel's ability to handle such binaries.

Now I'd like to try and make the Android platform 64-bit capable. In particular, I'm interested in making the 64-bit-only APK able to communicate with the display, touchscreen and a USB device attached to the phone. I have root access (via Magisk), so in principle, I can hack the system however I like.

My question is now: what components actually make the Android platform 32- or 64-bit? Is it just the VM, or maybe some additional libraries? Or does there have to also be a 64-bit part of the HAL? How many of these components could be taken from e.g. Lineage OS without actually installing the complete Lineage OS? Has anyone even tried to do a similar mod?

5
  • In my opinion it may be easier to join the development of a 64bit based custom ROM for your device at xda-developers.com. I would assume that this is far easier that trying alone to modify an existing Android version you don't have the sources for a large number of components/binaries. – Robert Jul 21 '20 at 9:18
  • See my detailed answer to Could a 64-bit hardware device run a 32-bit Android version? – Irfan Latif Jul 21 '20 at 15:59
  • @IrfanLatif although interesting, it doesn't address this question at all. From that answer I've mostly learned that a real 64-bit Android OS can have lots of 32-bit processes (provided there's CPU and kernel support for compatibility mode), but nothing about which components enable platform compatibility with 64-bit-NDK APKs. – Ruslan Jul 21 '20 at 16:12
  • Well I thought the answer to your question would be evident after reading my answer. What components make the Android OS 64 bit? Simply it's the set of libraries (other than kernel) shipped with the ROM including VMs/zygote (the app_process binary), linker and libc. Daemon executables (AOSP's and vendor HALs) including init and other tools in /bin directories are also 64 bit. But some daemons and HALs might still be 32-bit even on a 64-bit ROM (I quoted an example in my answer). So 64-bit ROMs include both sets of libraries (in /lib and /lib64) though this may change in future. – Irfan Latif Jul 21 '20 at 17:00
  • Addressing your situation in particular, armv8l means your kernel is 64b but the userspace process querying the architecture is running in 32b personality. So what you need to run 64b-only apps (as Google is pushing developers towards 64b) is to recompile your ROM for 64b. That's not impossible but would be challenging. As I said, some core platform components were not ready for 64b and Google developers left them 32b to be ported in future (not sure about latest situation in 10 and 11). Until zygote is not running in 64b mode, it won't be possible to run apps built only with 64b libraries – Irfan Latif Jul 21 '20 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.