Raspberry Pi to Banana Pi migration

You might have noticed that my site was down for maintenance on Wednesday, 2014-09-17. For better WordPress performance, I decided to migrate my blog to a brand-new Banana Pi server, featuring a Cortex-A7/ Allwinner A20 Dual-core CPU with Mali-400M2 GPU — that’s cheating — I know 😀.

Let’s go bananas … !

It took me a couple of hours and some tinkering to move my WordPress installation including the MySQL database onto the new server. So here are my first impressions:

To ease the migration, I copied Raspbian for Banana Pi 3.1 (2014-08-12) onto an new SD-card. I had quite a lot of hardware attached to my RasPi, however, lemaker.org promised that all of BananaPi’s GPIO pins are fully compatible to the RasPi header. Can it be true? In fact, it turned out that most of the hardware worked “out-of-the box”.
I plugged the Pi-Cobbler into the new machine and re-used most of the old Python code for controlling the existing hardware – very nice!

Update [2016-01-27]

I strongly recommend to use Igor’s custom-made Debian images on Armbian.com. Hardware support is much better than with LeMakers’s Bananian images.  For installation instructions, simply follow the pinned threads on the Armbian forum.

Solved problems …

In contrast to the Raspberry Pi, there are 512 MB more RAM available. Thus, on Raspbian for the Banana Pi, some drivers are not compiled into the kernel, such as modules for supporting 1-wire bus devices. Therefore, it is not necessary to insert the modules using modprobe or to add them into /etc/modules. The disadvantage is, that the drivers are constantly present in the memory, even without having 1-wire devices attached. Although there is plenty of RAM, I wanted to save as much memory as possible on my headless system. Therefore, I compiled a customized kernel (see below).

On my Raspberry Pi, I was able to change the GPIO pin for the 1-wire bus (default #4) within /boot/cmdline.txt. This is not supported on the Banana Pi, yet. It must be changed in the /boot/bananapi/script.bin file. In order to change the script.bin file, the sunxi-tools must be installed on the system. They are not included in the Raspbian 3.1 distribution but can be downloaded from github. The tools require manual installation:

apt-get install libusb-1.0-0-dev
git clone https://github.com/linux-sunxi/sunxi-tools

With the bin2fex tool, one can convert the script.bin into a script.fex file, which can be edited with nano or vi. To change the GPIO pin for the 1-wire bus, a new block must be inserted, containing the GPIO pin number of the 1-wire device:

gpio = 25

Then, script.fex is converted back to script.bin, using the fex2bin tool. After reboot, the Dallas temperature sensor can be found under /sys/bus/w1/devices. However, reading of the temperature turned out to be flakey because of a bug in the 3.4.90 kernel. As a workaround I installed cpu-frequtils and keept the CPU frequency above 600000 MHz, which can be configured in /etc/rc.local (default value was 300000).

According to this discussion thread, there will be a patch fixing this issue in the near future. Meanwhile, add the following lines to your /etc/rc.local to keep the CPU frrequency constantly above 600 Mhz:

echo 1000000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 600000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo 25 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
echo 10 > /sys/devices/system/cpu/cpufreq/ondeman/sampling_down_factor

Leave a Reply

Notify of