I have previously posted about how to rebuild the Bananian kernel to include port multipler support so you can connect multiple hard drives to the Banana Pi through SATA. Thanks to Igor's images for Armbian and his build scripts it is ridiculously easy to make your own image that is guaranteed to work on the Banana Pi. Incidentally it will also work on the Orange Pi devices that are based on the Allwinner A20 chipset (the H3 chipset devices like the Orange Pi 2 and Plus are not currently supported). I have also included a prebuilt image at the bottom of this post for Debian Jessie.
|Raspberry Pi 3
|Raspberry Pi 2
|Banana Pi Pro
I am using this custom Banana Pi image with the JMB 321 port multiplier available on AliExpress which costs $29.00 including shipping. I got this 4 x 2.5″ bay ($30) which allows you to put 4 2.5″ hard drives into a single 5.25″ bay and a molex to DC power adapter to power the 4 hard drives in the bay. I plan to use 4 x 2 TB Samsung drives eventually running SnapRAID.
For under $70 I could use older hard drives with this setup, I will also have a useful bay that I can use in future projects or servers.
Build the Custom Debian Image for Banana Pi Pro SATA Port Multiplier
You are going to build a minimal Banana Pi debian image with port multiplier support enabled in the kernel as a module so it can be enabled and disabled by adding a single line to a configuration file. This requires a Ubuntu 64 bit environment, if you are on Windows you can create a virtual machine using Virtualbox or VMPlayer to create the virtual machine.
SSH into your virtual machine or run the terminal directly on it.
Make sure you have git installed
sudo apt-get install git build-essential -y
Git clone Igor's Banana Pi build scripts
git clone https://github.com/igorpecovnik/BananaPI-Debian
Edit the main build script
sudo nano build.sh
Change BRANCH to use the mainline latest and greatest updates denoted by next
Adjust kerneltag so it uses 3.19.7, eventually it will be able to use Kernel 4.0
Now build the kernel
sudo bash build.sh
You will eventually be prompted for some configuration options, I just accepted the defaults by pressing Enter.
You will now have a working Banana Pi Pro image that supports WiFi and non-WiFi models and modular SATA port multiplier support!
The image that you can burn to your sd card sitting inside a zip file called Bananapi_Debian_3.0_wheezy_3.19.7.zip.
When it's done transfer the image zip onto a USB and unpack it (hint you can connect USB devices to the Virtual machine). You will see a .raw file you can rename to .img and flash with Win32Imager, Apple Pi Baker or whatever you usually use to write the image to the SD card.
For those curious, you can see the configuration file which enables the SATA port multipler, we are using the next branch so it's this file
sudo nano lib/config/linux-sunxi-next.config
CONFIG_AHCI_SUNXI= should be set to m for modular. In newer kernels (4.x-ish this may no longer be possible and it will need to be y instead of m)
I also set these options which enable the PMP and are meant to help with input output speeds (SCHED)
Ctrl+X, Y and Enter to save the configuration
After running build.sh the first time you already have the kernel and image. After you make changes like the ones above, you rebuild it using the same command, this time it will go much faster (like 15 minutes) to update the image with your new kernel configuration.
sudo bash build.sh
Test Banana Pi Pro SATA Port Multiplier
SSH in to the Banana Pi with your custom image, the default username is root with password 1234
Use this command to make sure the compilation was successful in including the module we needed
zgrep CONFIG_AHCI_SUNXI /proc/config.gz
It should output
To enable the module for the port multiplier open this file
Add this line
options ahci-sunxi enable_pmp=1
Ctrl+X, Y and Enter to save
Reboot with your hard drives connected and the jmn321 or other port multipler connected to power
Use blkid to see the hard drives show up
Look at those drives ready for media content
Now I can see the 4 x 2 TB Samsung drives I bought for this project.
/dev/mmcblk0p1: UUID="a73fb24c-de15-4a1f-a4fe-b6436f8d98f3" TYPE="ext4"
/dev/sda1: LABEL="HTPC Guides 1" UUID="190D-153C" TYPE="vfat"
/dev/sdb1: LABEL="HTPC Guides 2" UUID="1917-2940" TYPE="vfat"
/dev/sdc1: LABEL="HTPC Guides 3" UUID="19E3-1C09" TYPE="vfat"
/dev/sdd1: LABEL="HTPC Guides 4" UUID="1911-0E2F" TYPE="vfat"
If you ever want to disable the port multiplier, just remove the options ahci-sunxi enable line.
Enable WiFi on Banana Pi Pro with Igor's Image
Backup the dtb module just in case and overwrite the dtb module with the Banana Pro one
cp /boot/dtb/sun7i-a20-bananapi.dtb /boot/dtb/sun7i-a20-bananapi.dtb.bak
mv /boot/dtb/sun7i-a20-bananapipro.dtb /boot/dtb/sun7i-a20-bananapi.dtb
Enable the WiFi module
Generate a hashed passphrase, replace SSID with your wireless router's SSID and wifipassword with the actual password to access WiFi.
wpa_passphrase SSID wifpassword
You will get output like this
Copy the psk line without the psk= part
Now we need to add the configuration to your network interfaces file
Uncomment your wlan0 section and add the SSID and psk hash you generated before
# Wireless adapter #1
iface wlan0 inet dhcp
Ctrl+X, Y and Enter to save
Use iwconfig to show that the wireless is connected
You will see the wireless overview for the Banana Pi
wlan0 IEEE 802.11bgn ESSID:"HTPCGuides"
Mode:Managed Frequency:2.412 GHz Access Point: 10:7B:FF:EA:47:D5
Bit Rate=58.5 Mb/s Tx-Power=1496 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Link Quality=62/70 Signal level=-48 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
Banana Pi Pro Port Multiplier Image
This image will work out of the box. It will resize your sd card upon the first boot and regenerate SSH keys. The default SSH login is root with password htpcguides that you will be forced to change on the first login. There is also an Media Server Installer which I will post how to use in a day or two (it is in /root/HTPCGuides, more info here)