Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Banana Pi Cookbook
  • Table Of Contents Toc
Banana Pi Cookbook

Banana Pi Cookbook

By : RYAD E DAJANI, Ryad El-Dajani
4.5 (2)
close
close
Banana Pi Cookbook

Banana Pi Cookbook

4.5 (2)
By: RYAD E DAJANI, Ryad El-Dajani

Overview of this book

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.
Table of Contents (8 chapters)
close
close

Setting up the SD card on Linux

This recipe will explain how to set up the SD card using a Linux-based operating system. On Linux computers, you usually will not need any special software to uncompress archives or write the image to an SD card. To do these tasks, you usually need the command-line tools tar and dd that are preinstalled on almost any Linux distribution by default.

Getting ready

To prepare your image and the SD card on Linux, you will only need the following software ingredients:

  • A downloaded image from the Downloading an operating system for the Banana Pi recipe
  • The dd program
  • The tar program including gzip support
  • Optionally, the fdisk program

How to do it…

The following steps are required to unpack the image archive and write the image to the SD card:

Note

Use the following dd command very carefully. The dd command will overwrite anything on the output (the of parameter). In fact, you can damage your computer, if you choose the wrong output. So, make sure that the value of the parameter of is definitely the SD card.

  1. Unpack the downloaded .tar.gz or .tgz archive using the following command:
    $ tar -xzvf Raspbian_For_BananaPi_v1412.tgz
    
  2. If you have downloaded a .zip file, you use the following command:
    $ unzip Raspbian_For_BananaPi_v1412.zip
    
  3. Determine how your SD card is recognized by the system. You can check the correct path of your SD card by using the following command:
    $ sudo fdisk -l
    

    Tip

    To determine the correct device, you can compare the results before and after you plug in the SD card.

    The commands used in the next steps assume that your SD card is recognized as /dev/mmcblk0.

  4. Make a backup of the contents on your SD card.
  5. Unmount all partitions of the SD card, if any partition is mounted:
    $ sudo umount /dev/mmcblk0*
    
  6. Write the image to the SD card:
    $ sudo dd if=Raspbian_For_BananaPi_v1412.img of=/dev/mmcblk0 bs=1M
    

    The writing process takes a few minutes.

  7. On some systems, the SD card is automatically mounted after the writing process. Unmount the partitions of the SD card again:
    $ sudo umount /dev/mmcblk0*
    

When the writing process is finished, you can eject your SD card and put it into the SD slot of your Banana Pi.

How it works…

On Linux, you also need to unpack an image file and write the image to the SD card. Luckily, these tasks are much quicker and more easily done on the command line and you usually do not need to install additional software.

In fact, to unpack the image, you need the tar command and to write an image to the SD card you need the dd (disk dump) command. The tool tar is a program to pack or unpack archive files. The tool dd is a utility to convert and copy files from a source (the input file—the if parameter) to a destination (the output file—the of parameter). In contrast to a normal file copy, the actual order of the bytes is preserved.

The dd command is executed with root privileges (by using the prefix command sudo) to use the image file as input, the SD card as output, and to read/write with a block size (the bs parameter) of one megabyte. That block size value is a safe choice when writing images to or reading from SD cards. You can also try a block size value of 4M, which results in a faster but possibly unsuccessful writing process.

You do not need to format the SD card before issuing the dd command as dd also writes the whole partition information directly to the SD card.

Note

The output parameter has to be the whole SD card (/dev/mmcblk0 in our previous example). Make sure not to accidentally write to a partition of the SD card. This means do not use /dev/mmcblk0p1 or the like).

Moreover, depending on your computer, the SD card may be recognized as /dev/sdX and not /dev/mmcblk0. Use the fdisk -l command to determine the correct device file as mentioned in this recipe.

The dd command will take some time. If you want to check the progress, you can issue the following command in another shell:

$ sudo pkill -USR1 -n -x dd

This will output the current status on the running dd job.

See also

  • Type in the man dd command into a shell to show the manual page of dd:
    $ man dd
    
  • Type in the man tar command into a shell to show the manual page of tar:
    $ man tar
    
  • Type in the man fdisk command into a shell to show the manual page of fdisk:
    $ man fdisk
    
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Banana Pi Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon