Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
BeagleBone Black Cookbook
BeagleBone Black Cookbook

BeagleBone Black Cookbook: Over 60 recipes and solutions for inventors, makers, and budding engineers to create projects using the BeagleBone Black

eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

BeagleBone Black Cookbook

Chapter 1. Setting Up for the First Time

In this chapter, we will focus on the following topics:

  • First boot up
  • Power requirements – basic guidelines
  • Display
  • Essential GNU/Linux commands – the command shell
  • Essential GNU/Linux commands – typical commands
  • Edit a text file from the command shell
  • Connectivity
  • Package management – Installing packages using apt-get
  • SSH / Remote access
  • System images

Introduction

Getting off to a running start with your BeagleBone Black requires diving into a number of fundamental recipes first. After all, you have to learn to chop and dice before making a proper soup.

As you probably already know, creating the right development environment saves time, reduces errors, and creates a good workflow. To this end, after we get our display hardware hooked up, it's critical to learn a bit about the Linux commands that power our projects. Then, we will move on to getting your board both connected online and controlled remotely over a network. Next, we will learn the basics of installing and managing applications (packages). Finally, we will explore how to get an OS onto your board, whether it's with the internal solid-state drive (eMMC) or via an SD card.

First boot up

BeagleBone Black (BBB) designers have worked hard to simplify the user's first out-of-the-box experience. Although things get more challenging later, which is natural, it is pretty close to Plug and Play at the outset.

You do not even need to load any software as the platform arrives preloaded with a custom distribution of Linux Debian on the internal solid-state drive (eMMC).

Getting ready

Here's what you need:

  • Desktop client PC: As noted in the introduction, we will principally be using a Mac box as our client machine. However, the following steps apply equally to a Windows or Linux machine.
  • USB cable: A mini USB-B to USB cable is required, which is typically supplied with your board.
  • BeagleBone Black Rev. C: To reiterate a point from this book's introduction, our recipes use Rev. C, which is the currently shipping version of the board. If you have an earlier board, you may run into occasional conflicts with the recipes.

How to do it…

Perform the following steps:

  1. To power up, plug the USB cable into the BBB and your client box.
  2. Wait for the three blue LEDs to light up; each of them functions as a useful indicator of the board's health:
    • Power: Once power is supplied to the board, the LED next to the 5V barrel jack will remain on without flashing
    • USR0: Next to the tiny reset button (S1), this light maintains a continuous, solid "heartbeat" blink when powered
    • USR2: Two down from the Ethernet jack, this LED flutters subtly during CPU access
    How to do it…

    Note

    Unless otherwise noted, all images are copyright Charles A. Hamilton.

  3. Within a few moments on your client machine, the BEAGLE_BONE drive should appear as a visible volume on your desktop. Browse the folder and open up the START.htm file.
  4. Once opened, you will find a clear set of quick start steps, including how to install drivers (if needed).
  5. Browse your board—BeagleBone Black's boot system includes a handy web server that allows immediate connectivity. Clicking on the link will take you to the local IP address of the board at 192.168.7.2. Once there, you will find a very helpful presentation on the board.

    There is no reason to recapitulate all the material covered in the START.htm presentation. Instead, review it as a good jumping off point for the upcoming recipes in this chapter.

Getting ready

Power down: Before proceeding, remove all cables and power (USB, Ethernet, DC cord, HDMI, and so on).

How to do it...

Perform the following steps:

  1. Connect the USB cable: With a USB 2.0 A to Mini-B cable, connect the BBB to a USB port on your desktop PC.
  2. Look for status lights: After plugging in the USB cable, you will see the board's first LED light up, followed subsequently by the three other LEDs. If all goes well, the BEAGLE_BONE device will appear on your desktop.
  3. Install drivers: I won't belabor this step. It suffices to say that your desktop—whether it's a Windows, Mac, or Linux machine—requires certain drivers to recognize and run the BBB via USB properly. If your desktop OS doesn't come with the drivers already installed (as some do), install them via the link, http://beagleboard.org/Getting-Started.
  4. Once your drivers are installed, browse to the BASIC_START.htm file on the BEAGLE_BONE device and open it.

If the planets are aligned and the drivers are installed properly, you will see the following at the top of the browser window:

Your board is connected! BeagleBone Black rev 0A5C S/N xxxxxxxxxxxx running BoneScript 1.2.3 at 192.168.7.2.

At this point, you're ready to fly; at least at low altitude. With a co-pilot…on an emulator.

Power requirements – basic guidelines

Giving your BBB the proper amount of love and power is crucial to having a happy board. Following these basic guidelines will ensure that your BBB operates reliably and predictably.

The board's user manual recommends that you supply current to at least 1.2A (or 6W). However, if you connect up anything over the USB, at least 2A (or 10W) is recommended. Here are some additional rules of thumb:

  • You can power the BBB via the USB tether. However, if you attach additional USB devices, such as webcams, Wi-Fi or Bluetooth dongles, keyboards and mice, and then power them through the USB tether, it may lead to unreliable connections and power fluctuations. We were successful in powering some USB dongles directly via the BBB's USB port, whereas some devices, such as USB webcams, were not reliably powered.
  • If you connect USB devices, it is best to power them from a powered USB hub and then supply power to the BBB via a 5 VDC power supply of at least 1A.
  • 5V DC power—most users of the board will invariably recommend that you always power your board using a 5V DC supply.
  • You can also use a 5V wall charger power adapter with a USB port on it as long as it can deliver 1A.

Tip

Downloading the example code

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

In many cases, you will also be downloading code from the author's github site at https://github.com/HudsonWerks.

Display

The BBB's on board micro HDMI port provides a relatively easy way to attach a display device. With the new Debian distribution, compatibility, and ease of installation, the process is greatly simplified. We will take a look at two types of devices you may be using: an HDMI monitor and a small form-factor LCD (without HDMI).

Note

Using a display is not a requirement to operate the board and is merely optional. You will learn how to control the BBB without a display later in this chapter.

Connecting an HDMI LCD

Running your board with an HDMI monitor is the default method to use your BBB.

How to do it...

  1. Check the compatibility list for your HDMI LCD monitor at http://elinux.org/Beagleboard:BeagleBone_Black_Accessories#Monitors_and_Resolutions.

    Given the large universe of LCDs out there, this is not a definitive list. However, it does lend guidance on displays that will work with the BBB. You will also be pleasantly surprised that most consumer-grade HDTVs work pretty well out of the box with your board.

  2. Check your resolution at http://elinux.org/Beagleboard:BeagleBoneBlack_HDMI.
  3. Plug in one end of your HDMI cable to your monitor and the other end, which is the micro HDMI end, into your powered-down BBB.
  4. Fulfill the power requirements; power up your board with a 5V adapter.

    Note

    Since HDMI displays can draw a lot of power, don't try to run off your desktop's USB slot. Otherwise, you will get flaky results at best and, more likely, no picture at all.

  5. You should get a straightforward boot up into the default desktop "beagle" screen.

Connecting a non-HDMI LCD or cape

There's no obligation to use only an HDMI display on BeagleBone Black. For example, with the right HDMI to VGA converter cable, you can actually attach a standard VGA monitor to the BBB. Compatible converters can be found at http://elinux.org/Beagleboard:BeagleBone_Black_Accessories#HDMI_Adapters.

You may also develop an embedded prototype device that only needs a small LCD and no HDMI. Here's one recipe for a scenario using a 3.5-inch screen from Circuitco (http://elinux.org/CircuitCo:BeagleBone_LCD3) that I've used in my own projects. The display is in the category of add-ons to the BBB called capes, which are akin to the shields on an Arduino board. Capes are typically robust daughterboards and, unfortunately, tend to be much more expensive than Arduino add-ons.

Connecting a non-HDMI LCD or cape

CircuitCo LCD3 cape

How to do it...

Perform the following steps:

  1. Power down your board.
  2. Examine the header pins at the bottom of the LCD3 and note the pin layout: one short row and one longer row. Also, note the Power (PWR) button at one end.
    How to do it...

    The pin line up at the bottom of the PCB (printed circuit board)

    How to do it...
  3. Position the long row of pins on the LCD on top of the P9 pin slots on the BBB and the short pin row on the P8 row. Don't push the pins in yet. The PWR button should rest between the Ethernet port and the 5V barrel jack, as in the following image:
    How to do it...
  4. Next, slowly push the pins into the BBB headers. All pins should go in more or less simultaneously. It's a little tricky as you also have to squish the PWR button in place at the same time so that it lodges snugly between the 5V barrel and the Ethernet jack, as in the following image:
    How to do it...
  5. All pins on both sides of the LCD should be firmly pushed into place on the board, and the PWR button should be securely squeezed in place.
  6. Power up your board. Most distributions—including the Debian firmware, of course—have compatible drivers for the display, so you should boot right into your desktop within a few moments.

