15 min read

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 article by, Ryad El-Dajani, author of the book, Banana Pi Cookbook, 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.

(For more resources related to this topic, see here.)

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:

Banana Pi Cookbook

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.

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.

In this article, we are going to ignore the installing of Android. For further information, please see Installing the Android OS image (LeMaker Wiki) at http://wiki.lemaker.org/BananaPro/Pi:SD_card_installation.

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.

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 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.

You can also check the customized Arch Linux image that author have built (http://blog.eldajani.net/banana-pi-arch-linux-customized-distribution/) for the Banana Pi and Banana Pro, including several useful applications.

Downloading an operating system for the Banana Pi

The following two recipes will explain how to set up the SD card with the desired operating system and how to get the Banana Pi up and running for the first time. This recipe is a predecessor.

Besides the device itself, you will need at least a source for energy, which is usually a USB power supply and an SD card to boot your Banana Pi. Also, a network cable and connection is highly recommended to be able to interact with your Banana Pi from another computer via a remote shell using the application.

You might also want to actually see something on a display. Then, you will need to connect your Banana Pi via HDMI, composite, or LVDS to an external screen. It is recommended that you use an HDMI Version 1.4 cable since lower versions can possibly cause issues.

Besides inputting data using a remote shell, you can directly connect an USB keyboard and mouse to your Banana Pi via the USB ports.

After completing the required tasks in the upcoming recipes, you will be able to boot your Banana Pi.

Getting ready

The following components are required for this recipe:

  • Banana Pi
  • SD card (minimum class 4; class 10 is recommended)
  • USB power supply (5V 2A recommended)
  • A computer with an SD card reader/writer (to write the image to the SD card)

Furthermore, you are going to need an Internet connection to download a Linux distribution or Android.

A few optional but highly recommended components are:

  • Connection to a display (via HDMI or composite)
  • Network connection via Ethernet
  • USB keyboard and mouse

You can acquire these items from various retailers. All items shown in the previous two pictures were bought from an online retailer that is known for originally selling books. However, the Banana Pi and the other products can be acquired from a large number of retailers. It is recommended to get a USB power supply with 2000mA (2A) output.

How to do it…

To download an operating system for Banana Pi, follow these steps:

  1. Download an image of your desired operating system. We are going to download Android and Raspbian from the official LeMaker image files website: http://www.lemaker.org/resources/9-38/image_files.html.

    The following screenshot shows the LeMaker website where you can download the official images:

    Banana Pi Cookbook

  2. If you are clicking on one of the mirrors (such as Google Drive, Dropbox, and so on), you will be redirected to the equivalent file-hosting service. From there, you are actually able to download the archive file.
  3. Once your archive containing the image is downloaded, you are ready to unpack the downloaded archive, which we will do in the upcoming recipes.

Setting up the SD card on Windows

This recipe will explain how to set up the SD card using a Windows operating system.

How to do it…

In the upcoming steps, we will unpack the archive containing the operating system image for the Banana Pi and write the image to the SD card:

  1. Open the downloaded archive with 7-Zip. The following screenshot shows the 7-Zip application opening a compressed .tgz archive:
  2. Unpack the archive to a directory until you get a file with the file extension .img. If it is .tgz or .tar.gz file, you will need to unpack the archive twice
  3. Create a backup of the contents of the SD card as everything on the SD card is going to be erased unrecoverablely.
  4. Open SD Formatter (https://www.sdcard.org/downloads/formatter_4/) and check the disk letter (E: in the following screenshot).
  5. Choose Option to open the Option Setting window and choose:
    • FORMAT TYPE: FULL (Erase)
    • FORMAT SIZE ADJUSTMENT: ON
  6. When everything is configured correctly, check again to see whether you are using the correct disk and click Format to start the formatting process.

Writing a Linux distribution image to the SD card on Windows

The following steps explain how to write a Linux-based distribution to the SD card on Windows:

  1. Format the SD card using SD Formatter, which we covered in the previous section.
  2. Open the Win32 Disk Imager (http://sourceforge.net/projects/win32diskimager/).
  3. Choose the image file by clicking on the directory button.
  4. Check, whether you are going to write to the correct disk and then click on Write.

Once the burning process is done, you are ready to insert the freshly prepared SD card containing your Linux operating system into the Banana Pi and boot it up for the first time.

Booting up and shutting down the Banana Pi

This recipe will explain how to boot up and shut down the Banana Pi. As the Banana Pi is a real computer, these tasks are as equally important as tasks on your desktop computer. The booting process starts the Linux kernel and several important services. The shutting down stops them accordingly and does not power off the Banana Pi until all data is synchronized with the SD card or external components correctly.

How to do it…

We are going to boot up and shut down the Banana Pi.

Booting up

Do the following steps to boot up your Banana Pi:

  1. Attach the Ethernet cable to your local network.
  2. Connect your Banana Pi to a display.
  3. Plug in an USB keyboard and mouse.
  4. Insert the SD card to your device.
  5. Power your Banana Pi by plugging in the USB power cable.

The next screenshot shows the desktop of Raspbian after a successful boot:

Banana Pi Cookbook

Shutting down Linux

To shut down your Linux-based distribution, you either use the shutdown command or do it via the desktop environment (in case of Raspbian, it is called LXDE). For the latter method, these are the steps:

  1. Click on the LXDE icon in the lower-left corner.
  2. Click on Logout.
  3. Click on Shutdown in the upcoming window.

To shut down your operating system via the shell, type in the following command:

$ sudo shutdown -h now

Connecting via SSH on Windows using PuTTY

The following recipe shows you how to connect to your Banana Pi remotely using an open source application called PuTTY.

Getting ready

For this recipe, you will need the following ingredients:

  • A booted up Linux operating system on your Banana Pi connected to your local network
  • The PuTTY application on your Windows PC that is also connected to your local area network

How to do it…

To connect to your Banana Pi via SSH on Windows, perform the following:

  1. Run putty.exe.
  2. You will see the PuTTY Configuration dialog.
  3. Enter the IP address of the Banana Pi and leave the Port as number 22 as.
  4. Click on the Open button. A new terminal will appear, attempting a connection to the Banana Pi.
  5. When connecting to the Banana Pi for the first time, you will see a PuTTY security alert. The following screenshot shows the PuTTY Security Alert window:
  6. Trust the connection by clicking on Yes.
  7. You will be requested to enter the login credentials. Use the default username bananapi and password bananapi.

When you are done, you should be welcomed by the shell of your Banana Pi. The following screenshot shows the shell of your Banana Pi accessed via SSH using PuTTY on Windows:

Banana Pi Cookbook

To quit your SSH session, execute the command exit or press Ctrl + D.

Searching, installing, and removing the software

Once you have your decent operating system on the Banana Pi, sooner or later you are going to require a new software. As most software for Linux systems is published as open source, you can obtain the source code and compile it for yourself.

One alternative is to use a package manager. A lot of software is precompiled and provided as installable packages by the so-called repositories. In case of Debian-based distributions (for example, Raspbian, Bananian, and Lubuntu), the package manager that uses these repositories is called Advanced Packaging Tool (Apt).

The two most important tools for our requirements will be apt-get and apt-cache.

In this recipe, we will cover the searching, the installing, and removing of software using the Apt utilities.

Getting ready

The following ingredients are required for this recipe.

  • A booted Debian-based operating system on your Banana Pi
  • An Internet connection

How to do it…

We will separate this recipe into searching for, installing and removing of packages.

Searching for packages

In the upcoming example, we will search for a solitaire game:

  1. Connect to your Banana Pi remotely or open a terminal on the desktop.
  2. Type the following command into the shell:
    $ apt-cache search solitaire
  3. You will get a list of packages that contain the string solitaire in their package name or description.
  4. Each line represents a package and shows the package name and description separated by a dash ().

Now we have obtained a list of solitaire games:

Banana Pi Cookbook

The preceding screenshot shows the output after searching for packages containing the string solitaire using the apt-cache command.

Installing a package

We are going to install a package by using its package name. From the previous received list, we select the package ace-of-penguins.

  1. Type the following command into the shell:
    $ sudo apt-get install ace-of-penguins
  2. If asked to type the password for sudo, enter the user’s password.
  3. If a package requires additional packages (dependencies), you will be asked to confirm the additional packages.
  4. In this case, enter Y.
  5. After downloading and installing, the desired package is installed:

Removing a package

When you want to uninstall (remove) a package, you also use the apt-get command:

  1. Type the following command into a shell:
    $ sudo apt-get remove ace-of-penguins
  2. If asked to type the password for sudo, enter the user’s password.
  3. You will be asked to confirm the removal.
  4. Enter Y.
  5. After this process, the package is removed from your system.

You will have uninstalled the package ace-of-penguins.

Summary

In this article, we discovered the installation of a Linux operating system on the Banana Pi. Furthermore, we connected to the Banana Pi via the SSH protocol using PuTTY. Moreover, we discussed how to install new software using the Advanced Packaging Tool.

This article is a combination of parts from the first two chapters of the Banana Pi Cookbook.

In the Banana Pi Cookbook, we are diving more into detail and explain the specifics of the Banana Pro, for example, how to connect to the local network via WLAN. If you are using a Linux-based desktop computer, you will also learn how to set up the SD card and connect via SSH to your Banana Pi on your Linux computer.

Resources for Article:


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here