Skip to content

Day 8 - Linux Device Model & Device Tree

Summary

Today I learned how Linux manages hardware using a structured model.

Instead of directly accessing hardware, Linux uses:

Bus <-> Device <-> Driver

Key Concepts

Device Model

  • Devices and drivers are separated
  • Matching happens through bus
  • probe() is called after matching

Platform Driver

  • Used for fixed hardware in embedded systems
  • Created from Device Tree

Device Tree

  • Describes hardware layout
  • Not part of driver logic
  • Enables driver reuse

sysfs vs dev

  • /dev → user interface
  • /sys → kernel device structure
  • /proc/device-tree → hardware description

Hands-on Observations

  • Found many buses in /sys/bus
  • Explored platform devices and drivers
  • Confirmed test-device@0 exists in:
  • /proc/device-tree
  • /sys/bus/platform/devices

Important Insight

Even without a driver:

Device Tree → platform device (exists)
Driver → not yet attached

Issues & Notes

  • dtc shows many warnings when dumping live DT
  • warning about test-device@0 due to missing reg
  • naming should be improved

Conclusion

  • Linux driver is not standalone
  • Device Tree plays a critical role
  • sysfs is essential for debugging

Next Step

Convert test-device into a platform driver and trigger probe()