Rebuild Bananian Kernel with SATA Port Multiplier Support

jmb321 port multiplier

If you haven’t heard of the Banana Pi see some benchmarks first. You may have heard you can connect multiple SATA hard drives to your Banana Pi or other ARMv7 device. That currently requires a kernel rebuild for the Allwinner A20 chipset if you are using Bananian so it can see the port multiplier. I do recommend taking a backup of your sd card before proceeding. The goal is of course to have a proper NAS with SATA hard drives for downloading and serving media. Once you rebuild the kernel using this method you will have to use the port multiplier to connect drives – consider yourself warned, you cannot directly connect a hard drive to the SATA port when using this rebuilt kernel. You will have to switch back to your old kernel if you don’t want to use the port multiplier anymore.

Updated for Bananian 15.08 Jessie

Edit: You can now easily build a new image or download a prepared image!

banana pi media server nas port multiplier diagram

This kernel compilation process will take about 2 hours or so and is good experience for solving future problems. You can also just scroll to the bottom and grab the prepared image (img) with SATA port multiplier support.

I am using this with the JMB 321 port multiplier available on AliExpress which costs $29.00 including shipping

I got this 4 x 2.5″ in 5.25″ SATA bay 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.

In total it cost me about $70 to reuse older hard drives with this setup, I will also have a useful bay that I can use in future projects or servers.

Rebuild Bananian Kernel with SATA Port Multiplier Support

Install some necessary compilation tools on the Banana Pi

apt-get install git build-essential libncurses5-dev u-boot-tools uboot-mkimage screen -y

If you are on the latest Bananian Jessie 15.08 install these packages instead

apt-get install git build-essential libncurses5-dev u-boot-tools screen -y

Git clone the Banana Pi Bananian kernel

git clone --depth 1

Enter the Banana Pi folder

cd linux-bananapi

Edit the ahci file

nano drivers/ata/sw_ahci_platform.c

Change this line to enable the SATA port multiplier, you can use Ctrl+W to search for AHCI_HFLAG instead of scrolling

.private_data = (void*)(AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI

to this

.private_data = (void*)(AHCI_HFLAG_32BIT_ONLY | AHCI_HFLAG_NO_MSI

Start a screen session so in case your SSH session gets disconnected the compilation will continue


Keep everything default, and enter these commands one by one, the -j2 means to use 2 threads which should match the number of cores.

make sun7i_defconfig
make menuconfig
make -j2 uImage modules
make modules_install
mount /dev/mmcblk0p1 /boot
cp arch/arm/boot/uImage /boot

Reboot the machine


Connect your port multiplier and multiple hard drives and use this command to show the hard drives


Look at all those drives

/dev/mmcblk0p1: SEC_TYPE="msdos" UUID="4D17-5A3B" TYPE="vfat"
/dev/mmcblk0p2: UUID="1af97748-34b7-4a6e-a16d-29c409d9c367" TYPE="ext4"
/dev/sda1: LABEL="Test" UUID="b5e95c25-06ac-4377-b58b-d83c39a3e316" TYPE="ext4"
/dev/sdb1: LABEL="Disk1" UUID="ffd1ad88-3526-4815-ac2e-ff56b783e173" TYPE="ext4"
/dev/sdc1: LABEL="Disk1" UUID="14a4c57e-8a80-41ea-95a6-c4ecd2fb4cd5" TYPE="ext4"
/dev/sdd1: SEC_TYPE="msdos" LABEL="DellUtility" UUID="5450-4444" TYPE="ntfs"

They will also show up in Open Media Vault 🙂

banana pi port multiplier open media vault

Prebuilt Banana Pi Images with PMP Support

Edit: use the Jessie 4.1 PMP image here instead of the one linked to in this post!

Remember using either of these methods you can only use the port multiplier to read SATA drives. I am working on getting a modular PMP working with another kernel and hope to get it working with OpenMediaVault.