Linux Device Tree

Linux Device Tree

What is the device tree in linux kernel ?  

Let's imagine there is no such a thing called "Device Tree". You bought a board and this board has some peripherals installed on it like (UART , SPI , I2C , EEPROM , Buttons , etc..).

How can OS know about these peripherals ? as they are not self-discoverable , cannot make their presence to the kernel by themselves.

The first solution comes to your mind is to create some sort of config source file containing data structure for each device for its own information and compile it with the kernel.

How then this device is initialized ?

when this device driver is loaded to the kernel (using insmod function which dynamically attach modules to the kernel on runtime). probe function is called to check if there is a device with this name defined in the kernel then initialize the device to be ready to be used.

What if I have many boards with different devices attached ? then I should compile the linux kernel each time with different board_config sourcefile.

MANY DEPENDENCIES ? could be a problem. For each board I have to hard-coding info and compile a new kernel.

So, the linux community suggested that each board vendor creates his own board config file and include them all in one general kernel for better reusability.

This board config files is called .dts/.dtsi (device tree source files). These files only need to be compiled with DTC (device tree compiler) producing .dtb files (device tree binary) that is then loaded to the RAM . Kernel needs only the address where this .dtb is loaded on RAM not the entire kernel to be changed with each board.

#Baby_Steps_Embedded_Linux
























Venkatesh Ummadi Setty

Senior Software Engineer at Tata Elxsi

2 个月

Good point

回复
Bhavik Prajapati

ASIC Design Engineer at Nokia

4 年

Neat and clean information for beginners. Keep posting more articles on Linux. Thanks.

Abdallah Rashed

Software Engineer Mercedes-Benz Innovation Lab

4 年

if these devices is not self-discoverable? how kernel could know when the device is loaded to go and call probe function? using insmod function which dynamically attach modules to the kernel on runtime is it the answer ? can you explain more about insmod

Mustafa Alaa

Embedded Linux Tech Lead at Arrow Electronics

4 年

Simple and informative

Yahya Tawil

Embedded Systems Engineer | M.Sc. in ECE | Consulting Services Provider

4 年

Clear, Short and yet informative. I would like to invite you be a guest writer at Aatdiat (https://atadiat.com/en/) if you are looking to host this series in a our blog.

要查看或添加评论,请登录

Dina A. Elgendy的更多文章

  • Commonly used patterns in Embedded systems

    Commonly used patterns in Embedded systems

    Introduction: When you have a problem to solve using software, you start thinking of analyzing the problem to help you…

    12 条评论
  • Exploring Adaptive AUTOSAR

    Exploring Adaptive AUTOSAR

    Introduction: Adaptive Autosar, Vehicle connectivity, High Performance Computer. You may hear these terms repeatedly in…

    18 条评论
  • Top 100 embedded system interview questions

    Top 100 embedded system interview questions

    Hello colleagues, I collected these important interview questions from my previous experience and some of them from…

    5 条评论
  • Designing Real Time System - Part 2 Static Scheduling

    Designing Real Time System - Part 2 Static Scheduling

    Static schedulers are very common in real-time systems. They are both simple and predictable, which are two desirable…

    1 条评论
  • List of some Important Embedded System Interview Questions & Answers

    List of some Important Embedded System Interview Questions & Answers

    The original Post : https://www.linkedin.

    25 条评论
  • Designing Real Time System - Part 1 Introduction

    Designing Real Time System - Part 1 Introduction

    Real time system is the system which a real time task is executed exactly at its deadline. There are 2 types of real…

    19 条评论
  • Linux Booting Process

    Linux Booting Process

    If we have an embedded target with arm based processor, let's get to know the process of booting a linux image on this…

    15 条评论

社区洞察

其他会员也浏览了