Introduction

This is the chapter web page to support the content in Chapter 3 of the book: Exploring BeagleBone – Tools and Techniques for Building with Embedded Linux. The summary introduction to the chapter is as follows:

This chapter exposes you to the core concepts, commands, and tools required to effectively manage embedded Linux systems. The first part of the chapter is descriptive—it explains the basics of embedded Linux and of the Linux boot process. After that, content on how to manage Linux systems is structured so that you can perform the steps yourself. You are strongly encouraged to open a terminal connection to your BeagleBone and follow along. Later in the chapter, the Git source code management system is described. It is an important topic, as the source code examples in this book are distributed via GitHub. Desktop virtualization is also described, as it is very useful for cross‐platform development in later chapters. The chapter finishes by describing how you can download the source code examples for this book.

Learning Outcomes

After completing this chapter, you should be able to:

  • Describe the basic concept of an embedded Linux system.
  • Describe how an embedded Linux device, such as the BeagleBone, boots the Linux OS.
  • Describe important Linux concepts, such as kernel space, user space, and system initialization.
  • Perform system administration tasks on the BBB.
  • Use the BBB file system effectively.
  • Use a range of Linux commands for file and process management.
  • Manage your own software development projects using Git.
  • Install a Linux distribution on your desktop computer host OS using desktop virtualization tools, such as VirtualBox.
  • Download the source code for this book using Git.

Important Notes

  • Please do not install a Debian Wheezy (Debian 7) image on your desktop machine as there is a known issue with the embedded cross-compilation tools, which is due to a server compromise that occurred subsequent to the publication of the book. Instead, it is strongly recommended that you install a Debian Jessie (Debian 8) image. As of this date (May 2015), Debian 8 has been officially released — see: https://www.debian.org/CD/netinst/. The typical installation is the amd64 netinst for readers who have an Intel x86 64-bit machine). See the guide below on installing a Linux guest under a Windows host.

Debian Jessie (click for larger image)

Further Materials

The tree utility

An additional utility that is not described in Chapter 3 is the tree program. It allows you to obtain a visual display of the directory tree using only the Linux terminal. The command is not installed by default, so begin with:

Once the tree program is installed, you can test it on a directory of your choice, for example:

You can also use options (use man tree to see the full list) such as: -a display all files including hidden files, -l follows symbolic links, -u displays the owner, -C turns on colorization, -L 2 displays only the first two levels, and -d displays only directories. So, for example:

displays only the first level of directories in the exploringBB directory.

Mounting the SD Card Automatically

In the Example, Mount an SD card as additional storage on the BBB, there is one final step that is alluded to but not discussed in the book as it is a very specific usage. This step ensures that the SD card is mounted automatically when the BBB is booted, and is as follows:

Step 5: If you want the SD card to be automatically mounted when the BBB is booted, you could add an entry to the file /etc/fstab. In theory you should be able to add the entry as follows, using nano:

However, the /dev/mmcblk1p1 can change to /dev/mmcblk0p1 when you reboot the BBB (depending on whether the card is present or not). Therefore, you have to mount the device using its UUID (universally unique identifier). Find the UUID by typing blkid (or ls -l /dev/disk/by-uuid/):

Highlight the UUID by using the left mouse button at the beginning and use the middle-mouse button at the end to copy. Type nano /etc/fstab, and when you get to the bottom of the file, right-click the mouse button to paste the text into the editor. The entry in the /etc/fstab file should look like (where the last two lines are all on the same line, i.e. two spaces after ext4 then defaults)─be very careful or your BBB may not reboot properly:

The SD card is mounted with that UUID at the mount point /media/store. It is an ext4 file system. The options are as follows:

  • defaults: Use default settings
  • nofail: Mount the device when present but ignore if it is absent
  • user: The user gives permissions to mount the file system
  • auto: The card will be mounted on start-up, or if the user types mount -a

The 0 0 values are the dump frequency (archive schedule) and pass number (order for fsck at boot) and should be these values by default.

On reboot you can do the following:

Regardless if the SD card is absent or present, the BBB will boot perfectly.

VirtualBox: Installing a Linux Guest Under a Windows Host

