1

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
  • 1
    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
    Commented Jul 21, 2020 at 9:18
  • 1
    See my detailed answer to Could a 64-bit hardware device run a 32-bit Android version? Commented Jul 21, 2020 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
    Commented Jul 21, 2020 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. Commented Jul 21, 2020 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 Commented Jul 21, 2020 at 17:17

3 Answers 3

1

For Android to be 64-bit you need several things:

  • 64-bit-capable hardware, which you have.
  • 64-bit kernel, which you have.
  • 64-bit Android Runtime ("ART"). This is what you're missing.

The 32-bit ART you have will compile Dalvik bytecode into 32-bit machine code. 32-bit machine code can't make straightforward calls to 64-bit machine code, which is what's in 64-bit NDK libraries. That's why you can't install apps that use 64-bit NDK libraries.

Android isn't really designed for putting custom OSes together from binaries intended for assorted devices. Lineage OS supports the A5 (2017) and A7 (2017) models, but not your A3 (2017).

At this point in time, buying a more modern device is the easiest solution.

0

For a 64-bit Android, all the partitions should be 64-bit.

In your case, the system partition is 32-bit, the same case with Samsung Galaxy J8.

1
  • What does it mean for a partition to be 32- or 64-bit? The filesystem should be the same, regardless of kernel or userspace bitness.
    – Ruslan
    Commented Dec 7, 2021 at 13:20
-1

A register makes a system 32-bit or 64-bit. 8 bits = 1 Byte, 32 bits = 4 Bytes, and 64 bits = 8 Bytes.

So it means 32-bit registers can store 4 Bytes of information per register and 64-bit registers can store 8 Bytes of information per register.

1
  • No register makes it. The system described in the OP has 64-bit kernel on a 64-bit CPU, but it's still 32-bit Android.
    – Ruslan
    Commented Jul 26, 2021 at 8:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .