Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Improve ARM architecture detection: arm64 and armv7 #106
Conversation
| if (unameOut.includes('armv7')) return 'armv7'; | ||
| return ''; | ||
| } | ||
|
|
pdcastro
Oct 14, 2020
•
Author
It was only after writing and testing the code that I realised that there is already an open PR on the same topic: #101
I'd say that this PR (#106) is a bit more robust / conservative and complete, because:
- It falls back to the existing
/proc/cpuinfo implementation if uname is not available (however unlikely). Note that spawnSync('uname', ['-a']) does not throw an Error if uname does not exist, but sets uname.error which the code detects.
uname -a is a bit more robust than uname -m (thinking of all different Unix kernels out there: BSD, Solaris, Linux, even perhaps macOS...), as it does not rely on a particular field or implementation of uname.
- The detection is case insensitive.
- It detects
arm64 (e.g. Raspberry Pi 4) in addition to armv7 (e.g. Raspberry Pi 2/3). I've tested on both!
It was only after writing and testing the code that I realised that there is already an open PR on the same topic: #101
I'd say that this PR (#106) is a bit more robust / conservative and complete, because:
- It falls back to the existing
/proc/cpuinfoimplementation ifunameis not available (however unlikely). Note thatspawnSync('uname', ['-a'])does not throw an Error ifunamedoes not exist, but setsuname.errorwhich the code detects. uname -ais a bit more robust thanuname -m(thinking of all different Unix kernels out there: BSD, Solaris, Linux, even perhaps macOS...), as it does not rely on a particular field or implementation ofuname.- The detection is case insensitive.
- It detects
arm64(e.g. Raspberry Pi 4) in addition toarmv7(e.g. Raspberry Pi 2/3). I've tested on both!
robertsLando
Oct 15, 2020
Close this PR so :)
Close this PR so :)
robertsLando
Oct 15, 2020
Oh ok sorry I misunderstood the comment
Oh ok sorry I misunderstood the comment
|
I don’t think they will answer
|

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

When running
pkgin a Docker Desktop ARM-image container on an Intel laptop, usingbinfmt_misc/ QEMU architecture emulation,/proc/cpuinforeports the Intel processor rather than the emulated ARM processor. The existing architecture detection then fails. Also, the existing detection code does not support arm64 (e.g. the Raspberry Pi 4), reportingarmv6instead.