There's more…

For more information on the following topics, refer to the respective websites:

Essential GNU/Linux commands – the command shell

Fancy GUIs are nice, but on BeagleBone Black, you will be mainly working with the command shell and its accompanying command-line tools to provide access to the operating system. First, let's take a look at some terminology: command shell, command-line shell, command line, or simply shell will all be used somewhat interchangeably as they all basically refer to the same thing—a means to provide access to the operating system with the command line and without a GUI. Bash is the default shell on Linux.

Terminal is yet another typical way to refer to the shell. The term is derived from its preceding technologies where any interaction with a computer required using a text-based terminal interface.

Often intimidating to new users, command shell is the starting point for any serious embedded system project. The Debian distribution for BeagleBone Black comes preloaded with two command-line tools to use a command shell: LXTerminal and Root Terminal. Although there are others with more robust and colorful interfaces that you can install, such as xterm and eterm, for simplicity's sake, we will use LXTerminal. In the next section, you will learn about the command syntax required within the tool. Finally, we will create, edit, and save a text file from the command line.

Getting ready

Ensure that your BeagleBone Black is set up and running in the manner described in the Introduction section. (Note that here, we will show the two different methods of running the board: powered via USB and powered via 5V).

How to do it...

  1. Begin by opening up LXTerminal, which you will find in the Accessories application on the lower left-hand side of the screen:
    How to do it...
  2. You will now see a command prompt that looks similar to this on your screen:
    How to do it...
  3. Just for fun, let's type in the following at the command prompt:
    debian@beaglebone:~$  echo Can you hear me Major Tom?
    

    This will show the following output:

    How to do it...

Congratulations! You've just sent your first command to BeagleBone Black (and it wasn't Hello World). But we're getting ahead of ourselves. Commands are for the next section.

How it works...

Let's take a quick look at the various parts of what LXTerminal shows us. Firstly, we know that Linux likes to keep the current user name at the front and center, in this case debian. This way, you always have a quick reference point to know whether you are a root user, which gives you total control over the system, or just another user with limited privileges.

Then comes the address of the device you're working on: beaglebone. You can actually customize the name, but we will save that for the appendix. Lastly, consider the $ sign, which denotes that you're logged in as a regular user. If you were a root user, the symbol would be the # sign. You will learn more about users and root users in a later section.

How it works...

Essential GNU/Linux commands – typical commands

The command line is your friend.

For advanced users, this is an obvious statement; for the beginner, not so friendly. Where do you start with that darn blinking cursor?

How many Linux commands are there? A whole bunch. Thousands. Tens of thousands depending on dependencies and packages. But don't worry, you don't have to learn them all.

Saying or writing something original about Linux commands is a bit difficult: far smarter, folks than I have written about, compiled, and battle-tested the multiple combinations of commands available to the Linux user. And this book is not intended to be about Linux commands. So instead, I will give you a handful of basic commands that I find myself consistently using on the BBB and also provide you with some of my favorite reference materials and cheat sheets that will give you a more comprehensive list of important commands.

Getting ready

Of course, we assume that if you intend to use some command line interface (CLI) commands, you have to have your command shell window open and gain root access:

sudo

Using sudo as part of your command syntax is a requirement that often bedevils new Linux users. It is important to understand that many Linux commands demand what are known as "superuser" privileges, which grant you total control over the board and its software. Having full admin rights within a command prevents any casual user from coming along and destroying your hard work, by design or accident.

The "open sesame" of Debian Linux, the magic sudo command (pronounced "soo-doo"), means "Super User do x-command" when dissected. If you don't append your command at the beginning with sudo, your mkdir command, for example, will return a "bad command" error.

sudo -i and root

Adding the -i option (the sudo -i command) provides even more control over the environment: the root user access. When running commands as a root user, there are ample opportunities to completely mangle your system, so exercise extreme caution in its use.

However, not all commands require superuser privileges. For instance, when you're really just poking around the system and not modifying files, directories, or the system itself, sudo isn't necessary.

You should keep in mind several things when working with the command line:

  • Lowercase: Using lowercase syntax is the shell's required expectation, with the exception of some options and arguments that are uppercase.
  • Arguments and options: Most commands have multiple options or arguments that can be used to fine-tune your command. We will only be able to touch on a few instances of how and when these options are used.
  • Help:
    • Help (no hyphens): Typing help before a command outputs information about this command. An example of this is $ help cd.
    • Help (hyphens): Many executable commands have more help and information about their options or arguments. An example of this is $ mkdir --help.
    • Man pages: Short for "manual pages", adding man to the beginning of many Linux commands opens up a manual for these commands. It can often yield too much information, but it can be helpful if you're looking for a deeper understanding of a command. An example of this is $ man chmod.
  • Tab command: This lists recent commands. In order to use this, you need to do the following:
    • Type a letter (or a string of letters) and then press the Tab button. All commands that begin with this letter or string will be shown. This will prevent a vast majority of typing mistakes.
    • Press Tab twice quickly, and it will show all the commands that are currently in your path.

Conventions

Early in the book, we will frequently use the entire line from the command line, including the user name, address, symbols connoting user type, directory, and so on. So, for example, you will see a line that looks similar to the following:

debian@beagle_bone:~$ mkdir

However, as we become more familiar with the shell, we will mostly shorten the command instruction to only include the command itself:

~$ mkdir

Alternatively, you will see a slight variation on the preceding command when we refer to a root user. Note the # sign in place of the $ sign in the following command:

~# mkdir

Now, let's move on to the commands. A super-duper subset of commands, anyway. We've organized them into System navigational commands, Device and system insight, and Modify content/data commands.

System navigational command – change your directory – cd

To move from one directory to another, there are numerous variations on how to do it.

How to do it…

Perform the following steps:

  1. To change from your current default directory to the Desktop directory, type in these commands:
    debian@beaglebone:~$ cd Desktop
    debian@beaglebone:~/Desktop$
    
  2. To go back one directory level, use the following command lines:
    debian@beaglebone:~/Desktop$ cd ..
    debian@beaglebone:~$
    
  3. Go to the Home directory using the following command:
    debian@beaglebone:~/Desktop$ cd ~
    debian@beaglebone:~$
    
  4. Go back to the previous directory you were in by typing in the following commands:
    debian@beaglebone:~$ cd -
    /home/debian/Desktop
    debian@beaglebone:~/Desktop$
    

There's more…

In addition to the preceding commands, you should be familiar with the four special directory symbols:

  • The current directory (.)
  • The parent directory (..)
  • The root directory (/)
  • The home directory (~)

System navigational command – show your current directory – pwd

This stands for print working directory, a means to show the user where in the system they are currently working or the absolute path relative to the current directory.

How to do it…

Use the following command to show your current directory:

debian@beaglebone:~$ pwd
/home/Debian

System navigational command – find a file – find

Looking for a file? One way to search for it is with the find function. Just be sure to add the -name option so that the output shows the directory location. Add sudo as well so that you do not get directory access errors.

How to do it…

Use the following command to find a file:

$ sudo find / -name <filename>

Device and system insight – shows what's inside a directory – ls

The ls command lists the contents of your current directory.

How to do it…

Use the following command to see the list of contents in the current directory:

debian@beaglebone:~$ ls
Desktop

At the moment, the only thing you will see is the Desktop directory. As we continue adding content in subsequent chapters, there will be more that would be seen upon using ls.

Adding the -lah option at the end of the command gives more detailed information on the files, as follows:

debian@beaglebone:~$ ls -lah
total 112K
drwxr-xr-x 19 debian debian 4.0K May  4 23:37 .
drwxr-xr-x  3 root   root   4.0K May  5 00:05 ..
-rw-------  1 debian debian   55 May  4 23:37 .Xauthority
-rw-------  1 debian debian 2.4K May  5 01:41 .bash_history
-rw-r--r--  1 debian debian  220 Jan  1  2015 .bash_logout
-rw-r--r--  1 debian debian 3.4K Jan  1  2015 .bashrc
drwxr-xr-x  6 debian debian 4.0K Mar  8  2015 .cache
drwxr-xr-x  9 debian debian 4.0K Mar  4 23:51 .config
drwx------  3 debian debian 4.0K Mar  4 23:37 .dbus
-rw-r--r--  1 debian debian   35 Mar  4 23:37 .dmrc
drwxr-xr-x  2 debian debian 4.0K Mar  8  2015 .fontconfig
drwxr-xr-x 24 debian debian 4.0K Mar  8  2015 .gimp-2.8
drwx------  3 debian debian 4.0K Mar  8  2015 .local

