Banana Pi

From ArchWiki
Jump to: navigation, search

From the manufacturer:

Banana Pi is an open-source single-board computer. It can run Android 4.4, Ubuntu, Debian, Rasberry Pi Image, as well as the Cubieboard Image. It uses the AllWinner A20 SoC, and has 1GB DDR3 SDRAM

BananaPi is a minimalist computer built for the ARMv7-A architecture. More information about this project and technical specification.

With its Allwinner SoC, a Banana board usually runs the well documented Sunxi Linux kernel. So for any hardware or kernel related tasks, you should take a look at the Sunxi Wiki as well.

Note: The device is not officially supported by the ALARM project, i.e. please refrain from submitting patches, feature requests or bug reports for it.

Article preface

This article is strongly based on Raspberry Pi. Moreover this article is not meant to be an exhaustive setup guide and assumes that the reader has setup an Arch system before.

Installation

This method will install unmodified ArchLinuxARM armv7 basesystem to your Banana Pi, meaning you'll have the latest mainline kernel running.

Install basesystem to a SD card

Zero the beginning of the SD card:

# dd if=/dev/zero of=/dev/sdX bs=1M count=8

Use fdisk to partition the SD card, and format it with mkfs.ext4 -O ^metadata_csum,^64bit /dev/sdX1.

Mount the ext4 filesystem, replacing sda1 with the formatted partition:

# mkdir mnt
# mount /dev/sdX1 /mnt

Download and extract the root filesystem:

# wget http://archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz
# bsdtar -xpf ArchLinuxARM-armv7-latest.tar.gz -C /mnt/

Create a file with the following boot script

boot.cmd
part uuid ${devtype} ${devnum}:${bootpart} uuid
setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait

if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then
  if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
    if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
      bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
    else
      bootz ${kernel_addr_r} - ${fdt_addr_r};
    fi;
  fi;
fi

if load ${devtype} ${devnum}:${bootpart} 0x48000000 /boot/uImage; then
  if load ${devtype} ${devnum}:${bootpart} 0x43000000 /boot/script.bin; then
    setenv bootm_boot_mode sec;
    bootm 0x48000000;
  fi;
fi

Compile it and write it to the SD-card using the package uboot-tools

# mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "BananPI boot script" -d boot.cmd /mnt/boot/boot.scr
# umount /mnt

Compile and copy U-Boot bootloader

The next step is creating a u-boot image. Make sure you have arm-none-eabi-gcc, dtc, git and uboot-tools installed on your system. swig seems also to be needed. Then clone the u-boot source code and compile a Banana Pi image:

$ git clone git://git.denx.de/u-boot.git
$ cd u-boot
$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- Bananapi_defconfig 
$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi-

In case the following error shows up during the compilation:

 Traceback (most recent call last):
 File "./tools/binman/binman", line 31, in <module>
   import control
 File "/u00/thomas/Downloads/bananapi/u-boot/tools/binman/control.py", line 15, in <module>
   import fdt
 File "/u00/thomas/Downloads/bananapi/u-boot/tools/binman/../dtoc/fdt.py", line 13, in <module>
   import libfdt
 File "tools/libfdt.py", line 17, in <module>
   _libfdt = swig_import_helper()
 File "tools/libfdt.py", line 16, in swig_import_helper
   return importlib.import_module('_libfdt')
 File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
   __import__(name)
 ImportError: No module named _libfdt
 make: *** [Makefile:1149: u-boot-sunxi-with-spl.bin] Fehler 1

Make sure the python2 interpreter is used. To force that you could use for example:

$ virtualenv -p /usr/bin/python2.7 my_uboot
$ source my_uboot/bin/activate

Then compile again as above.

If everything went fine you should have an U-Boot image: u-boot-sunxi-with-spl.bin. Now dd the image to your sdcard, where /dev/sdX is your sdcard.

# dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8

Login / SSH

SSH login for root is disabled by default. Login with the default user account and use su.

Type Username Password
Root root root
User alarm alarm

X.org driver

The X.org driver for Banana Pi can be installed with the xf86-video-fbdev package.

Troubleshooting

Ethernet not working

In some cases, the Gbit ethernet connection is unstable or not working properly. It might help to limit the link speed to 100 Mbps using ethtool:

ethtool -s eth0 speed 100 duplex half autoneg off

Display turns off after idle and does not turn on again

If you also have an issue with the display turning off after some idle time and not turning on again, you might want to disable DPMS. Therefore add these X11 arguments to the proper configuration of your display manager.

-s 0 -dpms

For example, if you use SLiM, you would modify in your /etc/slim.conf:

xserver_arguments -nolisten tcp vt07 -s 0 -dpms 

If for some reason the display still keeps turning off, e.g. when restarting your receiving device, you can turn it on again, by temporary change the resolution:

# echo "D:1280x720p-60" > /sys/class/graphics/fb0/mode
# echo "D:1920x1080p-60" > /sys/class/graphics/fb0/mode

See also