Bananian

Determining what model I'm running on

13 2668
Omega  
Edited by Omega at Tue Apr 21, 2015 05:37

Hey everyone!  I'm wondering if anyone might happen to know of a way for me to determine what type of device I'm running Bananian on from within bash.  Say for example "Banana Pi" vs "Banana Pro".
tkaiser  
If you use the most recent Bananian version this has been addressed by a special file /etc/bananian_platform.
  1. [ -f /etc/bananian_platform ] && read BANANIAN_PLATFORM </etc/bananian_platform || BANANIAN_PLATFORM="unknown"
Copy the Code
But you should be aware that the contents of this file are just the result of choosing the appropriate hardware platform using 'bananian-hardware' prior to reading from it. Bananian-hardware exchanges the script.bin and writes to /etc/bananian_platform so normally you can rely on the contents of this file.

The only real difference between Banana Pi and Pro is the presence of the Wi-Fi chip. But since this chip has to be enabled in the appropriate fex file (script.bin) if a user chooses the wrong script.bin for his hardware you won't detect the chip from within the running system (assumption -- maybe I'm wrong). So your best bet would be to rely on 'bananian-hardware' being used before and then you can trust in the contents of /etc/bananian_platform.

Omega  
I guess the issue here is that I'm trying to detect this before bananian-hardware has been run as part of an automatic provisioning script.  So I'm in exactly the situation where I can't depend on it

tkaiser  
Edited by tkaiser at Tue Apr 21, 2015 07:20
Omega replied at Tue Apr 21, 2015 06:16
I'm trying to detect this before bananian-hardware has been run as part of an automatic provisioning script


Then I would use the Banana Pro's fex file as the default and then check whether you could load the Wi-Fi module or not:
  1. modprobe ap6210 && Banana Pro/M1+ || Banana Pi
Copy the Code

tkaiser  
Maybe this is already a feature request for Bananian? Starting with some sort of an universal fex file for fresh installs and depending on the Wi-Fi chip found (AP6181, RTL8192CU or RTL8188ETV) automagically initialising the correct script.bin and contents of /etc/bananian_platform like bananian-hardware provides in a manual fashion currently.

Omega  
It would be nicer if there was some way to infer this more deliberately.  The scripting ends up being far less convoluted.  Some kind of file in /sys or /proc that I can inspect would be ideal.

Omega  
I've created a feature request: https://dev.bananian.org/view.php?id=126

tkaiser  
Omega replied at Tue Apr 21, 2015 07:45
It would be nicer if there was some way to infer this more deliberately.  The scripting ends up bein ...

But as far as I know there is none. You could just prepare the distro to include a fex file that initialises the SDIO connected AP6181 Wi-Fi chip so that a modprobe for the appropriate module exits with 0. And to get a clue whether it's a BP-R1 or an Orange Pi to check lsusb output. Then bring the appropriate script.bin in place and let the system reboot.

As far as I understand the sunxi hardware initialisation depends on a correct fex file otherwise you're not able to detect a device that's connected via SDIO. And if you don't want to rely on the contents of script.bin or any other file the only real difference in hardware is the Wi-Fi chip used on the board.

The A20 SoC contains a so called SID but this is more of SoC's serial number than anything a 'vendor' like LeMaker or SinoVoip could use (you know that both boards are produced by different manufacturers?)

igorpec  
Edited by igorpec at Tue Apr 21, 2015 18:42

I am detecting on various hardware parameters - one script for all boards, not just bananas:

https://github.com/igorpecovnik/lib/blob/next/scripts/armhwinfo


Currently using for generating MOTD and to switch between normal Banana configuration and R1 (setting proper LAN config and dedicated script.bin) at first boot.

tkaiser  
igorpec replied at Tue Apr 21, 2015 11:34
I am detecting on various hardware parameters - one script for all boards, not just bananas:

https: ...

But if I understand your script correctly you also don't differentiate between Pi/Pro and ship with a script.bin for both that tries to enable/initialise the AP6181? And it's up to the user to replace script.bin manually for the GPIO stuff afterwards?

You have to log in before you can reply Login | Sign Up

Points Rules