Sunday, December 27, 2015

Banana Pi sata port multiplier


Banana Pi Sata port multiplier

http://www.htpcguides.com/build-debian-image-for-banana-pi-pro-sata-port-multiplier/

following from above blog

Buildup for raid nas server using banana pi and port expander.

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
cd BananaPI-Debian
sudo nano build.sh
Change BRANCH to use the mainline latest and greatest updates denoted by next
BRANCH="next"
Adjust kerneltag so it uses 3.19.7, eventually it will be able to use Kernel 4.0
KERNELTAG="v3.19.7"
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
CONFIG_AHCI_SUNXI=m
I also set these options which enable the PMP and are meant to help with input output speeds (SCHED)
CONFIG_SATA_PMP=y
CONFIG_SCHED_MC=y
CONFIG_SCHED_SMT=y
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
CONFIG_AHCI_SUNXI=m
To enable the module for the port multiplier open this file
nano /etc/modprobe.d/ahci-sunxi.conf
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
sudo reboot
Use blkid to see the hard drives show up
blkid
Look at those drives ready for media content
Now I can see the 4 x 2 TB Samsung drives I bought for this project.
root@bananapi:~# blkid
/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
modprobe brcmfmac
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
network={
ssid="HTPCGuidesSSID"
#psk="htpcguides"
psk=c78152ab34bbac9fa172f0572a63d313195da3763d0eeef8ee903ee9c921f8c5
}
Copy the psk line without the psk= part
Now we need to add the configuration to your network interfaces file
nano /etc/network/interfaces
Uncomment your wlan0 section and add the SSID and psk hash you generated before
# Wireless adapter #1
auto wlan0
        allow-hotplug wlan0
        iface wlan0 inet dhcp
        wpa-ssid HTPCGuidesSSID
        wpa-psk c78512ab34b3ac9f2172f0572a63d313195da3763d0e4ef8ee903ee9c921f8c5
Ctrl+X, Y and Enter to save
Reboot
reboot
Use iwconfig to show that the wireless is connected
iwconfig
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
          Encryption key:off
          Power Management:on
          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)

No comments:

Post a Comment