The options in the command now reveal a variety of things about the file: their permission status (column 1), owner and group (columns 3 and 4), file sizes (column 5) , and modification date (column 6). The l option outputs in the list form, adding the a forces the command to show any hidden files, and the h option turns it all into a human readable format.

Device and system insight – find out what USB devices are connected – lsusb

This captures and lists all USB devices currently connected to the BBB while showing basic information about the device.

How to do it…

Use the following command to find out about the USB devices connected:

debian@beaglebone:~$ lsusb
Bus 001 Device 002: ID 0d8c:013c C-Media Electronics, Inc. CM108 Audio Controller
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Note

Note that the first device here shows a connected USB audio dongle.

Device and system insight – get information about connected devices – cat/proc/bus/input/devices

Where lusb leaves off, this command lists more detailed information about any device connected to the BBB. Note the difference in output for the same USB audio device (C-media) shown in our preceding recipe using lsusb.

How to do it…

Use the following command to get information about connected devices:

debian@beaglebone:~$ cat /proc/bus/input/devices

I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="tps65217_pwr_but"
P: Phys=
S: Sysfs=/devices/ocp.3/44e0b000.i2c/i2c-0/0-0024/input/input0
U: Uniq=
H: Handlers=kbd event0
B: PROP=0
B: EV=3
B: KEY=100000 0 0 0

I: Bus=0003 Vendor=0d8c Product=013c Version=0100
N: Name="C-Media Electronics Inc.       USB PnP Sound Device"
P: Phys=usb-musb-hdrc.1.auto-1/input3
S: Sysfs=/devices/ocp.3/47400000.usb/musb-hdrc.1.auto/usb1/1-1/1-1:1.3/input/input1
U: Uniq=
H: Handlers=kbd event1
B: PROP=0
B: EV=13
B: KEY=78 0 e0000 0 0 0
B: MSC=10

There's more…

The stem of this command is cat, which is one of the most popular commands to quickly read files without writing or modifying them:

$  cat file4

You can try it with any file to see how the screen output looks.

Device and system insight – get your version of Linux

You can find out which version and distribution of Linux you are running through several methods.

How to do it…

To find out your version of Linux, use the following command:

debian@beaglebone:~$ lsb_release -a

The screen output will look similar to this:

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.6 (wheezy)
Release: 7.6
Codename: wheezy

The preceding command is a good complement to the more typical way we determine the actual kernel version, which is as follows:

$ uname -r
3.8.13-boneXX

Device and system insight – find out running processes – ps

In Linux, applications are referred to as processes, and each is given a unique ID number or PID. The ps (that is, process status) command provides information about the currently running tasks or processes. The output includes the PIDs.

How to do it…

This command takes a snapshot of your board. You can run the command unadulterated and with no options, as follows:

$ ps

But the output is a thin gruel:

debian@beaglebone:~$ ps
PID    TTY    TIME    CMD
1623    pts/0    00:00:00    bash
2035    pts/0    00:00:00    ps

So, it is often better to modify the output in order to get more insight into the running processes and display this information in a more orderly fashion, as in the following command:

$ ps aux

The following is the output:

How to do it…

The aux series of options complement the basic command by doing the following:

  • The a option shows the processes for all users. Historically, ps requires different syntax depending on our flavor of Linux or Unix. This option simplifies the method required to add options.
  • Using the u option tells the command to display the user or owner of the process in the output. The reason you want to do this is that there are processes typically running at the root level and other processes running at a non-root-user level. However, we frequently want to see all processes running regardless of user, so this option is important.
  • The x option ensures that processes that are not currently running in a terminal window—which form the majority of running processes—are also in the output that we want to see.

Device and system insight – find out the resources used by running processes – top and htop

This command takes it a bit further than the ps command as it dynamically updates not only the processes running but also the CPU resources used by the processes. The status is continuous and in real time.

How to do it…

Use this command line:

$ top

The output is as follows:

How to do it…

The top command is adequate and one that you will hear most Linux users call upon, but there is now a much lovelier, easier way to read a package—htop. Let's install it and compare it to top with the following command:

$ sudo apt-get install htop

Now, the output will be as follows:

How to do it…

As you can see, it has an output that is much cleaner and easier to read.

Device and system insight – quitting processes – kill

The typical way to force quit—or kill—an application is to use the kill command and combine it with the process ID (PID), which you can derive from any of the preceding recipes to capture process information. Let's take a look at the basic method.

How to do it…

Use the following command to kill processes:

$ kill <process_id>

Here's a real example, which would force quit the top process shown in our prior recipe:

$ kill 4569

When you know the name of a process, you can use the pkill command, which operates on the process name instead, as follows:

$ pkill -9 gdb

Naturally, there is yet another way to skin the cat while killing a process. For example, you may discover that there are several processes associated with one application, and killing them one by one gets a bit slippery. Instead, use killall and kiss them goodbye:

$ killall chromium

Device and system insight – message reports – dmesg

As you already know, every time you boot up your device, a ton of messages quickly scrolls past on the screen. Unless you wear a blue leotard with a red cape and possess exceptionally fast eyes, you likely will not catch all these pearls of ASCII wisdom. Yet, these messages can be extremely useful at times, particularly when you need to troubleshoot a system problem.

How to do it…

The dmesg command is used as follows:

$ dmesg

Typically, the output looks similar to this:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.8.13-bone47 (root@imx6q-wandboard-2gb-0) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Fri Apr 11 01:36:09 UTC 2014
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=50c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: Generic AM33XX (Flattened Device Tree), model: TI AM335x BeagleBone
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] On node 0 totalpages: 130816
[    0.000000] free_area_init_node: node 0, pgdat c0824280, node_mem_map c089f000

The list goes on and on as your machine is full of activity! So, limiting dmesg to output smaller chunks of information with a command option is primarily the course followed. In this case, we want to show the last ten events on the system, so we will use the following:

$ dmesg | tail

Alternatively, we can use the less option, which allows us to advance forward in the list more methodically, as follows:

$ dmesg | less

Device and system insight – shows disk space – df -h

This command outputs information on your board's available disk space and displays it in human readable format.

How to do it…

Use the following command to find out the disk space:

debian@beaglebone:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          7.2G  1.6G  5.4G  22% /
udev             10M     0   10M   0% /dev
tmpfs           100M  824K   99M   1% /run
/dev/mmcblk0p2  7.2G  1.6G  5.4G  22% /
tmpfs           249M     0  249M   0% /dev/shm
tmpfs           249M     0  249M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/mmcblk0p1   96M   71M   25M  75% /boot/uboot
/dev/mmcblk1p2  1.7G  1.7G     0 100% /media/rootfs
/dev/mmcblk1p1   96M   11M   86M  11% /media/boot

Device and system insight – explore network – Ifconfig

This lists all the network devices with network information. You will commonly find yourself using this command on the BBB when you need to troubleshoot a problem or set up network connections.

How to do it…

Use the following command to explore network configuration:

$ ifconfig

The output is as follows:

How to do it…

Modify content / data commands – make a new directory – mkdir

This command helps you create a directory (folder) where you want to work or place files.

How to do it…

Use the following command to make a new directory:

debian@beaglebone:~$ mkdir test

Now is a good time to check your work with the ls command, as follows:

debian@beaglebone:~$ ls
Desktop  test

Modify content/data commands – remove a file or directory – rm

As the name implies, this command removes a file or directory that you designate.

How to do it…

Removing a file is very simple. You just need to type out the following:

$ rm file1

Adding the -i option is good practice, especially for beginners, as it prompts you to confirm the file's removal as follows:

