Table of Contents

Project owner: Overdrive
Interested: peterbay, Overdrive
Related:
Reference: https://en.wikipedia.org/wiki/Banana_Pi
License: Uveďte původ-Zachovejte licenci; CC BY-SA

picka_small.jpg

Howto for different single-boards

PI Specific tools

MacOSX install of Banana PI

SemioTex:pavouk$ mount | grep -i picka1
/dev/disk3s1 on /Volumes/PICKA1 (msdos, local, nodev, nosuid, noowners)

SemioTex: pavouk$ cd ~/Desktop/
SemioTex:Desktop pavouk$ ls -la *.img
-rw-r--r--  1 pavouk  staff  3932160000  5 srp  2015 Raspbian_For_BPI_M1_V4.0.img

SemioTex:Desktop pavouk$ sudo diskutil unmount /Volumes/PICKA1
Volume PICKA1 on disk3s1 unmounted

SemioTex:Desktop pavouk$ sudo dd bs=1m if=~/Desktop/Raspbian_For_BPI_M1_V4.0.img of=/dev/disk3 
  * u can check progress with CTRL+T [SIGINFO]
==== Configure Mac to be able to directly conenct to Picka over ETH through trunderbolt ====

  * connect thunderbolt and Picka by straight cable
  * system preferences on mac -> Network -> Thunderbolt: use DHCP
  * system preference on mac -> Sharing -> check ON Internet sharing
  * ifconfig: find bridge*

<code>
bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=3<RXCSUM,TXCSUM>
	ether 2a:37:37:c1:c0:64 
	inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
	inet6 fe80::2837:37ff:fec1:c064%bridge100 prefixlen 64 scopeid 0xa 
	Configuration:
		id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
		maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
		root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
		ipfilter disabled flags 0x2
	member: en5 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 9 priority 0 path cost 0
	nd6 options=1<PERFORMNUD>
	media: autoselect
	status: active
sudo nmap -n -PN -sT -sU -p- remote_host
SemioTex:Picka pavouk$ nmap 192.168.2.*
### more extensive nmap: nmap -p0- -v -A -T4 192.168.1.*
Starting Nmap 6.47 ( http://nmap.org ) at 2016-03-13 14:47 CET
Nmap scan report for 192.168.2.2
Host is up (0.0017s latency).
Not shown: 999 closed ports
PORT   STATE SERVICE
22/tcp open  ssh

MacOSX Backup & restore Banana PI SD card

Backup

# to list partitions

diskutil list 

#/dev/disk4 (internal, physical):
#   #:                       TYPE NAME                    SIZE       IDENTIFIER
#   0:     FDisk_partition_scheme                        *7.9 GB     disk4
#   1:             Windows_FAT_32 boot                    58.7 MB    disk4s1
#   2:                      Linux                         7.9 GB     disk4s2
   
#in our case it was /dev/disk4
#CTRL+T as SIGINFO could be used to check progress

sudo dd if=/dev/disk4 bs=1m | gzip > ~/1_Labka/banana_picka_25.5.2016.img.gz

example how to copy backup by scp

copy to remote host

scp ~/1_Labka/banana_picka_25.5.2016.img.gz user@remotehost:/home/share/Picky_Backup/

copy to localhost

scp your_username@remotehost:/home/share/Picky_Backup/banana_picka_25.5.2016.img.gz /some/local/directory

Restore

# first check where SD card is visible, but not mounted by
diskutil list 
# let it be again /dev/disk4
gzip -dc ~/1_Labka/banana_picka_25.5.2016.img.gz | sudo dd of=/dev/disk4 bs=1m

remove password to ssh

https://wiki.archlinux.org/index.php/Banana_Pi#Network

 mkdir ~/.ssh
 chmod 700 ~/.ssh
 touch ~/.ssh/authorized_keys
 chmod 600 ~/.ssh/authorized_keys
 

example of generating key to non standard position

 
over@darkstar>mkdir ~/ssh_tmp
ssh-keygen -t rsa -C "tpetru@gmail.com" -f ~/ssh_tmp/id_rsa_na_jine_misto
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/over/ssh_tmp/id_rsa_na_jine_misto
Your public key has been saved in /home/over/ssh_tmp/id_rsa_na_jine_misto.pub.
The key fingerprint is:
SHA256:hriECJShFg+8AKVHVkoqYtBknvhf/sGW+KQr4wqtEUE tpetru@gmail.com
The key's randomart image is:
+---[RSA 2048]----+
|=EX..            |
|*%=o             |
|@o*.             |
|** . . .         |
|o o o o S        |
| o o + + .       |
|o . o o *        |
| +  o  * .       |
|. .o.oo.o        |
+----[SHA256]-----+
 nano ~/.ssh/authorized_keys <--- copy there public key generated somewhere

this is what you should have:

drwx—— 2 root root 4096 Mar 13 13:23 .ssh

-rw——- 1 root root 209 Mar 13 13:21 authorized_keys

 nano /etc/ssh/sshd_config -> PasswordAuthentication no
 sudo service ssh restart

test by:

 ssh root@localhost

if it is asking for key, everything is ok !!! do not disconnect from session before test from outside !!! try from outside:

 ssh root@IP_of_pi

when able to connect by key, everything is fine

create ~/.ssh/config for labka

touch ~/.ssh/config   
chmod 110 ~/.ssh/config

* add there this block of code; user needs to be correctly set up:

Host labka
    user [SOME USER PICO]
    hostname 193.84.207.21
    ForwardX11 yes

* next time, you can connect to server by

 ssh labka

instead of

 ssh [some_user]@193.84.207.21

add user to wheel group [grant him sudo]

 usermod -aG wheel username

Change colour of shell

 nano ~/.bashrc

edit to something like this 31m is red:

 PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] '

