How can I find what chip I have (what version of raspberry pi) with Ubuntu 18.04 server for arm64? What file can I check or what command can I run? /proc/cpuinfo does not have useful information, just some generic details without mention of the pi.
3 Answers
At least on Ubuntu 18.04 server for arm64 and with a Raspberry Pi 3 B, the following command gives the board, including revision:
lshw
A less verbose output that's easier to read is given by:
lshw -short
That gave me my board as a "Raspberry Pi 3 B Rev 1.2", which is exactly what was needed in this case.
The command lscpu
is what you are looking for. Here's an example output of the command (taken on my Raspberry Pi 3B+):
lscpu
which produces the following output:
Architecture: armv7l
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
Model: 4
Model name: ARMv7 Processor rev 4 (v7l)
CPU max MHz: 1200,0000
CPU min MHz: 600,0000
BogoMIPS: 38.40
Flags: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
Another option is the inxi
command (you might have to install it if not present with sudo apt install inxi
). Use the flag -C
as follows:
inxi -C
which produces the following output:
CPU: Quad core ARMv7 rev 4 (v7l) (-MCP-) (ARM)
clock speeds: max: 1200 MHz 1: 1200 MHz 2: 1200 MHz 3: 1200 MHz 4: 1200 MHz
As for identifying which chip your board has, you can check the chip on the board as well the manufacturers website for info and as well as the different selling outlets for getting technical details.
-
Thank you, that definitely gives extra information. However, the model name when I run lscpu is listed as Cortex A-53, which is on both the pi 2 and 3 I believe. Do you happen to know of a more specific command/file which can distinguish between these two boards?– anvoiceApr 1, 2019 at 3:21
-
Normaly the board type and revision is printed on the board too, so you might be able to check that, otherwise I'm out of clues. Apr 1, 2019 at 3:23
-
I see. I know what my board is, but a library maintainer needs this info to adjust his library to work with my hardware and software. Tried inxi, it also gives generic output only. Really appreciate the help though.– anvoiceApr 1, 2019 at 3:25
-
1As for the library you want to use, there's only one question. is there a library which provides the same function you need or not. This is the information you can get from your machine program wise. On desktop computers there might be more information to get on the CPU version, the raspberry lacks in that regard a bit as putting all this information in some chips is adding to the costs. Apr 1, 2019 at 3:46
-
1Current inxi (3.0.xx) has way better ARM support than legacy inxi (2.xx.yy), which I think is what you find in 18-4. That will do its level best to give quite a bit of information about the actual SBC device itself. On rasberry pi 3 the only thing it's not catching is the mmc wifi device, which is too complicated to grab data on, but otherwise the report for pi 3 is quite complete in new inxi. Legacy inxi had only rudimentary ARM support. Compare inxi -Fxxx or -v7 on legacy and current on any pi device and you'll see what I mean.– LizardxApr 1, 2019 at 4:45
I attempted to port pigpio to Debian arm64, in the end my attempt failed because I discovererd that the Debian arm64 kernel doesn't support the userspace mailbox interface that pigpio relies on, but in doing so I did some research on how to detect Pis while running Debian arm64 kernels. I suspect this will also work for ubuntu arm64.
As you have discovered /proc/cpuinfo only has CPU core information on these kernels. Fortunately the information can be found elsewhere in /proc
Firstly to check if the device is a Pi or not, I checked /proc/device-tree/model , this has a text string describing the device, so false positives are unlikely.
To get the revision code I used /proc/device-tree/system/linux,revision , this contains the revision code as a big-endian binary integer. So it needs to be read out of the file as a binary integer, then converted to little-endian (I used ntohl for this).
You can see my code at https://github.com/joan2937/pigpio/pull/255/commits/2e229d667fde8a2a881d5aa8482b2bb936b09f26
cat /proc/cpuinfo
should produce a Revision number that corresponds to the board. See: raspberrypi.org/documentation/hardware/raspberrypi/…