Search code examples
linuxlinux-kernelkernellinux-device-driverdevice-tree

Built-in kernel driver still need device tree?


If I build a kernel driver as a module, it can be inserted into the kernel at run-time manually with insmod or modprobe, that i am clear. But are the following statements about device tree, correct?

  1. If I build a kernel driver as a module it will be auto inserted into the kernel at boot time, depending on whether it is listed in device tree or not
  2. If I build a kernel driver as a built-in, it will be auto inserted into kernel at boot time regardless of device tree

Solution

  • Built-in kernel driver still need device tree? Yes. Concept of device tree is orthogonal to whether drivers are built-in or compiled as modules. Device tree contains information about the hardware. Platform bus passes that info to relevant drivers.

    This is a good brief article about platform bus, and how things used to be before device tree: https://www.codeproject.com/tips/1080177/linux-platform-device-driver. Device tree factors out harware info otherwiese hard-coded in kernel code, making the code more portable.