Book Image

Banana Pi Cookbook

By : Ryad El-Dajani
Book Image

Banana Pi Cookbook

By: Ryad El-Dajani

Overview of this book

Table of Contents (13 chapters)

Introduction


The Banana Pi is a single-board computer, which enables you to build your own individual and versatile system. In fact, it is a complete computer, including all the required elements such as a processor, memory, network, and other interfaces, which we are going to explore. It provides enough power to run even relatively complex applications suitably.

In this chapter, we are going to get to know the Banana Pi device. The available distributions are mentioned, as well as how to download and install these distributions. We will also examine Android in contrast to our upcoming Linux adventure.

Thus, you are going to transform your little piece of hardware into a functional, running computer with a working operating system. You will master the whole process of doing the required task from connecting the cables, choosing an operating system, writing the image to an SD card, and successfully booting up and shutting down your device for the first time.

Banana Pi Overview

In the following picture, you see a Banana Pi on the left-hand side and a Banana Pro on the right-hand side:

As you can see, there are some small differences that we need to notice. The Banana Pi provides a dedicated composite video output besides the HDMI output. However, with the Banana Pro, you can connect your display via composite video output using a four-pole composite audio/video cable on the jack.

In contrast to the Banana Pi, which has 26 pin headers, the Banana Pro provides 40 pins. Also the pins for the UART port interface are located below the GPIO headers on the Pi, while they are located besides the network interface on the Pro.

The other two important differences are not clearly visible on the previous picture. The operating system for your device comes in the form of image files that need to be written (burned) to an SD card. The Banana Pi uses normal SD cards while the Banana Pro will only accept Micro SD cards. Moreover, the Banana Pro provides a Wi-Fi interface already on board. Therefore, you are also able to connect the Banana Pro to your wireless network, while the Pi would require an external wireless USB device.

Besides the mentioned differences, the devices are very similar. You will find the following hardware components and interfaces on your device.

On the back side, you will find:

  • A20 ARM Cortex-A7 dual core central processing unit (CPU)

  • ARM Mali400 MP2 graphics processing unit (GPU)

  • 1 gigabyte of DDR3 memory (that is shared with the GPU)

On the front side, you will find:

  • Ethernet network interface adapter

  • Two USB 2.0 ports

  • A 5V micro USB power with DC in and a micro USB OTG port

  • A SATA 2.0 port and SATA power output

  • Various display outputs [HDMI, LVDS, and composite (integrated into jack on the Pro)]

  • A CSI camera input connector

  • An infrared (IR) receiver

  • A microphone

  • Various hardware buttons on board (power key, reset key, and UBoot key)

  • Various LEDs (red for power status, blue for Ethernet status, and green for user defined)

As you can see, you have a lot of opportunities for letting your device interact with various external components. In the upcoming chapters, we are going to explore most of the possibilities in detail.

Operating systems for the Banana Pi

The Banana Pi is capable of running any operating system that supports the ARM Cortex-A7 architecture. There are several operating systems precompiled, so you are able to write the operating system to an SD card and boot your system flawlessly. Currently, there are the following operating systems provided officially by LeMaker, the manufacturer of the Banana Pi.

Android

Android is a well-known operating system for mobile phones, but it is also runnable on various other devices such as smart watches, cars, and, of course, single-board computers such as the Banana Pi.

The main advantage of running Android on a single-board computer is its convenience. Anybody who uses an Android-based smartphone will recognize the graphical user interface (GUI) and may have less initial hurdles. Also, setting up a media center might be easier to do on Android than on a Linux-based system.

However, there are also a few disadvantages, as you are limited to software that is provided by an Android store such as Google Play. As most apps are optimized for mobile use at the moment, you will not find a lot of usable software for your Banana Pi running Android, except some Games and Multimedia applications. Moreover, you are required to use special Windows software called PhoenixCard to be able to prepare an Android SD card.

Because of the mentioned disadvantages, this book will show you how to get Android up and running, but focus on Linux-based distributions in the next chapters.

Linux

Most of the Linux users never realize that they are actually using Linux when operating their phones, appliances, routers, and many more products, as most of its magic happens in the background. We are going to dig into this adventure to discover its possibilities when running on our Banana Pi device.

The following Linux-based operating systems—so-called distributions—are used by the majority of the Banana Pi user base and are supported officially by the manufacturer:

  • Lubuntu: This is a lightweight distribution based on the well-known Ubuntu using the LXDE desktop, which is principally a good choice, if you are a Windows user.

  • Raspbian: This is a distribution based on Debian, which was initially produced for the Raspberry Pi (hence the name). As a lot of Raspberry Pi owners are running Raspbian on their devices while also experimenting with the Banana Pi, LeMaker ported the original Raspbian distribution to the Banana Pi. Raspbian also comes with an LXDE desktop by default.

  • Bananian: This too is a Debian-based Linux distribution optimized exclusively for the Banana Pi and its siblings.

All of the aforementioned distributions are based on the well-known distribution, Debian. Besides the huge user base, all Debian-based distributions use the same package manager Apt (Advanced Packaging Tool) to search for and install new software, and all are similar to use. In the upcoming recipes, we are going to use Raspbian. However, most recipes will be valid for the other Debian-based distributions.

There are still more distributions that are officially supported by LeMaker, such as Berryboot, LeMedia, OpenSUSE, Fedora, Gentoo, Scratch, ArchLinux, Open MediaVault, and OpenWrt. All of them have their pros and cons or their specific use cases. If you are an experienced Linux user, you may choose your preferred distribution from the mentioned list, as most of the recipes in this book are similar to, or even equally usable on, most of the Linux-based operating systems.

Moreover, the Banana Pi community publishes various customized Linux distributions for the Banana Pi regularly. The possible advantages of a customized distribution may include enabled and optimized hardware acceleration capabilities, supportive helper scripts, fully equipped desktop environments, and much more. However, when deciding to use a customized distribution, there is no official support by LeMaker and you have to contact the publisher in case you encounter bugs, or need help.