Reputation: 13707
I have a device tree overlay:
/dts-v1/;
/plugin/;
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
part-number = "mousetraps";
version = "00A1";
/* https://github.com/derekmolloy/boneDeviceTree/blob/master/docs/BeagleboneBlackP9HeaderTable.pdf */
fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
mousetrap_pins: pinmux_mousetrap_pins {
pinctrl-single,pins = <
0x070 0x2f /* P9_11 30 INPUT MODE7 none */
0x074 0x2f /* P9_13 31 INPUT MODE7 none */
0x040 0x2f /* P9_15 48 INPUT MODE7 none */
0x15c 0x2f /* P9_17 05 INPUT MODE7 none */
>;
};
};
};
fragment@1 {
target = <&ocp>;
__overlay__ {
test_helper: helper {
compatible = "bone-pinmux-helper";
pinctrl-names = "default";
pinctrl-0 = <&mousetrap_pins>;
status = "okay";
};
};
};
};
which I can successfully load with:
echo mousetraps:00A1 >/sys/devices/bone_capemgr.8/driver/bone_capemgr.8/slots ; dmesg | grep bone
How can I configure the BBB/Angstrom to load it automatically on boot?
More specifically, how can I hook the dtbo file into the normal Device Tree loading mechanism? I know I can add the echo to a linux init script, but it seems like there must be something that triggers the loading of the dtbo files.
Upvotes: 4
Views: 12055
Reputation: 1564
This worked for me with
From the link provided by @craig-mcqueen and using this device tree overlay example
In the /boot/uboot/uEnv.txt
file (DM-GPIO-Test is the name of my overlay):
cmdline=coherent_pool=1M cape_universal=enable bone_capemgr.enable _partno=DM-GPIO-Test noapic
Create /etc/initramfs-tools/hooks/dtbo
#!/bin/sh
set -e
. /usr/share/initramfs-tools/hook-functions
# Copy Device Tree fragments
mkdir -p "${DESTDIR}/lib/firmware"
cp -p /lib/firmware/*.dtbo "${DESTDIR}/lib/firmware/"
Make it executable:
sudo chmod +x /etc/initramfs-tools/hooks/dtbo
Backup initrd:
sudo cp /boot/initrd.img-4.4.68-ti-r106 /boot/initrd.img-4.4.68-ti-r106.bak
Update initrd:
/opt/scripts/tools/developers/update_initrd.sh
Reboot
sudo reboot
Check that it's been loaded:
root@beaglebone:/home/debian# cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,DM-GPIO-Test
Upvotes: 0
Reputation: 627
you may add an argument in the uEnv.txt that refers to your new overlay as suggested previously add the following string to the end of the uEnv.txt
nano /mnt/boot/uEnv.txt
#add this to the end of the single line of uEnv.txt:
capemgr.enable_partno=mousetraps
the full process is described here
Upvotes: 3
Reputation: 22507
One way to do this would be to copy the dtbo
into /lib/firmware
and modify capemgr.extra_override
parameter in the kernel bootargs
(in uEnv.txt) to point to the dtbo
file. This technique also requires modifications to the /arch/arm/boot/dts/am335-bone-common.dtsi
file. Details in this discussion.
Note that loading the device-tree overlay from the filesystem seems to be an issue specifically with the recent kernels(from the official repository) on the beaglebone black. To overcome this, an alternate method to compile the overlay is described here.
Upvotes: 3