Page 1 of 1

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

Posted: Wed May 23, 2018 7:51 pm
by epoch1970
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.

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

Posted: Wed May 23, 2018 8:24 pm
by PhilE
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.

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

Posted: Thu May 24, 2018 10:02 am
by epoch1970
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. 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...