$ rm -ir file1
rm: remove regular file `file1'?

To remove directories, there are principally two commands you can use. Firstly, when you have an empty directory, the command is similar to the following:

$ rmdir dir1

However, rmdir works only if the directory is empty. If you want to remove a directory with all its contents, you can use rm with the -r option. This option tells rm to remove a directory recursively, as in the following command:

$ rmdir -r dir1

Tip

Red Alert!

Obviously, rm -r can wreak havoc on your system and delete files and directories that you may actually need. To be cautious, the first few times you use this command, you might want to include the -i option. This way, each time you delete a directory and its contents, you will get a prompt before each file is deleted.

Modify content / data commands – download files – wget

Running this command gives you control over grabbing and downloading files from web servers via HTTP, HTTPS, and FTP. Unlike the experience of downloading a file in a web browser, wget is noninteractive. This means that you don't have to be logged on for the command to complete its task, which is potentially a great time-saver with large file downloads.

How to do it…

In order to download files, you can use a command such as the following:

$ wget http://

This will download the Major Tom page at www.hudsonwerks.com into your current directory and create a file named index.html. Next, perform the following steps:

  1. Check your work using the following command:
    $ ls
    Desktop    test    index.html
    
  2. Now, perform another wget; this time, download via ftp. Here, we will grab wget source code from the GNU site as follows:
    wget ftp://ftp.gnu.org/pub/gnu/wget/wget-1.15.tar.xz
    
  3. Check your work again, using the following command this time:
    $ ls
    Desktop    test    index.html    wget-1.15.tar.xz
    

There's more…

Where do we put the new tarballs, packages, and so on? It is good practice to create a directory called /home/username/Packages/. This is where you can put tarballs, their extracted files, compiled code, backups of replaced files, and installation scripts. For this, you can use the following command:

$ mkdir /home/username/Packages/
$ wget -P /home/debian/packages <download-url>

Modify content / data commands – open a tar file – tar [options]

Working with files in the .tar (tarball) format, a type of archived file, is common in Linux. The various options that come with the tar command will considerably ease your management of the files that are not archived.

How to do it…

Use the following command to open a tar file:

$ tar -zxvf file_name.tar.gz

Before actually running the command, let's understand a bit about the options:

  • -z: This is used to uncompress the resulting archive with the gzip command
  • -x: This is used to extract to disk from the archive
  • -v: This produces a verbose output, which means that it shows progress and file names while extracting files
  • -f document.tar.gz: This reads the archive from the file called document.tar.gz

Other file types include .xz, which is the actual file type we downloaded previously using wgetwget-1.15.tar.xz. So, here are the essential recipe steps:

  1. By default, files are extracted into your current directory. However, you can simultaneously extract your files and put them in a different directory with the -C option. Using the following command, we will extract files and put them in the /test directory:
    $ wget-1.15.tar.xz -C test
    
  2. Check your work by navigating to the new directory created and running the following command:
    $ cd /test/ wget-1.15
    

    You should see all the unarchived wget source files with their accompanying directories.

The flip side of unarchiving is archiving. Here's how you can create a tar file:

$ tar -cvf file.tar inputfile1 inputfile2

Replace inputfile1 and inputfile2 with the files and/or directories that you want to combine. You can use any name in the place of file.tar; you should keep the .tar extension, though.

There's more…

You may occasionally run into errors while opening tarballs (or other gzip files). If so, one troubleshooting tip is to ensure that the file is actually a zipped archive with the following command:

$ file filename

This will show the file type and size; if it's not an archive, you can't run the tar command on it.

Modify content / data commands – clean up files – autoclean

This command removes partial packages from the system.

How to do it…

Use the following command to clean up files:

$ sudo apt-get autoclean

Modify content / data commands – purge a package – apt-get purge, apt-get remove --purge

These commands completely get rid of packages and dependencies.

How to do it…

Use the following command to get rid of packages and dependencies:

$ sudo apt-get purge packagename

Alternatively, you can use the following command:

$ sudo apt-get remove  --purge packagename

Modify content/data commands – shutdown the system – [options]

It is a bad idea to pull the plug on your board to turn it off. Doing so can often lead to a corrupted SD card or mangled files. Instead, here's how you power down your board gracefully.

How to do it…

If you want to shut down the BBB and reboot it, the following command will be useful:

sudo shutdown -r now

However, if you simply want to shut down the system and power down completely, then either of the following two options will do the trick:

sudo shutdown -h now

You can alternatively use the following command:

sudo poweroff

See also

You will find some of the best one-page cheat sheet references for Linux commands. Print them out and post them in an honored place!

Edit a text file from the command shell

There is nothing pretty about the text editing tools in Linux. After all, it is a command shell environment; how pretty can it be? But if you are a minimalist at heart, you will feel right at home.

Two editors mostly dominate Developerland: nano and vim. The latter is the most powerful and fully featured. However, the vim command is not a good starting point for neophytes as it is more complex. Instead, our text editing tool of choice for the rest of this book will be nano. In this section, you will learn your way around the editor and then create and edit a text file.

How it works...

When you're using nano, take note of all the options at the bottom of the screen: Exit, Get Help, Read File, and so on. You access these functions with the keyboard shortcuts shown next to each option. Beware that these shortcuts actually may change their function or mode when you navigate to another screen or choose an option. So, remember what the bottom menu says before assuming that the shortcut you just used remains in the same mode.

In the main (default) window, here's a quick rundown on the most commonly used functions and their shortcuts:

  • Ctrl + X: Closes the file.
  • Ctrl + V: Takes you to the next page.
  • Ctrl + Y: Takes you back to the previous page.
  • Ctrl + K: Cuts text (deletes the line of text where your cursor is).
  • Ctrl + U: Uncuts text (undoes the line deletion from the last line that you cut. Repeating this command will keep adding the same line of text that you cut).
  • Ctrl + G: Help menu.
  • Ctrl + C: Shows the current position (gives you line, column, and character coordinates).
  • Ctrl + R: Inserts a file into the file you have open. Now that's a time saver, huh?

I recommend using Ctrl + G periodically when you're just beginning as a reminder for the additional functions available, many of which are powerful and useful. Overall, you will find that even a simple Linux-based text editor such as nano comes loaded with features that most Wintel/Mac desktop versions don't typically include.

How to do it...

This function can be performed through the following steps:

  1. Let's begin by opening nano and simultaneously creating a file named major_tom:
    ~$ nano major_tom
    

    Pow! A window opens. That's the nano interface in all its glory. All right, not so sexy. But very functional, as you can see in the following image:

    How to do it...
  2. On the first line, which is where your cursor should be by default, type (or paste) the following:
    I love my Beaglebone Black so much I want to send it into orbit with Major Tom.
    

    Quickly looking around the window, you will notice the following:

    At the top of the window, you will see the version of nano that you're using and the file name, major_tom.

    At the bottom of the window is an assortment of options.

    If you've played around with any of the options in the menu, ensure that you're back in the main screen where we began with our typed line about Major Tom.

  3. Next, save the file by pressing Ctrl + x; when prompted, type y for yes:

    Error! What a bummer that we couldn't save our work. This is because we didn't first execute nano with the right user privileges. So, try again by closing the file by pressing Ctrl + x; when prompted, type n for no.

We lost our work, but it was only one line of text. We would now have popped back into the command line, and we will have another go; this time, we need a few more steps:

  1. Let's make a custom directory; run this command:
    mkdir bbb_recipe_book
    
  2. Go into this new directory and make a subdirectory; then, make a subdirectory of this one. This may sound overly complicated, but we're just trying to set up some files and directories by organizing principles early. Use the following commands for this:
    cd bbb_recipe_book
    mkdir projects
    cd projects
    
  3. Check your work to ensure that you've set up the directory structure properly. Use the following command:
    pwd
    
  4. Now, let's type sudo nano major_tom.txt. This time, we appended the filename with a text file type. If you don't do this, nano—and Linux—won't know with which application type to associate the file.
  5. In the nano window again, type I love my Beaglebone Black so much I want to send it into orbit with Major Tom., as shown in this image:
    How to do it...
  6. Then, press Ctrl + x; when prompted type y for yes.
  7. Now you will see that the bottom menu has a new prompt, which reads as follows:
    File name to write: major_tom.txt
    
  8. Hit return (Enter) on your keyboard. The file is saved to the new directory we're working in (/home/debian/bbb_recipe_book) and closed simultaneously.

You've now made a very exciting .txt file that you can go back and read whenever you want. Okay, that wasn't terribly challenging. But don't worry; we will be adding more complexity as we proceed in upcoming chapters.

See also

For those who find nano a bit Spartan in functionality and prefer a more powerful editor, vim is a popular choice. Although challenging to learn at first, you may find it to be a more rewarding and flexible choice as a tool. Learn how to use it at http://www.openvim.com/tutorial.html.

Connectivity

We will show you the two principal recipes to get your BeagleBone Black connected:

  • Ethernet
  • Wi-Fi

Beware that there is a third way to get the BBB online, which is by tethering your board to your desktop machine and piggybacking on its network connection. This is a highly useful but occasionally tricky option.

Connectivity – Ethernet

If you have direct access to your network's router, using the Ethernet connection is pretty much Plug and Play on the BBB.

Getting ready

Here's what you need for this recipe:

  • 5V DC power supply
  • An Ethernet cable
  • A BBB connected to an HDMI monitor. For ease of use and first time connectivity, we suggest that you have your board connected to a monitor for this recipe. After you gain confidence and learn more about connectivity methods, you will be able to dispense with using an external monitor.

How to do it...

Perform the following steps for Ethernet connectivity:

  1. With your BBB powered down, plug in one end of an Ethernet cable to the BBB and the other end to your router.
  2. Power up your board via the 5V power supply.
  3. The connection should occur seamlessly, assuming your Ethernet cable is sound, your internet connection is reliable, and the BBB has no defects.
  4. At your screen's login prompts, enter your login name and password. You will be taken to the desktop.
  5. Next, we will check our connection via a terminal session. In the lower left-hand corner of your screen, click on the bird-like icon and then navigate to Accessories | LXTerminal.
  6. In the open terminal window, type the following:
    $ ping www.google.com
    

    You should be getting ping responses back that look similar to the following output:

    How to do it...

Connectivity – Wi-Fi

Since its original release in the spring of 2013, Wi-Fi on the BBB has been a bit of an Achilles Heel for the platform. Compared to the typical experience with Raspberry Pi, you could pull out your hair getting Wi-Fi to work on the BBB. If you were happy using Angstrom only for your projects, you were in luck as this distribution was (mostly) solid, given that several USB minidongles on the market worked well.

However, on Debian and Ubuntu, unless you did not mind using larger dongles with protruding antennae, connections were flaky. Alternatively, you could invest a chunk of time writing custom drivers. So much for out-of-the-box portability.

Fast forward to the (mostly) good news. With the three different Wi-Fi dongles that we tested on the current shipping version of Debian 7 Wheezy for the BBB (using 3.8.13-bone71) and on Debian 8 Jessie, we largely got positive results. The bad news? With the exception of using Debian Jessie, not all dongles were recognized by the BBB without some configuration. However, it is fairly easy to set up the hardware, and you also may get lucky with the dongle you have in your kit and get immediate connectivity.

Note

If you are using Debian 8 Jessie, skip immediately to Method Four: Debian Jessie.

Getting ready

The following are the prerequisites for Wi-Fi connectivity:

  • DC power to the BBB—the board should be powered from a 5V DC 1A minimum supply and not via USB.
  • A connected HDMI monitor.
  • Wired or wireless keyboard and mouse connected to the USB hub.
  • A powered USB hub—the Wi-Fi dongle draws more power than the BBB can deliver if you only power the board via the USB port on your client box. Instead, you need a powered hub to do the job. If you don't use a powered hub, you may be able to get away with decent stability, but you are just as likely to get poor results.
  • Wi-Fi dongle—refer to tables to test compatible versions.

We will divide this recipe into three different setup methods as some dongles are happy with one method while others prefer the second one. We will also include the setup for Debian 8.0 (Jessie) as this distribution has greatly improved and simplified the process.

Some of the setup instructions are derived from http://elinux.org/BBBWiFiConfigs.

The micro USB dongle models

The universe of low-cost Wi-Fi dongles available on the market is fairly large, the following table being a very small subset. The mini dongles we used in these recipes have been historically problematic with the BBB but are now more reliable with the current Debian distribution. Your best results, however, may be with a standard-sized (nonmicro) dongle that also comes accompanied by an antenna.

The following table shows the tested and working models of micro USB dongles for our recipes. Note that the first three models use Method Two for setup and the last two use Method Three. All dongles are priced around USD $10.00-12.00:

Method Two

Product Name

Supplier

Manufacturer

Chipset

Power requirements

NOTES

Ourlink

Adafruit

Realtek

RTL8188CUS

powered USB

This is the same product as #2

802.11b

Adafruit

Realtek

RTL8188CUS

none

This is sold by Adafruit as the same product as #1; however, there seems to be some difference since a powered USB is not required.

Trendnet TEW648UBM

B&H

Realtek

RTL8188CUS

powered USB

The board may freeze up without using a powered USB. May also need to reboot and run. Use the reset (S1) button to get a connection.

Method Three

UWN100

Logic Supply

Ralink/MediaTek

MT7601

powered USB

 

UWN200

Logic Supply

Ralink/MediaTek

MT7601

powered USB

This uses antennae.

Note

UWN200 is not tested by the author but cited by the BBB Google forum posters as a compatible dongle with possibly superior performance given the antenna addition.

How to do it...

Method one: Graphical desktop application

In lieu of the command line, the current distribution of Debian 7 (3.8.13-bone71, Wheezy) includes a handy graphical tool—Wicd Network Manager—to set up Wi-Fi. This recipe is quite simple:

  1. Power up your BBB via 5V DC.
  2. Log in to a desktop session.
  3. In the lower left-hand corner of your screen, click on the bird-like icon and then navigate to Internet | Wicd Network Manager.
  4. In the newly opened window of the application, click on the Switch On Wi-Fi button. The dongle will now begin scanning for accessible networks.
    How to do it...
  5. Choose your local network. Enter your password in the popup window according to the type of encryption your network uses. Then, click on OK. After a few moments, your dongle will be connected.
  6. Check the connection with the ping command:
    $ ping www.google.com
    

    If all is well, you will be getting solid pingback messages.

Although the preceding steps are straightforward, you might find that your dongle will not work with this recipe or that you are using a different version of the kernel and easy connectivity eludes you. If so, here are other recipes to get connected.

Method Two: command line option 1

Consult the table at the beginning of this section for the tested models that use Method Two. Note that they all use the same RTL8188CUS chipset. This means that you will likely be able to use other dongles with the following steps as long as they use the aforementioned chipset. Now to the steps:

  1. From your BBB's desktop, open up LXTerminal.
  2. In the command prompt window, open the file in the directory specified in the following path:
    $ sudo nano /etc/network/interfaces
    

    Among other settings, you should see the following lines in the file's open window:

    ## WiFi Example
    #auto wlan0
    #iface wlan0 inet dhcp
    #   wpa-ssid "mynetworkname"
    #   wpa-psk  "mypassphrase"
    
  3. With the exception of the first explanatory line, uncomment (which means remove) the # sign at the beginning of each line. To clarify, it should look similar to this:
    ## WiFi Example
    auto wlan0
    iface wlan0 inet dhcp
       wpa-ssid "mynetworkname"
       wpa-psk  "mypassphrase"
    
  4. Change mynetworkname to your Wi-Fi network's name, and mypassphrase to your Wi-Fi password.

    Note

    If your network name uses spaces or other odd characters, some dongles may not recognize the name and establish a connection.

  5. Close the file by pressing Ctrl + x; when prompted, type y for yes and then press the return (Enter) key.
  6. Power down the BBB in the terminal window with the following command:
    $ sudo poweroff
    
  7. Power up the board again and log in to your BBB desktop.
  8. You will now get a solid Wi-Fi connection. Test it via the command shell with this command:
    $ ping www.google.com
    

    If all went well, you should see a steady screen output from the ping.

Method Three: command line option 2

Consult the table for the tested models that use the following steps. The main difference between these steps and the previous recipe is that the drivers in these dongles require a different interface—a wireless supplicant—with the BBB to function properly. Before starting the steps, be sure to remove any Wi-Fi dongles you may have inserted into the USB hub:

  1. We need to create a .conf file for wpa_supplicant, a tool that comes preloaded on the current Debian distribution. The following command line will be useful for this:
    $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
    
  2. Paste in the open file the following information:
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    network={
     ssid="my-ssid"
     scan_ssid=1
     psk="my-psk"
     proto=RSN
     key_mgmt=WPA-PSK
     pairwise=CCMP
     auth_alg=OPEN
    }
    
  3. Two things need to be modified (just as in Method Two): my-ssid, which you will replace with your network's name, and my-psk, which will be your network's password.
  4. We now need to figure out the Wi-Fi dongle's interface name. To do this, we will first examine which interfaces are present using the following command:
    $ ifconfig -a
    

    This command outputs the currently active interfaces, which may include eth0, lo, and usb0.

  5. Reboot your board.
  6. Plug in your dongle and run the same command again:
    $ ifconfig -a
    

    The output should now show the new device's interface name, which could be ra0, wlan0, or so on.

  7. Open the file in the directory specified in the following path:
    $ sudo nano /etc/network/interfaces
    
  8. At the top of the file, paste the following code, replacing interfacename with the name that appeared in Step 6:
    allow-hotplug ra0
    iface interfacename inet manual
      wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    iface default inet dhcp
    
  9. Close the file by pressing Ctrl + x; when prompted, type y for yes, then press the return (Enter) key.
  10. Assuming your dongle is still plugged in, run a command that brings up the interface:
    $ ifup interfacename
    
  11. Power down the BBB by running this:
    $ sudo poweroff
    
  12. Make sure your Wi-Fi dongle is plugged into a powered USB hub with the hub's USB cable inserted into the BBB's USB port.
  13. Restart the board; this time, plug into the DC power supply.
  14. You will now get a solid Wi-Fi connection. Test it via the command shell using the following command:
    $ ping www.google.com
    

    If all went well, you should see a steady screen output from the ping.

    Note

    Sometimes you may need to power off, unplug the 5V input, and then plug in again as the dongle isn't always recognized through the S1 (Reset) or the S3 (Power) buttons.

Method Four: Debian Jessie

Using Jessie is the easiest and fastest route to a reliable Wi-Fi connection. Here is how to do this:

  1. Plug an Ethernet cable connected to your router into the BBB's Ethernet port.
  2. Boot up and log in to your BBB connected to a monitor.
  3. Open a terminal window and log in as root with the following command:
    $sudo -i
    #
    
  4. Install the package network manager. Before installing a new package, always begin by updating your repositories as follows:
    # apt-get update
    # apt-get install network-manager
    
  5. Now, open up the new package with this command:
    # nmtui
    

    A rudimentary interface should open up in the terminal window, similar to the following image:

    How to do it...
  6. Select Activate a connection.
  7. In the next window, select your network, and you will be prompted for the password.
  8. Quit the network manager screen after putting in your password. Then, check to verify that your dongle now has an IP address in the wlanX interface with this command:
    # ifconfig -a
    
  9. Now, power down, remove the Ethernet cable, and reboot using this command:
    # reboot
    
  10. Run the magical ping command to check how we did:
    $ ping www.google.com
    

    Voila! Your BBB should now be connected wirelessly.

There's more…

Some users report that the board can interfere with a Wi-Fi dongle's USB signal. So, if you do not get a reliable connection, position your powered USB device containing the Wi-Fi dongle a few feet away from the BBB.

See also

Take a look at a list of other compatible dongles here at http://elinux.org/Beagleboard:BeagleBoneBlack#WIFI_Adapters.

Package management – Installing packages using apt-get

If you are a newcomer on Linux, you will find that managing software on your BBB is a very different experience from the one on your Windows or Mac box. Linux distributions have a very different sensibility when it comes to installing and supervising your software.

In some ways, it is akin to what your smart phone universe is like: you go to a centralized place (Google Play, App Store, and so on) and download a vetted application.

Of course, there are huge differences in Land o' Linux. Firstly, everything is free. Secondly, everything is (mostly) open source. Thirdly, pieces of your package—dependencies, libraries, and so on—that evolve and improve are treated as separate entities that only need to be conjoined when you are ready to actually install a piece of software.

This means that you're always getting the freshest, most stable build. Whereas in Closed Source Land, executables are built to be self-contained. Any new module or better library that is built after the binary was compiled….well, too bad. You will have to wait for the next release, whenever that might be. And then you have to pay for the upgrade.

Software applications for Linux are referred to as packages. Henceforth, we will mainly use the term package in lieu of application. In this section, we will learn the basics of package management through the following topics:

  • Updating packages
  • Upgrading packages
  • Installing packages

Note

These recipes assume that you have internet connectivity working via any of the methods explained in the earlier Connectivity section.

For our recipes throughout this book, we will principally use the apt-get command for package management. Although there are other methods, apt-get is the easiest and most common way to handle packages for a beginner.

Getting ready

Use the following steps to install packages:

  1. Updating packages: Before actually installing new software in Linux, it's best practice to ensure that you have downloaded the most current versions of your local package lists along with information about their dependencies. You execute one of the most common commands in the Linux repertoire:
    $ sudo apt-get update
    

    As a result of this command, we get a resynchronized package index file that is targeted not only at your specific Linux distributions, but your hardware environment as well. For the BBB, this means that your package manager knows to only grab packages that are Debian-savvy and compatible with the Arm board architecture.

  2. Upgrading packages: Next, you want to grab and upgrade to new versions of the packages already installed on your BBB, which the apt-get update will presumably have chronicled, through the following command:
    $ sudo apt-get upgrade
    
  3. Finally, you get to install your new whizzy tool or app! Use this command:
    $ sudo apt-get install pkg_name
    

How to do it…

Let's do a real package, though, one that we will be using in a later chapter. For our recipes focused on debugging in Chapter 3, Physical Computing Recipes Using JavaScript, the BoneScript Library, and Python, we will use a tool called gdb, also known as GNU Debugger, which is a standard tool in the Linux arsenal thus:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install gdb

Once you've installed the pretty package on your BBB, it's useful—and often interesting—to take a peek inside. So, another apt-get variant gives you some interesting insight:

$ sudo apt-cache show package-name

In our case, this would be as follows:

$ sudo apt-cache show gdb
Package: gdb
Version: 7.4.1+dfsg-0.1
Installed-Size: 5192
Maintainer: Hector Oron <zumbi@debian.org>
Architecture: armhf
Depends: libc6 (>= 2.13-28), libexpat1 (>= 2.0.1), libgcc1 (>= 1:4.4.0), libncurses5 (>= 5.5-5~), libpython2.7 (>= 2.7), libreadline6 (>= 6.0), libtinfo5, zlib1g (>= 1:1.2.0), gdbserver
Suggests: gdb-doc
Description-en: The GNU Debugger
 GDB is a source-level debugger, capable of breaking programs at
 any specific line, displaying variable values, and determining
 where errors occurred. Currently, gdb supports C, C++, D,
 Objective-C, Fortran, Java, OpenCL C, Pascal, assembly, Modula-2,
 and Ada. A must-have for any serious programmer.
Homepage: http://www.gnu.org/s/gdb/
Description-md5: 8132571fab028a898d029eecd88e571e

See also

To list all installed packages, enter:

dpkg --list

Alternatively, you can use this command:

dpkg --list | less

You can also run the following command:

dpkg --list | grep -i 'http'

Note the grep option as part of the command string. One of the most popular commands on Linux, grep is a powerful search mechanism to find a particular file, a directory, a pattern or chunk of code.

SSH / Remote access

Local control of your BBB should always be supplemented with the ability to control it remotely. There are a variety of reasons you may want to do this. For example, you may want to operate the device from one location while you are in another location.

The primary and most typical reason for remote access, however, is to run the board headlessly. This means running it without a display, keyboard, or mouse. Headless control is, in fact, the way I operate the board about 99 percent of the time. I rarely even use an external monitor with the BBB since it requires fewer pieces of hardware and reduces headache.

There are two basic recipe types for remote usage:

  1. Command line via SSH
  2. GUI-centric via VNC

Using SSH to control your BBB

Using SSH (secure shell) on a desktop PC or other client will give you control over your BBB across a network. Here is the recipe.

How to do it…

On your BBB:

  1. Open LXTerminal.
  2. Now, enter the following command:
    ~$ sudo ifconfig
    
  3. In the onscreen text, get the IP address of your BBB. Under etho0, look for inet addr: xxx.xxx.xxx.xxx.

On your PC/Mac/Linux box:

  1. Open your preferred terminal app. On the Mac, it's just called Terminal.
  2. At the command prompt, type the following:
    ~$ ssh-keygen -R <your_ip_address>
    
  3. You should then get the following:
    /Users/username/.ssh/known_hosts updated.
    Original contents retained as /Users/ username/.ssh/known_hosts.old
    username@hrh:~$
    
  4. Next, type the following:
    username@devicename:~$ ssh debian@<your_ip_address>
    
  5. Now, you will see the following on screen:
    The authenticity of host '<your_ip_address> (<your_ip_address>)' can't be established.
    RSA key fingerprint is 97:b4:04:f5:24:f3:75:f9:90:3c:cc:ff:78:36:f3:d9.
    Are you sure you want to continue connecting (yes/no)?
    
  6. Type yes (no quotes, all lowercase).
  7. You will then see the following with a new prompt:
    Warning: Permanently added '<your_ip_address>' (RSA) to the list of known hosts.
    debian@<your_ip_address>'s password:
    
  8. Type the password of your BBB login (the default is temppwd).
  9. If you typed in your password correctly, you will end up back here:
    debian@beaglebone:~$
    

Congratulations! You've now gained control over your BBB using the command line from another box.

Using VNC to control your BBB

So, are you still not entirely comfortable with the command line and want access to some of the GUI-based tools? Or, do you need to test and control using an actual GUI? Or, perhaps, is your app not running properly from only the command line? Then, it's time for VNC.

Virtual Network Computing (VNC) allows remote access to a device that's running an X session or windows/GUI-based system from a remote device or client machine. With the current Debian distribution, running VNC is easier than ever as the BBB arrives preloaded with the relevant package, the TightVNC server. On your client box, you need to install a remote viewer.

Getting ready…

For your client box, download and install one of the following remote viewer applications:

Once again, we're cooking up a recipe from a Mac perspective, so VNC Viewer it will be.

How to do it...

As noted, the BBB now comes with the remote server installed, so the only new installation required is the one for your client box. For this, perform the following steps:

  1. Install the client app on your desktop box.
  2. From the terminal window, run the VNC server on the BBB through the following command:
    $ vncserver
    
  3. Next, you will need your BBB's port address. You will find it in the status message now running in the CLI window:
    New 'X' desktop is beaglebone:1
    

    Note

    Your port number may differ.

  4. On your desktop box:
    • Open up VNC viewer (or whichever client app you're using)
    • Type in the IP address of your BBB and the port number at the end of the VNC server field: 123.456.78.9:1. The default my be "beaglebone:1.
    How to do it...
  5. You will then have a window pop up Unencrypted Connection.
  6. Click Continue.
  7. Select Connect.

You will now be logged in to your BBB, be able to see the desktop, and have full control over the device using the mouse on your client box.

There's more...

  • Security: Using the default or basic settings in VNC is not secure. Unless you're familiar with doing so, the sessions are not encrypted. One quick, though imperfect, measure is to change from the default server port 5900 to a spare, randomly chosen port.
  • Getting the IP address on a headless BBB: From another computer on the network, use the following steps to list a network's basket of IP addresses:
    ifconfig | grep inet
    
    • Note that this will show the IP address range and only name specific host devices but not other addresses.
    • This method may only be feasible in a smaller network, where the number of addresses is more limited and you do not have to look for a needle in a haystack.
    • You will likely need to install the NMap security scanner (http://nmap.org/). Check whether it's installed first.
    • Then, type in sudo nmap -sn -PE 192.168.1.0/24 (with the IP address of the host machine and then /xxx from the end range shown in Step 1).
  • Browse to the local router admin address: Find the configuration options that show all computers/devices on the network with their IP addresses.
  • Set a static IP address: This takes several steps, but one of the best tutorials is Derek Molloy's at http://derekmolloy.ie/set-ip-address-to-be-static-on-the-beaglebone-black/.

System images

In this section, we will give you the recipes to download, install, and update the Debian distribution firmware and software kernel that comes preloaded on your board. Finally, we will walk you through changing over from the currently shipping Debian 7.0 (Wheezy) to the newer Debian 8.0 (Jessie).

There are two basic methods to install and update your board's software: install the OS onto the eMMC solid-state internal drive or a compatible SD card (refer to the compatibility list in further chapters). In either case, the process is commonly called flashing the image, which is how we will refer to it.

Note

One of the signature features of the BBB is its ability to use many different flavors of Linux to run the board. In the further chapters, you will find references and material to install various versions of Linux, including Ubuntu, ArchLinux, and Android.

OS image flashing – internal drive boot

Although your board comes preloaded with a shipping version of Debian 7, you certainly want to understand how to replace it or update it when necessary. Here, we will discuss the recipe to flash the OS to your internal solid-state drive along with how to update to Debian 8.

As of the writing of this book, Debian 8 (Jessie) is still considered a testing option, whereas Debian 7 (Wheezy) is the official shipping firmware OS for the BBB. Additionally, you will notice "LXQt" as part of the URL download link. LXQt is a lightweight Qt variant of LXDE, the Lightweight Desktop Environment. Qt is a toolset to build cross platform applications that you can use on Mac OS X, Windows, and Linux. It uses the C++ programming language and has a nice GUI builder, so it is a popular choice for many open source-centric developers.

Getting ready

You will need the following:

  • BeagleBone Black powered down.
  • A 5V DC power supply. You can also use a 5V "wall wart" power adapter with a USB port on it as long as it can deliver 1A.
  • A microSD card (4GB or greater).
  • An SD card reader. You will insert the microSD card into the card reader and the card reader into an SD port on your desktop machine.
  • A board connected to either an HDMI monitor or an LCD cape (as explained earlier in this chapter).

Note

If you had it connected, ensure that you remove the Ethernet cable before proceeding with this recipe as an Ethernet connection requires more current and will likely cause the software flashing to fail.

How to do it...

The following steps are used to flash the OS to your internal drive:

  1. Using the wget command, get the software and put it on your desktop computer.

    The latest version of the shipping OS, Debian 7 (Wheezy), is available at http://beagleboard.org/latest-images. So, you need to get the exact URL and append it accordingly in the following command:

    $ wget https://rcn-ee.com/rootfs/bb.org/release/YEAR-MONTH-DAY/lxde-4gb/BBB-eMMC-flasher-debian-7.8-lxde-4gb-armhf-YEAR-MONTH-DAY-4gb.img.xz
    

    The preceding link references a Rev. C board, the currently shipping version. If you have another version of the BBB, you can find software for prior releases at http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Build_Instructions.

    Note

    Debian testing version

    You can also alternatively install Debian 8 (Jessie) using the same steps as the following, substituting the URL and appending the month, day, and year accordingly:

    https://rcn-ee.com/rootfs/bb.org/testing/YEAR-MONTHDAY/lxqt-4gb/BBB-eMMC-flasher-debian-8.0-lxqt-4gbarmhf-YEAR-MONTH-DAY-4gb.img.xz

  2. Next, unpack, unzip, or unarchive the downloaded file using your favorite archive tool. On my Mac, I use Unarchive since it's easy to use and flexible. After unarchiving, there will be an .img file available in your chosen folder.
  3. Now, we will flash the .img file to the microSD card. The easiest method is to use a GUI-type tool such as Pi Filler (originally designed for Raspberry Pi but works equally well on the BBB) for the Mac, or Win32 Diskimager on your Windows box.

    Wait for a prompt from the imaging software before actually inserting the SD card into the desktop's slot. Depending upon the speed of your desktop box's environment, the flashing/writing process will take anywhere from 15 to 30 minutes.

  4. Remove the SD card from your desktop after the flashing finishes and then remove the microSD card. Ensure that your BBB is powered down and then insert the card into the microSD slot on the BBB.
  5. Press and hold the Boot switch, which is the small button on the BBB above the microSD card slot. Take a look at the the following image to confirm that you are pressing the Boot switch and not one of the other switches:
    How to do it...
  6. While holding this button down, insert the 5V supply into the power jack.
  7. As the board boots up, the array of LEDs next to the Ethernet jack at the other end of the board will begin flashing in a sweeping pattern.
  8. When the boot completes, all four LEDs should be lit and not blinking. Remove the power cable and then remove the microSD card from the BBB.
  9. Now, plug the 5V supply back into the board again. The BBB will boot directly from the eMMC.
  10. In your terminal window, we will now SSH into the board with the following command:
    $ ssh debian@192.168.7.2
    
  11. When the login prompts appear, use the following credentials:
    username: Debian
    password: temppwd
    

    You should now be ready for action with the default graphical desktop showing the BeagleBone Black logo in the lower-right corner of the screen. This means that you are almost ready to go….

There's more…

Good practice to manage your system OS and files includes having enough room to add more packages, being able to clone your eMMC, and backing up your code image.

Expand your partition

Unless you use an SD card larger than 8 GB, you're likely to run out of space quickly on your card even after a modicum of packages are installed. So, save yourself a whole lot of hurt and expand your partition size….now! The following steps will be useful:

  1. Change to the root user with this command:
    $ sudo -i
    
  2. Check the disk space usage using the following command:
    root@beaglebone:~# df -h
    
  3. Go to this directory as follows:
    # cd dir: /opt/scripts/tools
    
  4. Check the available files using this command:
    # ls
    

    You will see the grow_partition.sh script. This is a bash script included in the BBB distribution that will run a routine to expand your SD card space.

    Now, run the following:

    # bash grow_partition.sh
    

    Alternatively, you can also run the following command:

    # sh grow_partition.sh
    
  5. Finally, running ls again on your drive will show a higher percentage of available space:
    # ls
    

Backing up a code image to a file

  1. Insert a microSD card into your desktop machine's card reader and confirm that it's recognized.
  2. On your desktop box (Mac, in our case), open Terminal and type the following:
    $ diskutil list
    
  3. From the list shown, write down the ID for your SD card. In my case, it looks similar to this:
    /dev/disk1
    
  4. Now, we will run a routine that backs up the content of the card to your desktop and simultaneously archives it to save space:
    sudo dd if=/dev/rdisk1 bs=1m | gzip -9 > ~/Desktop/backupimage.img.gz
    
  5. Input your password at the prompt. When you do so, the routine will run and may take several minutes depending on the amount of data you're backing up.

OS image flashing – the SD card boot

In this section, you will learn the recipes to load the OS and boot from a microSD card. Much of the process is similar to how we flash the eMMC internal drive; however, it is important to take note of the differences.

Getting ready

You will need the following:

  • BeagleBone Black powered down
  • A 5V DC power supply or a USB tethered to the BBB.
  • A MicroSD card (4 GB or greater)
  • An SD card reader. You will insert the microSD card into the card reader and the card reader into an SD port on your desktop machine.
  • A board connected to either an HDMI monitor or an LCD cape (as explained earlier in this chapter).

How to do it...

Perform the following steps:

  1. Using the wget command, get the latest software image and put it on your desktop computer.

    The latest version of the shipping OS is at http://beagleboard.org/latest-images. So, you will need to get the exact URL and append it accordingly in the following command. Note the URL difference from the prior recipe for flashing the internal drive:

    $ wget https://rcn-ee.com/rootfs/bb.org/release/YEAR-MONTH-DAY/lxde-4gb/bone-debian-7.8-lxde-4gb-armhf-YEAR-MONTH-DAY-4gb.img.xz
    

    The preceding link references a Rev. C board, which is the currently shipping version. If you have another version of the BBB, you can find software for prior releases at http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Debian_Build_Instructions.

    Note

    Debian testing version

    You can also alternatively install Debian 8 (Jessie) using the same steps by substituting the following URL and appending the month, day, and year accordingly:

    https://rcn-ee.com/rootfs/bb.org/testing/YEAR-MONTHDAY/lxqt-4gb/bone-debian-8.0-lxqt-4gb-armhf-2015-05-04-4gb.img.xz

  2. Next, unpack, unzip, or unarchive the downloaded file using your favorite archive tool. On my Mac, I use Unarchive as it's easy to use and flexible. After unarchiving, there will be an .img file available in your chosen folder.
  3. Now, we will flash the .img file to the microSD card. The easiest method is to use a GUI-like tool such as Pi Filler for the Mac or Win32 Disk Imager on your Windows box.

    Wait for a prompt from the imaging software before actually inserting the SD card into the desktop's slot. Depending on the speed of your desktop box's environment, the flashing/writing process will take anywhere from 15 to 30 minutes.

  4. Remove the SD card from your desktop after the flashing finishes and then remove the microSD card. Ensure that your BBB is powered down and then insert the card into the microSD slot on the BBB.

    Either with the USB tether or a 5V power supply, power up the BBB.

  5. In your terminal window, we will now SSH into the board with this command:
    $ ssh debian@192.168.7.2
    
  6. When the login prompts appear, use the following credentials:
    username: debian
    password: temppwd
    

Updating your current OS kernel

Sometimes, you want to stick with what you have already installed as it runs fine and does the job. But more often than not, you want the latest and greatest kernel, including updating to Debian 8.0, aka Debian Jessie. The following steps show you how:

  1. Ensure that you are logged in as the root user with the following command:
    $ sudo -i
    root@beaglebone:~#
    
  2. Check the version of the kernel that you have currently installed:
    # uname -r
    3.8.13-boneXX
    
  3. Navigate to the directory with the update kernel script:
    # cd /opt/scripts/tools/
    
  4. Run a command on the kernel you currently have installed that pulls down to your local drive information regarding any changes:
    # git pull
    

    Note

    We will explore the git command in a later chapter.

  5. Now, we will run the script that takes advantage of the information we just pulled down and updates our OS:
    # ./update_kernel.sh
    
  6. Time to reboot! Run the following command:
    # reboot
    
  7. When the login prompts appear, use the following credentials:
    username: debian
    password: temppwd
    
  8. Finally, verify that the script did what we expected through the following command:
    $ uname -r
    3.8.13-boneXX
    

Compare the preceding screen output with the version you wrote down in Step 2 of this recipe. You should, hopefully, see the new version kernel goodness.

See also

If you know a specific version you want, you can also update or modify your kernel with an alternative method using a series of command-line steps:

  1. Log in as root as follows:
    $ sudo -i
    
  2. Check the kernel version with this command:
    # uname -r
    
  3. Update your repositories with this command:
    # apt-get update
    
  4. Find available kernel versions using this:
    # apt-cache search linux-image
    

    The screen output will deliver a long list of kernel options. Scroll the list until you find one with the label: Linux kernel, version 3.8.13-boneXX (with the XX being a two-digit number).

  5. Install the kernel you want by explicitly specifying a version number from the list in the prior step as follows:
    # apt-get install linux-image-x.x.x-xx
    
  6. Reboot your board as follows:
    # reboot
    $ uname -r
    

    Your new kernel should now be installed on your board.

Left arrow icon Right arrow icon

Key benefits

  • Learn how to develop applications with the BeagleBone Black and open source Linux software
  • Sharpen your expertise in making sophisticated electronic devices
  • Explore the BeagleBone Black with this easy-to-succeed recipe format

Description

There are many single-board controllers and computers such as Arduino, Udoo, or Raspberry Pi, which can be used to create electronic prototypes on circuit boards. However, when it comes to creating more advanced projects, BeagleBone Black provides a sophisticated alternative. Mastering the BeagleBone Black enables you to combine it with sensors and LEDs, add buttons, and marry it to a variety of add-on boards. You can transform this tiny device into the brain for an embedded application or an endless variety of electronic inventions and prototypes. With dozens of how-tos, this book kicks off with the basic steps for setting up and running the BeagleBone Black for the first time, from connecting the necessary hardware and using the command line with Linux commands to installing new software and controlling your system remotely. Following these recipes, more advanced examples take you through scripting, debugging, and working with software source files, eventually working with the Linux kernel. Subsequently, you will learn how to exploit the board's real-time functions. We will then discover exciting methods for using sound and video with the system before marching forward into an exploration of recipes for building Internet of Things projects. Finally, the book finishes with a dramatic arc upward into outer space, when you explore ways to build projects for tracking and monitoring satellites.

Who is this book for?

If you are a hardware, Linux, and/or microcomputing novice, or someone who wants more power and possibilities with product prototypes, electronic art projects, or embedded computing experiments, then this book is for you. It is for Internet of Things enthusiasts who want to use more sophisticated hardware than the Raspberry Pi or the Arduino can provide. Whether you are an engineering student, a DIYer, an inventor, or a budding electronics enthusiast, this book delivers accessible, easy-to-succeed instructions for using an advanced microcomputing platform.

What you will learn

  • Set up and run the BeagleBone Black for the first time
  • Learn the basics of microcomputing and Linux using the command line and easy kernel mods
  • Make introductory projects with Python, JavaScript, BoneScript, and Node.js
  • Explore physical computing and simple circuits using buttons, LEDs, sensors, and motors
  • Discover the unique features of the BeagleBone Black and its real-time computing functions
  • Build intermediate level audio and video applications
  • Assemble and add ingredients for creating Internet of Things prototypes

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 18, 2015
Length: 346 pages
Edition : 1st
Language : English
ISBN-13 : 9781783982929
Category :
Concepts :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Nov 18, 2015
Length: 346 pages
Edition : 1st
Language : English
ISBN-13 : 9781783982929
Category :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 98.97
BeagleBone Black Cookbook
€36.99
Learning BeagleBone
€24.99
Mastering Beaglebone Robotics
€36.99
Total 98.97 Stars icon
Banner background image

Table of Contents

10 Chapters
1. Setting Up for the First Time Chevron down icon Chevron up icon
2. Basic Programming Recipes Chevron down icon Chevron up icon
3. Physical Computing Recipes Using JavaScript, the BoneScript Library, and Python Chevron down icon Chevron up icon
4. Exploring GNU/Linux Recipes Using Bash, Autotools, Debugger, and systemd Chevron down icon Chevron up icon
5. Basic Programming Recipes with the Linux Kernel Chevron down icon Chevron up icon
6. Run Faster, Run Real Time Chevron down icon Chevron up icon
7. Applied Recipes – Sound, Picture, and Video Chevron down icon Chevron up icon
8. The Internet of Things Chevron down icon Chevron up icon
9. The Black in Outer Space Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(2 Ratings)
5 star 50%
4 star 0%
3 star 0%
2 star 0%
1 star 50%
Matthew Lucero Apr 24, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book to have on your shelf or Kindle... It is an easy read and contains great information regarding the Beaglebone Black
Amazon Verified review Amazon
Engineer Dec 01, 2020
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
The description of this item did not state that the information is pre-2015. The Debian LINUX OS for the BeagleBone Black is completely different and that makes this book a complete waste of money. I do not recommend this book at all! The recipes and solutions are very simplistic and most no longer work on the platform because the referenced items no longer exist.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.