On Mon, Jun 14, 2021 at 08:26:37AM +1000, Marc Reilly wrote: > 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@xxxxxxxxxxxxxxx> > --- > .../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 I think it's worth doing this in C code. A good template for this is in https://git.pengutronix.de/cgit/barebox/tree/arch/arm/boards/skov-imx6/board.c#n435 Here the board compatible is prepended with a more specific variant, for the BBB this would be "ti,am335x-bone-black-wireless". With this bootspec could pick the entry with the right devicetree without further interventions. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox