Installing a new Linux OS Image for the Beaglebone Black Single Board Computer (SBC)
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.
Note: Some screenshots were taken “out of date” 😂
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:
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
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.
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
f you do not have the Balena Etchter image burning software on your system, please download the Linux version from here and decompress 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 of the Etcher program, start the program, and follow the guided steps.
This is what my window looks like after following the steps but just before burning the image to the SDCard:
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
If you make it to the other side, congratulations you have successfully flashed a new image to the BBB. Also, change that default password❗️