Resize SD card

raspi-config –expand-rootfs

Timezone

 tzselect  
 

Install basic tools

aptitude install lsof

Run Banana PI from SATA

SDR

Pulseaudio

   
sudo apt-get install pulseaudio pulseaudio-module-zeroconf alsa-utils avahi-daemon pulseaudio-module-zeroconf pulseaudio-utils

The following is what I did just to get it working in per-session mode (not system mode). System mode may work as well, I haven't attempted it. Setting up server will require some more work. I found this information in various places, hopefully gathering it here will help someone.

Install pulseaudio and make sure user (e.g. over) is part of the audio group:

 sudo adduser over audio

Change /etc/asound.conf look like the following. This sets up pulseaudio to be used as an alsa device by default so applications use it without any additional configuration. The first two declarations (including the commented one) was in the original file.

pcm.mmap0 {
    type mmap_emul;
    slave {
      pcm "hw:0,0";
    }
}

pcm.pulse { type pulse }
ctl.pulse { type pulse }
pcm.!default { type pulse }
ctl.!default { type pulse }

Add the following lines to /etc/pulse/daemon.conf:

default-sample-rate = 48000
resample-method = trivial

OVERDRIVE'S CONFIG TO MAKE IT RUN

sudo nano /etc/pulse/default.pa

.nofail
.fail
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
load-module module-augment-properties
load-module module-switch-on-port-available
load-module module-pipe-sink
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
load-module module-detect
.endif
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif

load-module module-default-device-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-intended-roles
load-module module-suspend-on-idle

.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif

load-module module-position-event-sounds
load-module module-role-cork
load-module module-filter-heuristics
load-module module-filter-apply

.ifexists module-x11-publish.so
.nofail
load-module module-x11-publish
.fail
.endif

set-default-sink output
set-default-source input

To start the pulseaudio server, use:

 pulseaudio -k; pulseaudio -D

You might be also be able to set up in system-wide mode with:

sudo pulseaudio --system 

To debug, run:

 pulseaudio --log-level=debug

To test alsa, run:

 amixer -Dpulse