Can Librem 5 phone run 64-bit applications


#1

Can the Librem 5 phone run 64-bit applications?


#2

It depends.

There are multiple implementations of 64-bit (called architectures) and this will affect the answer to this question.

It should run 64bit ARM applications without issue (though the UI may not scale nicely depending on the application), sometimes denoted as ARM64.

It would need an emulator to run x86_64 64 bit applications (this is the architecture run on most computers powered by Intel/amd) and there would almost certainly be a significant performance hit if this even worked at all (I’m not aware of any functional emulator for this at the moment but it’s theoretically possible and someone may know of one that exists).

It almost certainly will not run any 64 bit Itanium applications as it would likely be less effort to port the application to arm64 than to emulate IA64.

Also there are multiple OS’s which come into play as well. To the best of my knowledge if it is not Debian Linux based it will not run natively and require some amount of emulation or porting. There is some effort being made regarding emulating Android on ARM64 based Linux OS’s and at least some Android apps appear to work via this method based on other posts on this forum, that is a community effort.

Hopefully this helps.


#3

Why didn’t librem use 64-bit CPU like Intel instead of using ARM64?


#4

Power consumption more than anything else. It’s a phone and most people want the battery to last a day or more. Also size, Intel/and CPU’s are pretty large by comparison. And heat management, you’ll notice all x86_64 Intel/and CPU’s have a pretty large heat spreadder as well as one or more fans (which would also consume power).

I don’t know of a single phone on the market running an x86_64 processor for all of these reasons and I’m sure many others.


#5

Modern x86 CPUs come packaged with a bunch of nasty tricks too. Here’s a purism post with some details about that side of things https://puri.sm/posts/measuring-the-intel-me-to-create-a-more-secure-computer/


#6

Oh I see, is it easy to recompile arm64 to 64-bit?


#7

what do you mean by “64-bit”? Arm64 (or AArch64 to be precise) is a 64bit ISA - registers (thus integers) are 64b wide as well as addresses


#8

Qemu is used on raspberry pis to run x86 windows apps in wine. I’m fairly certain this method would work fine on the librem 5 in the future. It will however suck battery like hell on Earth.


#9

Oh sorry my bad. I am a little confused with this that is all


#10

No emulator required. You can translate the instruction set. This is relatively efficient for a complete instruction set (cisc) system to run reduced instruction set (risc) code. It is comparatively expensive for a risc system to run cisc code. x86_64 is very cics, arm64 is fairly risc. This means simple x86_64 stuff should work fine, compute heavy stuff will be painful.

Anyway, the software you need is the static qemu built on the host arch, for the target arch. It’ll be named something like qemu-arm-static (to run arm programs on a non-arm machine) or qemu-x86_64-static going the other way.

Once that’s set up, the magic line is

echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register

To run arm on non arm systems. I’ve not quite worked out what it’ll be going the other way, but I plan to before the phone arrives.


#11

My bad, I had understood qemu to be an emulator.


#12

qemu is multiple things. It includes an emulator, as well as disk image utilities, and filesystem utilities. It also includes an instruction set translator, which it uses for cross arch emulation, but can be used for running applications cross arch without emulating hardware.

The difference is if you use it as an emulator, it creates a virtual set of hardware (motheboard, vga, network, et cetera). If you just use the instruction translator, it still sees the same /dev, /proc and so on.


#13

Anything for GNU/Linux will probably be fine, regardless of if it targets Debian specifically. Lots of executables will run on my Gentoo system, for example, despite few of them actually targetting Gentoo.


#14

It is 64-bit, just on ARM64 instead of AMD64.


#15

I was more thinking an RPM, to the best of my knowledge, will not run on a Debian based system; though I guess this is more technically related to the package manager than the distribution and I messed that up in my haste.


#16

Indeed. RPM packages unpack and run fine on debian. Problem is the post install scripts won’t auto run, and the dependency tracking doesn’t function. There is a project called Alien, that can convert package formats, but it often fails to convert the dependencies since package naming conventions differ. Often the dependencies cannot be resolved even manually, if the source and target systems have incompatible glibc or libstdc++ libraries.