epoch1970
Posts: 1778
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

wiringpi, aarch64, /proc/cpuinfo, /proc/device-tree...

Wed May 23, 2018 7:51 pm

I just bumped into an oldish issue where "gpio readall" aborts on aarch64. It wants something like this:

Code: Select all

$ cat /proc/cpuinfo
...
Hardware	: BCM2835
Revision	: a02082
Serial          : 00000000XXXXXXXX
Pelwell pointed people to /proc/device-tree.

I'm using this kernel:

Code: Select all

Linux rpi3 4.14.34-v8 #2 SMP Wed May 23 18:02:18 CEST 2018 aarch64 GNU/Linux
Indeed, the match looks ok:
  • /proc/device-tree:

    Code: Select all

    $ for t in name model compatible serial-number; do echo "$t -> $(cat /proc/device-tree/$t)"; done
    name -> 
    model -> Raspberry Pi 3 Model B Rev 1.2
    compatible -> raspberrypi,3-model-bbrcm,bcm2837
    serial-number -> test-001
  • /proc/device-tree/system/:

    Code: Select all

    $ for t in revision serial; do echo "$t -> $(cat /proc/device-tree/system/linux,$t | xxd -p)"; done
    revision -> 00a02082                                         
    serial -> 00000000XXXXXXXX
Can someone confirm the expected behaviour of aarch64 apps is to stop relying on /proc/cpuinfo for hardware platform info?

That funny /proc/device-tree/serial-number comes (to my surprise) from my u-boot environment: Is it ok to do what u-boot does?
If so, how would I populate "name", or perhaps create new keys?

Thanks in advance.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1760
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: wiringpi, aarch64, /proc/cpuinfo, /proc/device-tree...

Wed May 23, 2018 8:24 pm

aarch64 has abandoned the board-specific machine/board files (which is where the downstream kernel sets the serial number), and we don't want to change that. However we can guarantee that the firmware will continue to set the property in Device Tree, so that is the most future-proof place to retrieve it from.

epoch1970
Posts: 1778
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: wiringpi, aarch64, /proc/cpuinfo, /proc/device-tree...

Thu May 24, 2018 10:02 am

Thanks!
Seeing the cpuinfo-related aarch64 patches from 2016 I suspected hardware info was indeed a goner.
/proc/device-tree is fine, a guarantee is more than I require.

My rationale(?) for running 64bits was "future-proofing" the software stack. I'll have to see if that little GPIO thing has put a dent in the masterplan or if it has blown it into little pieces :)

Update: Our resident 64bit gentoo hero Sakaki was ahead of me.
https://github.com/sakaki-/rpi3-overlay/blob/master/dev-embedded/wiringpi/wiringpi-2.44-r7.ebuild wrote:# deal with problem that RPi3 in 64-bit mode does not have
# the 'Hardware' line in /proc/cpuinfo, which the wiringPi library
# checks, by making it look in /etc/wiringpi/cpuinfo instead
use arm64 && epatch "${FILESDIR}/${PV}-pseudo-cpuinfo.patch"
Perhaps not elegant but that looks simple enough...
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Device Tree”

Who is online

Users browsing this forum: No registered users and 2 guests