Exporting and Unexporting an Overlay

The following examples are demonstrated using the default Angstrom distribution.

To start with, navigate into /lib/firmware to view all of the device tree overlays available by default.
root@beaglebone:~# cd /lib/firmware
root@beaglebone:/lib/firmware# ls -ltr
total 888
...
You'll see quite a few overlays available. The source (dts), and compiled (dtbo) files are both in that directory.

Open any of the source files to view their contents. The overlays themselves are fairly descriptive, and well commented.

Let's use the BB-UART1-00A0.dts that we walked through on the previous page.

We could view the .dts file, but we already know what it contains. Let's take advantage of the fact that there's already a compiled .dtbo file available to us. We'll build and compile one of our own in a future section.

Ok, let's next navigate to where we can view which overlays are enabled by the bone cape manager:
root@beaglebone:/lib/firmware# cd /sys/devices/bone_capemgr.*
Note above, the * is necessary as we don't know what that number can be. It depends on the boot order. I've seen the path as /sys/devices/bone_capemgr.8/slots, as well as /sys/devices/bone_capemgr.9/slots. You'll need to determine what your particular path is.

Next up, cat the contents of the slots file:
root@beaglebone:/sys/devices/bone_capemgr.8# cat slots
It should look something like this, assuming you haven't customized your Angstrom installation very much:
0: 54:PF--- 
1: 55:PF--- 
2: 56:PF--- 
3: 57:PF--- 
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
According to the BeagleBone documentation, "the first 3 slots are assigned by EEPROM IDs on the capes". The next two are overlays loaded at boot. Number 4 is the EMMC memory built in that you're mostly likely booting your Angstrom distribution from. The 5th overlay is for enabling the HDMI component.

If you were to now export another overlay, such as our favorite UART1 overlay, you would see a new option listed as number 6. Let's try that by exporting the UART1 dtbo file:
root@beaglebone:/sys/devices/bone_capemgr.8# echo BB-UART1 > slots
We're taking the output of echo, "BB-UART1", and writing it to the slots file to enable the drivers and device for UART1 using the overlay. Now, let's check that the overlay loaded properly:
root@beaglebone:/sys/devices/bone_capemgr.8# cat slots
We should now have the UART1 device loaded up, and ready to go:
0: 54:PF--- 
1: 55:PF--- 
2: 56:PF--- 
3: 57:PF--- 
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G
5: ff:P-O-L Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI
6: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-UART1
Now, let's say you're done with using the UART1 device, and need those pins for something else. One way to remove the overlay would be to restart your BeagleBone. The other way would be to unexport it.

You can export it by executing the following command:
root@beaglebone:/sys/devices/bone_capemgr.8# echo -6 > slots
We took the 6th listed option, and put a '-' before it, and wrote it to the slots file.

One thing to note. As of the 6-20-2013 release of Angstrom, unloading various overlays can cause a kernel panic, and cause you to lose your ssh session, along with making the capemgr unpredictable. It's recommended to just restart your system to unload overlays until that issue is resolved.

Now that we know that restarting the system will cause the overlays to unload, how do we have them loaded when the system boots up?

This is fairly simple to do. All you need to do is reference them in the uEnv.txt in the small FAT partition on your BeagleBone Black.

The following steps illustrate how to do this for the UART1 overlay:
mkdir /mnt/boot
mount /dev/mmcblk0p1 /mnt/boot
nano /mnt/boot/uEnv.txt
#append this to the end of the single line of uEnv.txt (not on a new line):
capemgr.enable_partno=BB-UART1
Last updated on 2015-05-04 at 04.27.11 PM Published on 2013-07-29 at 11.37.59 AM