1

Is there any way we can create device tree node and its properties in a kernel module, are there any such API's in linux kernel.

valmiki
  • 701
  • 9
  • 24
  • Why you want to do that? This will clearly defy the purpose of using device tree itself. Device trees are originally used to separate platform data information from the kernel and keep the kernel untouched for any platform data changes. The idea is not to compile the kernel every time when there is a platform data change. All device platform data should come only in device tree files. – a.saurabh Jan 30 '17 at 13:42

1 Answers1

0

Device tree just used to send device information to the kernel. If kernel is already started you can save your devices in structures which contains the device tree information after parsing for that have a look here structure is defined in struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)

Or you can edit the dts file Reference: read/ write file from kernel module if you want to save it for further use.

Community
  • 1
  • 1
Samrat Das
  • 1,781
  • 1
  • 21
  • 33
  • While this might work the new approach to override properties from code is designed and under development. It's called built-in unified device property API. As an example one may look at rfkill_gpio: *arch/arm/mach-tegra/board-paz00.c*, *net/rfkill/rfkill-gpio.c*. – 0andriy Mar 31 '16 at 17:37