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)


Packed with recipes for the Banana Pi, solving the most common real-world problems, viewers get a practical assistance to avoid difficulties.

Full of supportive guides, this book is designed to help you build and expand your device into a versatile box. Any computer enthusiast can quickly learn how to become a Banana Pi expert, while not requiring skills in programming or Linux. Banana Pi Cookbook will allow you to use the technology start from the very beginning, through the daily usage and maintenance, up to setting up a WordPress from scratch, sharing files using Samba or ownCloud, blinking an LED, or playing 1080p videos.

What this book covers

Chapter 1, Installation and Setup, introduces the Banana Pi device. It also explains which distributions are available and how to download and install a Linux distribution. Moreover, we present Android as a contrast to our upcoming Linux adventure.

Chapter 2, Administration, introduces the reader to the most common tools to administrate their fresh Linux installation. We will connect remotely using SSH from Windows (using PuTTY) and Linux (using the command-line SSH application). Besides user modification (adding a new user, changing passwords, and so on), we will also cover basic maintenance tasks, such as searching and installing a new software, updating the system using the distributions package manager, and so on.

Chapter 3, External Disks, covers all about external disk drives. We will connect and mount USB drives and HDD drives using the SATA interface and explore the possibility of switching the root filesystem to and boot from an external drive.

Chapter 4, Networking, presents recipes for common networking tasks using the Banana Pi. One of the key strengths of the device is the fast Ethernet and wireless (Banana Pro) adapters it provides—especially combined with the fast SATA interface—which is the base of powerful network applications.

Chapter 5, Using the GPIO Pins, introduces the GPIO pins. We will light up an LED using the shell. Furthermore, we will build a simple circuit, including a pull-up resistor and control an LED with a button. To achieve this, we will introduce the C programming language with the WiringPi library and the Python scripting language with the RPi.GPIO library.

Chapter 6, Multimedia, covers configuring the two audio outputs (line out and HDMI). We will discuss and solve the hardware acceleration problem by compiling important components and using these mentioned components to build video players and Kodi. The configuration of a remote control using LIRC is also covered.

What you need for this book

The following is a list of things that you'll need to follow along with the recipes of this book:

  • A Banana Pi and/or a Banana Pro

  • An SD card

  • An SD card reader

  • A 5V USB power supply

  • A network connection (Ethernet and/or WiFi on Banana Pro)

  • An HDMI or a composite connection for display

  • A USB keyboard and a mouse

  • A Windows or Linux operating system

  • An external HDD/SSD plus a power supply and a SATA connection for Chapter 3, External Disks

  • A breadboard and various electrical components for Chapter 5, Using the GPIO Pins

Who this book is for

This book is intended for anybody who wants to learn how they can utilize the capabilities of the Banana Pi to its full potential. It's full of step-by-step guides and detailed descriptions for the whole range of possibilities in a language that is appropriate for computer enthusiasts and experts alike. It would be helpful to have a basic knowledge of Unix-like operating systems or programming, but no prior experience is required as every concept is explained in the appropriate sections.


In this book, you will find several headings that appear frequently (Getting ready, How to do it, How it works, There's more, and See also).

To give clear instructions on how to complete a recipe, we use these sections as follows:

Getting ready

This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.

How to do it…

This section contains the steps required to follow the recipe.

How it works…

This section usually consists of a detailed explanation of what happened in the previous section.

There's more…

This section consists of additional information about the recipe in order to make the reader more knowledgeable about the recipe.

See also

This section provides helpful links to other useful information for the recipe.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The commands used in the next steps assume that your SD card is recognized as /dev/mmcblk0."

A block of code is set as follows:

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

Any command-line input or output is written as follows:

$ sudo cp interfaces interfaces.backup

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Choose the write mode Startup and click on Format to Normal."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to and enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

eBooks, discount offers, and more

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

At, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.


If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.