Easy command line method to determine specific ARM architecture string?
On Debian and derivatives,
dpkg --print-architecture
will output the primary architecture of the machine it’s run on. This will be armhf
on a machine running 32-bit ARM Debian or Ubuntu (or a derivative), arm64
on a machine running 64-bit ARM.
Note that the running architecture may be different from the hardware architecture or even the kernel architecture. It’s possible to run i386
Debian on a 64-bit Intel or AMD CPU, and I believe it’s possible to run armhf
on a 64-bit ARM CPU. It’s also possible to have mostly i386
binaries (so the primary architecture is i386
) on an amd64
kernel, or even binaries from an entirely different architecture if it’s supported by QEMU (a common use for this is debootstrap
chroots used for cross-compiling).
Related videos on Youtube
drjors
Updated on September 18, 2022Comments
-
drjors over 1 year
I'm trying to write a script which will determine actions based on the architecture of the machine. I already use
uname -m
to gather the architecture line, however I do not know how many ARM architectures there are, nor do I know whether one isarmhf
,armel
, orarm64
.As this is required for this script to determine whether portions of the script can be run or not, I am trying to find a simple way to determine if the architecture is
armhf
,armel
orarm64
. Is there any one-liner or simple command that can be used to output eitherarmhf
,armel
, orarm64
?The script is specifically written for Debian and Ubuntu systems, and I am tagging as such with this in mind (it quits automatically if you aren't on one of those distros, but this could be applied in a much wider way as well if the command(s) exist)
EDIT: Recently learned that armel is dead, and arm64 software builders (PPA or virtual based) aren't the most stable. So I have a wildcard search finding
arm*
and assuming armhf, but it's still necessary to figure out a one liner that returns one of the three - whether it's a Ubuntu/Debian command or a kernel call or something.-
Grodriguez about 8 yearsWhy do you say that "armel is dead" ?
-