Enable Device tree overlay on startup on BeagleBone Black

Update July 17, 2013: It appears that the reason the overlay can only be gotten from the firmware built in to the kernel and not from the file system (in /lib/firmware) is a bug in the latest kernels. Not sure which kernel numbers are affected by this, but it might work for earlier versions.

Ok, this should have been easy, but alas. Probably took me tree hours to figure it out. The key here is that loading firmware from file system does not work, you have to make it built-in and have it piggybacked with the kernel. This might be a bug because the file drivers/base/firmware_class.c does try to load the file, but fails, presumably due to insufficient rights. Go figure..

For this to work, you need a working “compile the kernel-setup”. Here is one example:

http://wiki.replicape.com/index.php?title=Compiling_the_kernel

Then you need to add the device tree source file to the directory:

kernel/firmware/capes/

So for me adding a capacitive multitouch driver based on I2C, I add the file:

BB-SYNAPTIC-00A0.dts to that directory.

You also need to edit the file

/arch/arm/boot/dts/am335-bone-common.dtsi

and then add something like this:

			/* Always enable the Synaptic multitouch over I2C overlay */
			slot@103 {
				ti,cape-override;
				compatible = "ti,beaglebone-black"; 
				board-name = "BB-SYNAPTIC";
				version = "00A0";
				manufacturer = "Synaptic";
				part-number = "BB-SYNAPTIC";
			};

If you do not want to recompile the kernel every time you want to add this line instead.

compatible = "kernel-command-line", "runtime";

You also have to edit the file kernel/firmware/Makefile

and add your device tree overlay as a cape:

# the virtual peripheral capes for Multitouch
fw-shipped-$(CONFIG_CAPE_BEAGLEBONE) += \
	BB-SYNAPTIC-00A0.dtbo

Recompile with action “uImage” and scp the uImage over to the /boot/ directory if you are on Angstrom. On Ubuntu, it’s the zImage that goes into /boot/uboot/.

 

10 thoughts on “Enable Device tree overlay on startup on BeagleBone Black

  1. I may be missing something, but I’ve certainly managed to add SPI-based
    devices without messing with the kernel (apart from adding the device
    driver). I just put them in an overlay with the SPI interface, and load
    them via uEnv.txt and the cape manager.

    What am I doing wrong?

  2. It works for me to load a custom version of an I2C overlay using this line in my uEnv.txt:
    optargs=quiet run_hardware_tests capemgr.enable_partno=BB-I2C1:00A1
    This is a BeagleBone A4, running the latest demo image Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.12-beaglebone-2013.07.31.img.xz with its stock kernel version 3.8.13

  3. The problem with loading DT overlays at boot time is dependent on the boot device and whether the rootfs with your overlay in it is mounted at the time the cape manager tries to load the overlay. I found when booting from an uSD card, putting the DT overlay files located in /lib/firmware into uInitrd solves this problem (albeit in a slighly ugly manner). I’m not sure if this is the case when booting from the internal eMMC.

    From what I’ve been reading on this problem, there may be a fix for this from Pantelis Antoniou in a forthcoming kernel/capemgr.

    • @T Hess, i think this might be my problem as my overlay isnt applied when i boot, but i cant find uInitrd, can you please tell me where to find it? thanks!

  4. Hi, Ruben! There will be a Kickstarter in a few weeks, so you can get it there. I’m having some custom fronts made so there is no logo or buttons.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>