Hi, The device tree overlays are a great solution to the issue raised by the bunch expandable boards we find everywhere these days, like the Beaglebone, Raspberry Pi or CHIP. However, most of the time, the overlays are applied through a mechanism involving the firmware request interface in Linux, that is only fully functional once the userspace has been mounted and is running. Some expansion boards might need to be enabled before that, because they simply need to patch the DT early on, or need to be initialized early in order to be fully functional, or because they provide access to the root filesystem. In these cases, having the bootloader applying the overlay before Linux starts seems like the easiest solution. This implementation doesn't provide all the Linux fancyness though, there's no transactional application, which means that if the overlay cannot be applied for a reason while you're still halfway through the application, you're probably screwed. It also cannot remove an overlay, but I don't think that it is currently a use-case. The libfdt patches has been sent upstream earlier today for review. Let me know what you think, Maxime Changes from v1: - Moved the overlay code to libfdt - Added unit tests - Refactored the code to reduce the amount of memory allocation - No longer modify the overlay itself, but create a copy to operate on instead. - Removed the limitations on the fixups path, names and properties length - Fixed a few things here and there according to comments Maxime Ripard (9): cmd: fdt: Narrow the check for fdt addr scripts: Makefile.lib: Sanitize DTB names vsprintf: Include stdarg for va_list libfdt: Add new headers and defines libfdt: Add iterator over properties libfdt: Add max phandle retrieval function libfdt: Add overlay application function cmd: fdt: add fdt overlay application subcommand tests: Introduce DT overlay tests Makefile | 1 + cmd/fdt.c | 22 +- include/libfdt.h | 67 ++++++ include/libfdt_env.h | 7 + include/test/overlay.h | 16 ++ include/test/suites.h | 1 + include/vsprintf.h | 2 + lib/libfdt/Makefile | 2 +- lib/libfdt/fdt_overlay.c | 414 ++++++++++++++++++++++++++++++++++++++ lib/libfdt/fdt_ro.c | 15 ++ scripts/Makefile.lib | 8 +- test/Kconfig | 1 + test/cmd_ut.c | 6 + test/overlay/Kconfig | 10 + test/overlay/Makefile | 15 ++ test/overlay/cmd_ut_overlay.c | 176 ++++++++++++++++ test/overlay/test-fdt-base.dts | 17 ++ test/overlay/test-fdt-overlay.dts | 60 ++++++ 18 files changed, 834 insertions(+), 6 deletions(-) create mode 100644 include/test/overlay.h create mode 100644 lib/libfdt/fdt_overlay.c create mode 100644 test/overlay/Kconfig create mode 100644 test/overlay/Makefile create mode 100644 test/overlay/cmd_ut_overlay.c create mode 100644 test/overlay/test-fdt-base.dts create mode 100644 test/overlay/test-fdt-overlay.dts -- 2.8.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html