Updating the Beaglebone Microcontroller

Updating the Linux OS image for the Beaglebone Black (BBB) can be a ceremony in and of itself. Luckily, if one has the steps in order before starting, things can be easier. Having done this a few times, I have decide to create this post mainly for myself, but also for others who need a set of instructions to rely on.


For this process, one will need the following:

  • A Debian Linux image for the Beaglebone Black
  • A SDCard
  • A host computer running Linux OS
  • A Beaglebone Black (BBB) microcontroller
  • A home internet router
  • An ethernet cable
  • Balena Etcher software package


Note: Some screenshots were taken “out of date” or “out of order” šŸ˜‚

Obtaining an OS image

For Debian Linux OS images for the BBB, I always visit elinux.org. That site contains 4 Debian-based images one can choose from based on what you want to accomplish with the BBB. I always choose the smallest image, the one with the wordĀ console in its name. This image is just under 1 GB in size and is the smallest offering of the presented images. The direct link to the Linux OS images page is here. There is one console image for each target media. Click on the eMMC flasher image and save the image to theĀ Downloads folder. In the terminal window, navigate to theĀ Downloads folder and decompress the XZ archive:

tar -xf <image_name>.tar.xz


Formatting the SDCard

Insert the micro SDCard into the SDCard adapter and then into the SDCard slot. If the gparted program is not on your system, please install it:

sudo apt-get install gparted

Once installed, invoke the program from the terminal window:

sudo gparted

In the drop down menu on the far right, select the volume corresponding to the SDCard. Delete all partitions currently on the card. To do that select each partition, then go to the menu bar and click Partition -> Delete:



Once all the operations for deleting the partitions have been queued, go to the menu bar and click Edit -> Apply All Operations



When the prompt appears, click “Apply”:



Once the operations have finished, it is now time to format the card. In the file menu, click Partition -> New. Select “fat32” as the file system and “Primary Partition” for “Create as”, then click the “Add” button:



Again, file menu Edit -> Apply All Operations, click “Apply” at the prompt.


Preparing the Image

We need to edit file in the image before flashing it to the eMMC on the BBB. In theĀ /tmp directory, create a folder to mount the image:

sudo mkdir /tmp/img

Now, let us determine the sector size and start for the image. In the terminal type the following and hit [enter]:

fdisk -lu <image_name>.img

Make note of the sector size and the start, they are need to compute the offset needed when mounting the image. Mount the image to the folder created earlier:

sudo mount -o loop,offset=m,rw,sync <image_name>.img /tmp/img

whereĀ m = sector size X start

Result of fdisk command for image

So for my case, the command would be the following:

sudo mount -o loop,offset=4194304,rw,sync bone-eMMC-flasher-debian-10.1-console-armhf-2019-09-15-1gb.img /tmp/img

Now, navigate inside the mounted folder location. Once inside, navigate to theĀ boot folder and open the file namedĀ uEnv.txt:

sudo vim uEnv.txt

This file contains options for setting up the BBB during the eMMC flashing process. Any line with a leading ‘#’ is a comment and is not executed during that process. I normally disable the audio, video, and wifi by removing the leading ‘#’ in the lines containing reference to them. Also, verify there is no leading ‘#’ in the line containing the command to flash the eMMC upon bootup (normally the last line in the file). Save the file and exit VIM.

I like to also add the the prebuilt Boost shared libraries that I know will be need for my applications on the BBB. I add them to the OS such that they will be loaded by the system and I do not have to add the to the $PATH. Navigate toĀ /etc/ld.so.conf.d and open/create the following file:

sudo vim boost.conf

Inside this file, type in the location where the Boost shared libraries are stored on the system. This is what is inside the file on my image:

# path to Boost libraries
/home/debian/boost

Navigate to theĀ /home/debian folder inside the BBB Linux image, create a folder named ‘boost’. Next, copy the necessary Boost libraries into this folder. In this case, I navigate to the home folder on my host system, go into the boost-1.71.0-armv7/libs folder (folder created and libraries built earlier), then copy the following Boost shared libraries into the /home/debian/boost folder inside the mounted BBB Linux image:

cp libboost_thread.so libboost_chrono.so libboost_system.so libboost_program_options.so /tmp/img/home/debian/boost

At this point I am ready to burn the image to a SDCard, so I unmount the image:

sudo umount -f /tmp/img


Burning the Image to SDCard

If you do not have the Balena Etchter image burning software on your system, please download the Linux version from here and uncompress the archive. The program is an AppImage, which is a software packaging containing everything the program needs and is quite large. In the terminal window, navigate to the location ofthe Etcher program, start the program, and follow the guided steps.

./balena-etcher-electron-1.4.9-x86_64.AppImage

This is what my window looks like after following the steps but just before burning the image to the SDCard:

Balena Etcher

Click the “Flash!” button and wait for the program to finish operation. I prefer using this as opposed to Linux dd command.


Flashing the BBB emmc

Remove the SDCard adapter from the host computer. Remove the SDCard from the adapter. Make sure the BBB and micro-USB to USB Type A cable is nearby. Insert the SDCard into the SDCard slot on the BBB. Plug in the micro-USB end of the USB cable to the the BBB. Using one hand, press and hold down the boot button. Using the other hand, insert the USB Type A end of the USB cable into the a USB port on the host computer to provide power to the BBB. Wait for all four user LEDs on the BBB to flash together and turn off, then release the boot button.

The flashing the the eMMC will start in about a minute. While the process is taking place, the LEDs will light one at a time in a “back and forth” manner. When the process is complete, the BBB will automatically power off. Once the BBB powers off, remove the SDCard from the slot.

Accessing the BBB after Flashing the eMMC

Make sure to have the USB cable and an ethernet cable close by. Plug one end of the ethernet cable into the BBB and the other into your home internet router. Then, plug the micro-USB end of the USB cable into the BBB and the other end into the USB port on the router if it has one, or use a USB wall power device and plug the Type A end into a USB port. From a computer, one can log into the BBB via SSH using the default settings:

username: debian
password: temppwd
IP address: 192.168.0.7

In the terminal window:

If you make it to the other side, congratulations you have successfully flashed a new image to the BBB. Also, change that default passwordā—ļø