[PATCH 2/4] ARM: beaglebone: add helper init script for checking if BBBW

Marc Reilly marc at cpdesign.com.au
Sun Jun 13 15:26:37 PDT 2021


This adds a check against the eeprom contents to see if the board is a
Beaglebone black wireless. (two bytes at offset 0x12 of eeprom will be
"BW").
If it is, the global board.variant is updated to "boneblackwireless"

Signed-off-by: Marc Reilly <marc at cpdesign.com.au>
---
 .../defaultenv-beaglebone/data/bbb-eeprom-0x0C      |  1 +
 .../defaultenv-beaglebone/init/check-bbb-type       | 13 +++++++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/data/bbb-eeprom-0x0C
 create mode 100644 arch/arm/boards/beaglebone/defaultenv-beaglebone/init/check-bbb-type

diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/data/bbb-eeprom-0x0C b/arch/arm/boards/beaglebone/defaultenv-beaglebone/data/bbb-eeprom-0x0C
new file mode 100644
index 000000000..258b93951
--- /dev/null
+++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/data/bbb-eeprom-0x0C
@@ -0,0 +1 @@
+BW
diff --git a/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/check-bbb-type b/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/check-bbb-type
new file mode 100644
index 000000000..b7c8b3683
--- /dev/null
+++ b/arch/arm/boards/beaglebone/defaultenv-beaglebone/init/check-bbb-type
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+memcmp -b -s /dev/eeprom0 -d /env/data/bbb-eeprom-0x0C 0x0c 0x00 2
+result=$?
+echo $result
+
+if [ $result = 0 ]
+then
+        echo "Beaglebone Wireless detected"
+        global.board.variant=boneblackwireless
+else
+        echo "Beaglebone Black (non-wireless) detected"
+fi
-- 
2.31.1




More information about the barebox mailing list