Beaglebone black – Setup / customization guide

Beaglebone black – Setup / customization guide.

Setting up the Beaglebone black on an sdcard is typically not too hard. Just time consuming – Or it can be to get everything just right. However, not knowing about various things, or how to do them can be a little problematic. In this guide, I will be working with a standalone Debian wheezy image – On an sdcard. But many( perhaps all ) of the things I will be discussing should apply to all situation / Linux distributions. With that said, file locations may be different, and package names from distro to distro may vary. Searching the web using your favorite search engine works great for finding this information. Which is a tool I often use myself – Not always just for this situation.

SDcard setup

There are a few ways this can be achieved. One can use dd, or Win32DiskImager( when running Windows ). Or one might use a separate rootfs, 1st, and 2nd stage boot loaders. Plus tar, fdisk / sfdisk, and a lot of manual copying / work / tools to achieve the same end goal. This later mentioned method is best suited for a separate guide – So will not be covered in this article. First, we need an image file to work with. Links to the latest images can be found here:

A few things to note. First, I will be demonstrating using a console image – From an i386 (x86) Linux system. The image I’m using is also an older image, but that does not really matter. You’ll see why later. Second, on the page for the link above. There are many images. eMMC flasher images are used to flash the eMMC from an sdcard. LXDE images are ~4G in size, and include probably just about everything “under the sun”. The standalone images are meant to run from sdcard. Finally, the console images are typically around 200M disk used in size – But require a 2G or larger sdcard to flash to. There are way around some of the above mentioned limitations – But again, perhaps the subject matter for another article. Let’s get started . . .

Getting started

Insert sdcard into card reader on Linux system, and find device listing for sdcard

The above demonstrates using the command lsblk in order to find, and use the sdcard inserted into our card reader. It is important that you understand which listing above, is which. /dev/sda for example in this case is the main hard drive on this system – Which contains Debian Linux on it. If you’re new to Linux, and have not used a custom file / partition layout for your system. It is very likely this is the device where your running Linux is too. Do *NOT*, by any means use dd on this block device – Unless you know 100% exactly what you’re doing. Device /dev/sdb is my sdcard. I know this as it is a 16G sdcard, with 14.7G usable space, and only a 2G partition on it. In other words – sdb is the whole disk device, and /dev/sdb1 is the first and only partition on that device( disk ).

Check if unxz is installed

If the above command does not display output as demonstrated above. You’ll need to install the unxz package. Use apt to install xz-utils – sudo apt-get install xz-utils

Using unxz to extract the image file
Write sdcard image to sdcard – sdcard must be 2G in size or larger

Once this is done, eject the sdcard from the x86 Linux system. Then type sync – Then reinsert the sdcard if you wish to do any of the following optional steps. At this point however, you may insert the sdcard into the Beaglebone black, and boot from it.

Double check device layout – Optional

The block device layout should be the same as the previous time we used lsblk. But do not be surprised if the device shows up as another sdx device. Especially if you did not use the command sync after ejecting the sdcard.

Mount the sdcard in preparation of file manipulation – Optional

From here, we can make any changes to the Linux images “installed” on the sdcard. Personally, I find it easier to cd into the root of the drive prior to making any changes. It is important to note – Not to use a preceding slash ( “/” ) when working with files. As that would mean you’re working on your currently running Linux – Instead of the files on the sdcard . . .

Giving eth0 a static IP address – Optional

When first using nano on this file. It will look much different. There are several examples for eth0, eth1, loopback, and the g_ether USB gadget network interface. You may wish to keep some, or even all of the file the way it is. This is just an example of one situation one may wish to use. For more information on setting up network interfaces using Debian Linux. Feel free to search the web using the keywords “Debian networking”. Be prepared to read, and learn.

There are also a myriad of other files one may wish to change before booting a Beaglebone black from such an sdcard. In fact, if one wishes to follow something similar to what I’ve demonstrated above. One would probably also want to manually edit the file /etc/resolv.conf to reflect their own network. However, this step is only necessary just before attempting to connect to the internet for one reason or another – And can be done live, while the Beagelbone black is running from the sdcard. Which is possibly a very good idea as the very next step one should do once the sdcard *is* running on the Beaglebone black . . .

ssh into the Beaglebone black once running – Optonal
First things first, change the passwd . . . – Optional( But should not be )

The above step is very important – Especially if the Beaglebone black is facing the internet. Otherwise, any Tom, Dick, or Harry with half a brain will know your regular user passwd – And sudo on these images have passwd enforcement disabled by “default”. But that can be fixed.

Edit the sudoers file – Optional( But should not be )

The statement in the sudoers file – debian ALL=NOPASSWD: ALL – is responcible for no passwd being required when issuing commands while using sudo. This is handy when first setting up an image, but once set in stone – Should be changed to help lock the system down. Use man sudoers, or search the internet for more information on how to change this.

MISC setup steps

Not all of the following steps are required, but many are a good idea to follow through with. At any rate, this is a nice “list” of things to know, or have on hand. If not sure what a given command does – Google works wonders.

Update the APT list, and currently installed packages
Setup time zone
Install ntpdate, and get local date/time
Edit uEnv.txt to disable systemd(optional – specific to Wheezy)

It is important to note that making other changes to this file can cause your Beaglebone black to stop booting – If you do not know what you’re doing. So be careful. Also, introducing Microsoft Windows style linefeeds into this file will also cause a non boot-able situation.

upgrade to newer kernel(optional)

An important note when upgrading to a newer kernel. It may be necessary to rebuild the peripheral device tree files – If you require any. For some this may turn out to be a problem, which I will not be covering in this article. But I do plan on writing an article specifically for this case – Very soon. As I already have the needed material, I just need to write the article. Also note there are other peculiarities when upgrading to a newer kernel. Such as the PRU’s may not work, or the board may autonomously reboot. Or other potential pitfalls. The kernel I chose above, both of these mentioned issues should be moot. But not guaranteed – Obviously. As I personally can not test *everything*.

Certainly, there is a lot more customization that can be done. The above examples, are just that – examples. With some of the things I have on my own mind when installing, and customizing a new Debian image. As always, happy Beagling !

Beaglebone black – Setup / customization guide

2 thoughts on “Beaglebone black – Setup / customization guide

  • October 3, 2015 at 9:36 pm

    Nice article. One that I would be really interested in, and that I have not seen really documented anywhere else, is creating your own .img file of a Debian system after it has been modified so that it contains the features desired for a personal Beaglebone Black. For instance, I’ve downloaded and installed the Jessie 9.2 console system, and have been using it for development purposes, and would like to create my own image file so that I could install that image on future Beaglebone Black’s that I purchase, as well as for a complete backup. Those that I did find that documented this did not work.

    • October 4, 2015 at 12:11 am

      I covered that in the previous article to this one. “Working with Debian(Linux) images”

Comments are closed.