Here are some tips on installing a Linux guest VirtualBox VM under a Windows host:

  • Enable VT-x/AMD-V in the system BIOS settings of your physical computer in order to run a 64-bit guest OS.
  • Install VirtualBox (virtualbox.org) on your host OS.
  • Download your favourite Linux distribution as an ISO file. In this book 64-bit Debian is used. Download the Net debian-jessie-DI-rc1-amd64-netinst.iso or equivalent from the page www.debian.org/releases/. Do not use the ia64 branch unless you are using a high-end Itanium-based server. Important: see note at the top of the page about Debian Wheezy.
  • Start Oracle VM VirtualBox Manager and choose New. If available, give the installation 2GB+ memory. Create a virtual hard drive (VDI format, dynamic allocated) and make the size much greater than the 8GB it recommends. Choose the location on your computer to store the disk and use a minimum of 25–30GB! It is difficult to resize a disk after the fact. If you choose “dynamically allocated”, it will only occupy real disk space when you fill the Linux disk, so feel free to choose a large disk size.
  • You now have a new VM that is powered off. Select it and click on settings. Under storage you should see your VDI (under SATA) and an “Empty” entry (under IDE). Select the “Empty” entry and click the disk icon under Attributes. Find and select the Linux ISO file that you downloaded, as shown in the figure below.

Figure 2-A1: The VirtualBox VM configuration pane

  • Start your VM and install Linux by booting off the virtual drive. If you see a message “No Boot Device,” go to Settings System and disable the floppy drive.
  • Once your guest OS is running, choose Devices Install Guest Additions from the menu bar of your VirtualBox window. If all goes well, you will now be able to resize the window and cut-and-paste text between the host and guest OSs (by enabling Devices ⇒ Shared ⇒ Clipboard Bidirectional).
  • Choose “Devices”->”Insert Guest Additions CD image…”
  • If the guest additions do not install automatically, follow these steps (for Debian desktop — tested on Wheezy and Jessie images) in a terminal window:

  •  With your network settings set as NAT on Adapter 1 (default setting) you should now be able to ping 192.168.7.2 (your BBB when using Internet-over-USB), or its equivalent network IP address (if connected by regular Ethernet).

 If you go to the VirtualBox System ⇒ Processor settings, you will see the number of cores that can be allocated to the guest OS. On an Intel i7 processor you will see either 16 or 24 as the upper limit, depending on your exact processor. On a 4-core processor, you will see one core per thread, so 8 “real” cores, and you will also see that number again in “virtual” cores. Do not use virtual cores, as they will be provided through time slicing and your machine may slow down considerably. The maximum number of cores you should allocate to your guest OS is the total number of real cores minus one.

Useful tools – Cairo Dock

The latest windowing interface for Debian Jessie contains some very nice features, but it is quite lean. One tool that is useful and will be familiar to Mac OS X users is the Cairo Dock. It is illustrated in Figure 2-A2 below. You can install it using the following step:

cairo-dock-capture
Figure 2-A2: The Cairo Dock in action under Debian 8 (Jessie)

Debian 8 Jessie uses Gnome 3. To start up this dock automatically on boot you can perform the following steps:

And then click “Startup Applications” on the left-hand menu. On the right-hand pane click on the “+” icon and add Cairo-Dock to the list.

External Resources

Important Documents

External Web Sites

Pro Git book (free online)

The BeagleBone Black System Reference Manual (SRM)

Recommended Books on the Content in this Chapter

       

Errata

  • On page 61 at the bottom of the feature item that begins: “The IP address matches…” This should be: “The MAC address matches…”
  • On page 64 the default runlevel is 5 (as indicated in the example), not 2 as indicated at the top of the page.
  • On page 73 there is a space missing in the command “chmod u=rwxs,g=rxs,o=myexe” between the = and the myexe. It should be: “chmod u=rwxs,g=rxs,o= myexe
  • On page 76 under media — typo: “a micro-SD cards” → “a micro-SD card”
  • On page 80 the mount name changes between /6462-3063 and /9016-4EF8. This should be the same throughout the example.
  • On page 87 the first line begins “The exit status for date is…” This should be: “The exit status for ls is…”
  • On page 92 (Loc 3208) the command “watch ps a” is issued. This should be “watch -n 1 ps a” to give a one second delay between updates. The correctly issued command is visible in the process list below the command call.
  • Page 94 update after publication: www.getgitorious.com has been acquired by www.gitlab.com, so www.gitlab.org is now www.gitlab.com and www.gitorious.org will shut down at the end of May 2015.
  • On page 97 the Note states that “git commit -a will commit modified files directly to the staging area“. It should state “to the local repository“, as illustrated in Figure 3-4.
  • On page 97 there is a production error on the center of the page. Both commands should have two hyphens in front of the global flag, so “git config -global” should be “git config –global