6

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?

11

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, …).

  • So the ARM versions are the same program recompiled for ARM? – evamvid Apr 18 '14 at 1:39
  • @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). – Gilles Apr 18 '14 at 8:56
0

So when I run Raspbian (basically a ARM Debian derivative with LXDE), I can install any normal package using aptitude.

If you are running Raspbian, aptitude gets its packages from the Raspbian repository. As explained in the Raspbian FAQ, the packages are compiled for the ARMv6 used in the Raspberry Pi. You aren't using Debian official packages. Again from the FAQ, Debian armhf supports ARMv7-A CPUs and higher, and Debian armel supports less capable ARM CPUs.

I would have to choose 32-bit or 64-bit and download that

If you mean "choosing between x86 and x86_64", those are compiled for the x86 architecture (or rather i686 nowadays) or x86_64. They won't work on the ARM architecture. You would have to find and download a .deb compiled for Raspbian (or with the same options), or compile it yourself.

I'm also a little confused about the difference between hardware and software bits.

I'm not sure I understand the question well, but processors supporting x86_64 can run 32bit x86 too, so you can install the 32bit version of a distro on a recent CPU, and use only 32bit software on your x86_64 capable hardware.

  • So in hardware it deals with the software the hardware is capable of running? – evamvid Apr 18 '14 at 1:38
  • @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. – Leiaz Apr 18 '14 at 11:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.