32-bit vs 64-bit vs ARM in regards to programs and OSes

17,596

TL,DR: if you're only offered a choice of “32-bit” and “64-bit”, neither is right for a Raspberry Pi (or any other ARM-based computer). You need a package for ARM, and the right one to boot, which is armhf.

“32-bit” and “64-bit” are only one of the characteristics of a processor architecture. Many processor families come in both 32-bit and 64-bit variants (x86, ARM, Sparc, PPC, MIPS, …). Debian alone has 23 official binary distributions for different processor characteristics and different software characteristics.

You need to install a package which matches the ABI for your system. The ABI (application binary interface) includes the processor type (more precisely, its instruction set), but also other characteristics related to the ways programs interact. In particular, when a program makes a call to code that is in a library, the ABI determines how the arguments to the library function are passed (in registers or on the stack).

In the PC world, there are two instruction sets (up to minor variations that do not matter):

  • IA-32, a variant of x86, commonly known as i386 (the name used by Debian) or i686 (which, like IA-32, are generations of the x86 architecture series);
  • x86-64, also known as x64 or amd64 (the name used by Debian) (not to be confused with IA-64 which is completely different).

Both Intel and AMD make processors that implement the x86 and x86-64 instruction sets. Modern PCs have processors that support both the x86-64 and the x86 instruction sets; older PCs have processors that support only x86. Because the x86 instruction set uses 32-bit registers and the x86-64 instruction set uses 64-bit registers, and because for each instruction set there is a single ABI used by all Linux installations¹, these are often described as just “32-bit” or “64-bit”. In a PC context, “32-bit” means “x86” and “64-bit” means “x86-64”.

ARM processors have a completely different instruction set. You cannot install an x86 or x86-64 package on an ARM system. You need a package for ARM, for the correct instruction set, and more generally for the correct ABI. There are no major 64-bit distributions for 64-bit ARM processors yet, because the ARMv8 architecture revision which introduces a 64-bit instruction set is still very new and not commonly available. There are however multiple 32-bit ABIs, which assume the existence of different processor features and use different versions of the argument-passing convention. The main ARM ABIs used on Linux are:

  • armel, based on the ARM EABI version 2 (known as “ARM EABI” or “EABI” for short), in its little-endian incarnation;
  • armhf, which is a variant of armel that takes advantage of some features of newer ARM CPUs, in particular hardware floating-point support.

All devices that support armhf also support armel; however a given system installation must be consistent. Raspbian uses armhf (in fact, it started out as a port of Debian's armel to armhf, back when armhf was a new thing).

¹ At least for mainstream distributions. There are embedded distributions that have several x86 binary releases, with packages compiled against different versions of the standard C library (glibc, dietlibc, uclibc, …).

Share:
17,596
evamvid
Author by

evamvid

Updated on September 18, 2022

Comments

  • evamvid
    evamvid over 1 year

    So when I run Raspbian (basically a ARM Debian derivative with LXDE), I can install any normal package using aptitude. But if, for example, I wanted to download a .deb file, I would have to choose 32-bit or 64-bit and download that, and try to run it on Raspbian (it wouldn't work).

    Why does installing packages from the official repositories work on ARM systems? Why is it not incompatible?

    I'm also a little confused about the difference between hardware and software bits. ARM is hardware, right?

  • evamvid
    evamvid about 10 years
    So in hardware it deals with the software the hardware is capable of running?
  • evamvid
    evamvid about 10 years
    So the ARM versions are the same program recompiled for ARM?
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' about 10 years
    @evamvid The i386 version, the amd64 version, the armel version, the armhf version, the mips version, the powerpc version, etc. are all the same program compiled for different platforms (processor architecture + ABI).
  • Leiaz
    Leiaz about 10 years
    @evamvid "64 bit" for CPUs on desktops/laptops means a processor that can execute x86_64 instructions (and also 32 bit x86, because x86_64 is defined as backward compatible with it). "32 bit CPU" means one that can run x86 instructions (but not the newer x86_64). This is in the context of "PC" processors. More generally, "64 bit processor" can mean any processor with 64 bit wide registers, and you would need more information to know which instruction set (software) it can run.