Device trees and device tree overlays
-
Hi all,
I recently made some hardware that made me want to modify my Omega2's device tree. It was a bit of a mess. While I finally got something that worked, the steps had looked like this:
(Hint: these are probably the instructions you want)
- Following the instructions to get the LEDE build system here
Building a system image using those instructions and then discovering that is has almost no packages installed- Update feeds:
./scripts/feeds update -a - Install all packages:
./scripts/feeds install -a - Tweaking anything I want in the image config:
make menuconfig - Tweaking anything I want in the kernel config:
make kernel_menuconfig - Copying in my modified device tree fragment:
cp modified_OMEGA2.dtsi ./target/linux/ramips/dts/OMEGA2.dtsi - Pre-downloading package sources:
make download - Trying to build:
make -j 8 - Fixing and poking and recompiling or outright disabling packages that don't build:
make package/{packagename}/{clean,compile,install} V=s - Finally getting an image for sysupgrade:
ls ./bin/targets/ramips/mt7688/lede-ramips-mt7688-omega2p-squashfs-sysupgrade.bin
All that just to make the LEDs on my Ethernet port blink! (using kernel LED triggers from Ethernet traffic)
There seems to almost be a better way. From what I can tell, there's a few places with patches enable allow runtime modification of the device tree, as well as loading of those device tree fragments in /sys/kernel/config.
I believe this is how the Beaglebone cape manager system works, and it looks like the Raspberry Pi people are using a similar system too to support hardware variants. It seems to have been adopted for some SoC's with FPGA's, as the hardware can change while you're booted.
Does anyone know why this isn't in the mainline kernel yet? Or in the Onion's kernel? It seems like it would be really useful for any time you add hardware that has existing kernel support, and it looks like it's been around for a couple of years.
Is there some other (better) way to do this? Had anyone had success with device tree overlays in the bootloader on the Omega?
I admit that I tried patching this in myself (the configfs device-tree modification is the specific part that's missing), and I had lots of failures. Can anyone can point to a concise patchset that does it? I'd be interested in trying again. Has anyone else gotten this working?