rpi-eeprom-update: Use multiple sources for BOARD_INFO

Try device-tree, then cpuinfo and failing that raw OTP.
This commit is contained in:
Tim Gover
2020-09-28 10:31:42 +01:00
parent 1a099a5a9d
commit 8d4af8db97

View File

@@ -268,7 +268,15 @@ getBootloaderUpdateVersion() {
} }
checkDependencies() { checkDependencies() {
if [ -f "/sys/firmware/devicetree/base/system/linux,revision" ]; then
BOARD_INFO="$(od -v -An -t x1 /sys/firmware/devicetree/base/system/linux,revision | tr -d ' \n')" BOARD_INFO="$(od -v -An -t x1 /sys/firmware/devicetree/base/system/linux,revision | tr -d ' \n')"
elif grep -q Revision /proc/cpuinfo; then
BOARD_INFO="$(sed -n '/^Revision/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo)"
else
BOARD_INFO="$(vcgencmd otp_dump | grep '30:' | sed 's/.*://')"
fi
if [ $(((0x$BOARD_INFO >> 23) & 1)) -ne 0 ] && [ $(((0x$BOARD_INFO >> 12) & 15)) -eq 3 ]; then if [ $(((0x$BOARD_INFO >> 23) & 1)) -ne 0 ] && [ $(((0x$BOARD_INFO >> 12) & 15)) -eq 3 ]; then
echo "BCM2711 detected" echo "BCM2711 detected"
else else