SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Downloaden Sie, um offline zu lesen
Device Tree: Past
Where does it comes from ?
Device Tree: Past
Software Engineers always struggled to describe in a
simple and portable way the different hardwares.
● In code ?
● In binary format ?
● In text format ?
● Auto generated ?
Classic System Architecture
Classic System Architecture
● All the components are interconnected on the board
● High complexity of the board electronics
But :
● Easy to repair and adapt to the various needs
● Easy to design
Classic x86 System Architecture
Classic x86 System Architecture
● Partial integration by :
○ moving all the memory control in the north bridge
○ moving all the peripherals in the south bridge
● Both bridges can be changed easily
Modern System Architecture
Device Tree : Past
● Multiple different solutions were found :
○ ACPI table in the x86 world
○ Device Tree in the SPARC/PowerPC world
● Both solutions describes the hardware in a generic way
that can be parsed and understood by the Operating
System
● ACPI was designed to be very Intel/Microsoft specific,
even if it was used on various architectures with
Windows NT
Device Tree : Past
● ACPI is a very obscure hardware description, aimed to
keep a tight control on the PCs architecture
● Device Tree was designed to be written/understood by
humans then processed to be understood by software
Device Tree : Specifications
● IEEE-1275 formalized specification (1994)
○ The set of devices attached to the system, including
permanently installed devices and plug-in devices, is
described by an Open Firmware data structure known as
the device tree. The operating system may inspect the
device tree to determine the hardware configuration of the
system. Each device in the device tree is described by a
property list. The set of properties describing a device is
arbitrarily extensible so that any type of device and any kind
of information that needs to be reported about the device
can be accommodated.
Device Tree : Specifications
● PowerPC™ Common Hardware Reference Platform (CHRP)
specifies DT (1995)
○ Developed by Apple, IBM and Motorola
○ Extends IEEE-1275 to PowerPC™
● ePAPR specifies DT (2008)
○ Stands for Power.org™ Standard for Embedded Power
Architecture™ Platform Requirements
○ “The ePAPR is loosely related to the IEEE 1275”
○ “Because of the nature of embedded systems, some of
these problems faced by open, general purpose computers
do not apply”
Device Tree : History
Multiple implementation existed with different formats but the same goal :
● Sun Microsystems - Open Boot / Open Firmware (1988)
○ Used in SPARC systems
○ Uses Device Tree to describe hardware
● Apple adopts Open Firmware on Power Mac 7200 (1995) using DT
along IBM
○ Uses Open Firmware and DT until Macs switched to Intel CPUs
○ Still uses a DT form in iPhone/iPad/iPod ARM Based devices
○ PCI devices represented in DT, generated by firmware
Device Tree : History
● 2005 : Linux PowerPC support starts switching to Device tree
● 2006 : First device tree in Linux codebase “mpc8641_hpcn.dts”
● 2007 :
○ Initial Sony PS3 support with basic DTS
○ Common Device Tree implementation for Sparc and
PowerPC in “drivers/of”
● 2009 : microblaze switched to Device Tree
● 2011 : ARM switched to Device Tree
● 2014 : Device Tree used by 12 over 28 architecture
Device Tree: Present
How and where is it used ?
Device Tree : Specifications
http://devicetree.org
● A new initiative appeared to facilitate the future evolution of the
Device Tree Standard.
○ Sponsored by ARM, IBM, Linaro and NXP
○ Continuation of the ePAPR specifications
○ Adapted to current and future hardware
● v0.2 has been tagged on 20th December 2017
● Community Work is done around a github and a mailing-list like a
classic Open-Source project
Device Tree: Present
● Linux
○ Supported in 14 architectures : arc, arm, arm64, c6x,
cris, h8300, metag, microblaze, mips, nios2, openrisc,
powerpc, sh, xtensa (+ 2 x86 boards)
○ Mandatory for new Hardware in (at least) ARM/ARM64
○ ARM : 960 board, ARM64 : 138, powerpc : 202
■ ~1100 ARM board (partially) supported !
Device Tree: Present
● BSD*
○ FreeBSD : support for ARM, AVR32, MIPS,
PowerPC based platforms
○ Some discussions appeared for NetBSD, but they
are afraid about the “Linuxisms”...
Device Tree: Present
● U-Boot
○ Used in main U-Boot with the Linux Device Trees along
the U-Boot “Driver Model”
○ Used as Boot Image in Flattened Image Tree format to
store multiple kernels and add security
○ Supports loading Overlays before starting the kernel
● EFI
○ Can pass a Device Tree for non-ACPI ARM/ARM64
systems
Device Tree: Basics
● Will cover only basics
● You can find extended Device Tree informations in the following :
○ “Engaging Device Trees” Geert Uytterhoeven
○ “Device Tree for Dummies” Thomas Petazzoni
○ “Contemporary Device Tree” Matt Porter
○ “Device Tree The Disaster so Far” Mark Rutland
○ NXP AN5125 “Introduction to Device Trees”
○ https://www.devicetree.org/specifications/
○ Power.org™ Standard for Embedded Power Architecture™
Platform Requirements (ePAPR)
Device Tree: Source Format
● You will find up to 820000+ lines of Device Tree source in current Linux
Master
● “Device Tree Compiler” aka DTC can “compile” the source format into :
○ Source Format
○ Device Tree Blob : What will be used by U-Boot/Linux
○ Blob in Assembly
● DTC can also read any of these
binary formats to source format
System-On-Chip Architecture
Device Tree: System Representation
/
memory
cpu
soc
Bank0
CPU1
CPU0
bus1
bus0
Ethernet
GPU
Adapters
PCI Bus
/
memory
Bank0
cpu
CPU0
CPU1
soc
bus0
Ethernet
Adapters
bus1
GPU
PCI Bus
Flattened Device Tree
Device Tree: Tools
● DTC
○ Official Compiler
○ Maintained by David Gibson & Jon Loeliger
● PyFDT : https://github.com/superna9999/pyfdt
○ My Python implementation of Device Tree data structure
○ Loads Binary Blobs into native object model
○ Can produce Source, Blobs and experimental Json format
● Other ?
○ Zephyr has a custom Python based Source Interpreter
Device Tree: Source Format
● Nodes
○ Groupings of properties and child nodes
● Properties
○ Key-Value Pairs
■ Text strings “my string”
■ Cells (32-bit) <0xdeadbeef 11 0xf00d>
■ Binary data [0x01 0x02 0x03 0x04]
■ mixed data, concatenate with a comma
● “my string”, <0xdeadbeef>, [0x04], “your string”
● Phandles
○ Reference to another node
Device Tree: Source Format
/ {
node1@0 {
a-cell-property = <1 2 3 4>;
a-string-list-property = "first string", "second string";
a-byte-data-property = [0x01 0x23 0x34 0x56];
child-node1@0 {
first-child-property;
second-child-property = <1>;
third-child-property = <&node2 12 235>;
a-string-property = "Hello, world";
};
node2: child-node2@1 {
};
};
};
Phandle with
parameters
each number (cell) is a uint32
Device Tree: System Representation
soc-family.dtsi
soc-variant.dtsi
board-family.dtsi
board.dts
board.dts
#include
#include
#include
dtc -O dtb
Device Tree: System Representation
meson-gx.dtsi meson-gxl.dtsi
meson-gx-p23x-q20x.dtsi
meson-gxl-s905d-p230.dts
meson-gxl-s905d-p230.dtb
#include
#include
#include
dtc -O dtb
meson-gxl-s905d.dtsi
#include
meson-gxl-mali.dtsi
#include
Device Tree : Work Flow
Now, GCC
is used to
pre-process
the DTS
Source, to
include
shared C
headers
Device Tree: Future
Where and how will it be used ?
Device Tree: Future
● Overlays (even if it was already been partially mainlined)
○ Overlays permits dynamically changing the Device
Tree on a running system
○ Is used a lot on Single Board Computers
○ Very handy to support HATs or Daughter Boards
○ Plumbing is already in the kernel for years
○ But still in discussion about how to handle
maintenance of these overlays fragments.
Device Tree: Future
● Overlays
○ You can specify which node you which to change
○ You can specify multiple changes : fragments
○ Syntax Example :
fragment@0 {
target = <&node0>;
__overlay__ {
subnode1: subnode {
my-attribute = “abcd”;
};
};
};
};
Device Tree: Future
● Overlays
○ Not yet totally formalized
○ Official DTC compiler does not support this
● U-Boot Device Tree support in SPL
○ SPL (Secondary Program Loader) is memory constraint
○ Possible techniques:
■ “grep” the device tree to only keep the needed nodes
■ Generate C headers from Device Tree blobs
○ Still in discussion
Device Tree: Future
● Ongoing porting into Zephyr RTOS
○ The DeviceTree is not used at runtime, but used to
generate some compile time defines used by:
■ the build system (CMake)
■ the config system (Kconfig)
○ This gives more flexibility over C header files or Kconfig
config files
○ Can leverage the concept of Overlays
○ Shares the same memory constraint as U-Boot SPL
Device Tree: Future
● Some discussion about using YAML
○ YAML Usage :
■ As a replacement/complement source file format
■ As an intermediate format
○ YAML is simpler to parse, ne need to write a new parser
frontend
○ Today’s Device Tree Compile is in C and we need a
compatible compiler in a more portable language
○ using YAML could be a solution
Device Tree: Future
● Some discussion about Bindings
○ How to maintain, sync with between projects ?
■ "Foreign Bindings" - Maxime Ripard
○ How to reduce multiplication of similar bindings
■ "DT Generic Bindings" - Geert Uytterhoeven
○ How to avoid duplicating Device Tree nodes
■ "Duplicate Data" - Thomas Petazzoni
If you want more infos : https://elinux.org/Device_tree_future
Device Tree: Future
● And why not use it to store classic data ?
○ U-Boot leverage the binary format to store boot binary
data, why not classic files ?
○ I started a side project to actually use it to store files as a
read-only filesystem : dtfs
■ https://github.com/superna9999/dtfs
○ Leverages my Python Device Tree manipulation library to
pack the files into a binary blob.
■ https://github.com/superna9999/pyfdt
○ TODO: actual linux block driver
Thank you !
Any questions ?

Weitere ähnliche Inhalte

Was ist angesagt?

LAS16-500: The Rise and Fall of Assembler and the VGIC from Hell
LAS16-500: The Rise and Fall of Assembler and the VGIC from HellLAS16-500: The Rise and Fall of Assembler and the VGIC from Hell
LAS16-500: The Rise and Fall of Assembler and the VGIC from Hell
Linaro
 
LAS16-400K2: TianoCore – Open Source UEFI Community Update
LAS16-400K2: TianoCore – Open Source UEFI Community UpdateLAS16-400K2: TianoCore – Open Source UEFI Community Update
LAS16-400K2: TianoCore – Open Source UEFI Community Update
Linaro
 
TEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source securityTEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source security
Linaro
 

Was ist angesagt? (20)

Ostech war story using mainline linux for an android tv bsp
Ostech  war story  using mainline linux  for an android tv bspOstech  war story  using mainline linux  for an android tv bsp
Ostech war story using mainline linux for an android tv bsp
 
LAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome KeynoteLAS16-100K1: Welcome Keynote
LAS16-100K1: Welcome Keynote
 
LAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel AwarenessLAS16-403: GDB Linux Kernel Awareness
LAS16-403: GDB Linux Kernel Awareness
 
LAS16-TR06: Remoteproc & rpmsg development
LAS16-TR06: Remoteproc & rpmsg developmentLAS16-TR06: Remoteproc & rpmsg development
LAS16-TR06: Remoteproc & rpmsg development
 
LAS16-TR03: Upstreaming 201
LAS16-TR03: Upstreaming 201LAS16-TR03: Upstreaming 201
LAS16-TR03: Upstreaming 201
 
LAS16-500: The Rise and Fall of Assembler and the VGIC from Hell
LAS16-500: The Rise and Fall of Assembler and the VGIC from HellLAS16-500: The Rise and Fall of Assembler and the VGIC from Hell
LAS16-500: The Rise and Fall of Assembler and the VGIC from Hell
 
MOVED: RDK/WPE Port on DB410C - SFO17-206
MOVED: RDK/WPE Port on DB410C - SFO17-206MOVED: RDK/WPE Port on DB410C - SFO17-206
MOVED: RDK/WPE Port on DB410C - SFO17-206
 
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimediaEmbedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
Embedded Recipes 2019 - Pipewire a new foundation for embedded multimedia
 
LAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
LAS16-300: Mini Conference 2 Cortex-M Software - Device ConfigurationLAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
LAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
 
LAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android NLAS16-201: ART JIT in Android N
LAS16-201: ART JIT in Android N
 
Deploy STM32 family on Zephyr - SFO17-102
Deploy STM32 family on Zephyr - SFO17-102Deploy STM32 family on Zephyr - SFO17-102
Deploy STM32 family on Zephyr - SFO17-102
 
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to EmbeddedLAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
LAS16-402: ARM Trusted Firmware – from Enterprise to Embedded
 
LAS16-209: Finished and Upcoming Projects in LMG
LAS16-209: Finished and Upcoming Projects in LMGLAS16-209: Finished and Upcoming Projects in LMG
LAS16-209: Finished and Upcoming Projects in LMG
 
LAS16-400K2: TianoCore – Open Source UEFI Community Update
LAS16-400K2: TianoCore – Open Source UEFI Community UpdateLAS16-400K2: TianoCore – Open Source UEFI Community Update
LAS16-400K2: TianoCore – Open Source UEFI Community Update
 
BUD17-104: Scripting Languages in IoT: Challenges and Approaches
BUD17-104: Scripting Languages in IoT: Challenges and ApproachesBUD17-104: Scripting Languages in IoT: Challenges and Approaches
BUD17-104: Scripting Languages in IoT: Challenges and Approaches
 
BUD17-416: Benchmark and profiling in OP-TEE
BUD17-416: Benchmark and profiling in OP-TEE BUD17-416: Benchmark and profiling in OP-TEE
BUD17-416: Benchmark and profiling in OP-TEE
 
TEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source securityTEE - kernel support is now upstream. What this means for open source security
TEE - kernel support is now upstream. What this means for open source security
 
BUD17-400: Secure Data Path with OPTEE
BUD17-400: Secure Data Path with OPTEE BUD17-400: Secure Data Path with OPTEE
BUD17-400: Secure Data Path with OPTEE
 
BUD17 Socionext SC2A11 ARM Server SoC
BUD17 Socionext SC2A11 ARM Server SoCBUD17 Socionext SC2A11 ARM Server SoC
BUD17 Socionext SC2A11 ARM Server SoC
 
LAS16-106: GNU Toolchain Development Lifecycle
LAS16-106: GNU Toolchain Development LifecycleLAS16-106: GNU Toolchain Development Lifecycle
LAS16-106: GNU Toolchain Development Lifecycle
 

Ähnlich wie Linux Conference Australia 2018 : Device Tree, past, present, future

Maxwell siuc hpc_description_tutorial
Maxwell siuc hpc_description_tutorialMaxwell siuc hpc_description_tutorial
Maxwell siuc hpc_description_tutorial
madhuinturi
 
CS 3112 - First Assignment -Mark Bryan F. Ramirez/BSCS-3E
CS 3112 - First Assignment -Mark Bryan F. Ramirez/BSCS-3ECS 3112 - First Assignment -Mark Bryan F. Ramirez/BSCS-3E
CS 3112 - First Assignment -Mark Bryan F. Ramirez/BSCS-3E
Mark Bryan Ramirez
 

Ähnlich wie Linux Conference Australia 2018 : Device Tree, past, present, future (20)

Gpu computing workshop
Gpu computing workshopGpu computing workshop
Gpu computing workshop
 
Overview_Of_Intel_x86[1].pdf
Overview_Of_Intel_x86[1].pdfOverview_Of_Intel_x86[1].pdf
Overview_Of_Intel_x86[1].pdf
 
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSDLAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
LAS16-210: Hardware Assisted Tracing on ARM with CoreSight and OpenCSD
 
Lec 10-linux-review
Lec 10-linux-reviewLec 10-linux-review
Lec 10-linux-review
 
NWU and HPC
NWU and HPCNWU and HPC
NWU and HPC
 
Introduction to parallel computing using CUDA
Introduction to parallel computing using CUDAIntroduction to parallel computing using CUDA
Introduction to parallel computing using CUDA
 
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
 
Deep Learning on ARM Platforms - SFO17-509
Deep Learning on ARM Platforms - SFO17-509Deep Learning on ARM Platforms - SFO17-509
Deep Learning on ARM Platforms - SFO17-509
 
Maxwell siuc hpc_description_tutorial
Maxwell siuc hpc_description_tutorialMaxwell siuc hpc_description_tutorial
Maxwell siuc hpc_description_tutorial
 
Lab1 - Introduction to Computer Basics Laboratory.pdf
Lab1 - Introduction to Computer Basics Laboratory.pdfLab1 - Introduction to Computer Basics Laboratory.pdf
Lab1 - Introduction to Computer Basics Laboratory.pdf
 
Exascale Capabl
Exascale CapablExascale Capabl
Exascale Capabl
 
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, VectorizedData Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
Data Policies for the Kafka-API with WebAssembly | Alexander Gallego, Vectorized
 
Cuda 2011
Cuda 2011Cuda 2011
Cuda 2011
 
Clustering
ClusteringClustering
Clustering
 
Developping drivers on small machines
Developping drivers on small machinesDevelopping drivers on small machines
Developping drivers on small machines
 
BKK16-103 OpenCSD - Open for Business!
BKK16-103 OpenCSD - Open for Business!BKK16-103 OpenCSD - Open for Business!
BKK16-103 OpenCSD - Open for Business!
 
Processors
ProcessorsProcessors
Processors
 
Gpu and The Brick Wall
Gpu and The Brick WallGpu and The Brick Wall
Gpu and The Brick Wall
 
CS 3112 - First Assignment -Mark Bryan F. Ramirez/BSCS-3E
CS 3112 - First Assignment -Mark Bryan F. Ramirez/BSCS-3ECS 3112 - First Assignment -Mark Bryan F. Ramirez/BSCS-3E
CS 3112 - First Assignment -Mark Bryan F. Ramirez/BSCS-3E
 
CS 3112
CS 3112CS 3112
CS 3112
 

Mehr von Neil Armstrong

Mehr von Neil Armstrong (7)

Linux Conf Australia 2018 - Kernel Miniconf - Mainline Linux on Amlogic SoCs
Linux Conf Australia 2018 - Kernel Miniconf - Mainline Linux on Amlogic SoCsLinux Conf Australia 2018 - Kernel Miniconf - Mainline Linux on Amlogic SoCs
Linux Conf Australia 2018 - Kernel Miniconf - Mainline Linux on Amlogic SoCs
 
Embedded Recipes 2017 - Mainline Linux on Amlogic SoCs
Embedded Recipes 2017 - Mainline Linux on Amlogic SoCsEmbedded Recipes 2017 - Mainline Linux on Amlogic SoCs
Embedded Recipes 2017 - Mainline Linux on Amlogic SoCs
 
ELC North America 2017- Mainline Linux on Amlogic SoCs
ELC North America 2017- Mainline Linux on Amlogic SoCsELC North America 2017- Mainline Linux on Amlogic SoCs
ELC North America 2017- Mainline Linux on Amlogic SoCs
 
Fête de l'internet d'Antibes 2011 - Recherche sur Internet
Fête de l'internet d'Antibes 2011 - Recherche sur InternetFête de l'internet d'Antibes 2011 - Recherche sur Internet
Fête de l'internet d'Antibes 2011 - Recherche sur Internet
 
Fete internet antibes 2011 - Recherche sur Internet
Fete internet antibes 2011 - Recherche sur InternetFete internet antibes 2011 - Recherche sur Internet
Fete internet antibes 2011 - Recherche sur Internet
 
IPv6, un second souffle pour l’internet
 IPv6, un second souffle pour l’internet IPv6, un second souffle pour l’internet
IPv6, un second souffle pour l’internet
 
Intellicore Tech Talk 10 - Apache Web Server Internals
Intellicore Tech Talk 10 - Apache Web Server InternalsIntellicore Tech Talk 10 - Apache Web Server Internals
Intellicore Tech Talk 10 - Apache Web Server Internals
 

Kürzlich hochgeladen

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Kürzlich hochgeladen (20)

HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

Linux Conference Australia 2018 : Device Tree, past, present, future

  • 1.
  • 2. Device Tree: Past Where does it comes from ?
  • 3. Device Tree: Past Software Engineers always struggled to describe in a simple and portable way the different hardwares. ● In code ? ● In binary format ? ● In text format ? ● Auto generated ?
  • 5. Classic System Architecture ● All the components are interconnected on the board ● High complexity of the board electronics But : ● Easy to repair and adapt to the various needs ● Easy to design
  • 6. Classic x86 System Architecture
  • 7. Classic x86 System Architecture ● Partial integration by : ○ moving all the memory control in the north bridge ○ moving all the peripherals in the south bridge ● Both bridges can be changed easily
  • 9. Device Tree : Past ● Multiple different solutions were found : ○ ACPI table in the x86 world ○ Device Tree in the SPARC/PowerPC world ● Both solutions describes the hardware in a generic way that can be parsed and understood by the Operating System ● ACPI was designed to be very Intel/Microsoft specific, even if it was used on various architectures with Windows NT
  • 10. Device Tree : Past ● ACPI is a very obscure hardware description, aimed to keep a tight control on the PCs architecture ● Device Tree was designed to be written/understood by humans then processed to be understood by software
  • 11. Device Tree : Specifications ● IEEE-1275 formalized specification (1994) ○ The set of devices attached to the system, including permanently installed devices and plug-in devices, is described by an Open Firmware data structure known as the device tree. The operating system may inspect the device tree to determine the hardware configuration of the system. Each device in the device tree is described by a property list. The set of properties describing a device is arbitrarily extensible so that any type of device and any kind of information that needs to be reported about the device can be accommodated.
  • 12. Device Tree : Specifications ● PowerPC™ Common Hardware Reference Platform (CHRP) specifies DT (1995) ○ Developed by Apple, IBM and Motorola ○ Extends IEEE-1275 to PowerPC™ ● ePAPR specifies DT (2008) ○ Stands for Power.org™ Standard for Embedded Power Architecture™ Platform Requirements ○ “The ePAPR is loosely related to the IEEE 1275” ○ “Because of the nature of embedded systems, some of these problems faced by open, general purpose computers do not apply”
  • 13. Device Tree : History Multiple implementation existed with different formats but the same goal : ● Sun Microsystems - Open Boot / Open Firmware (1988) ○ Used in SPARC systems ○ Uses Device Tree to describe hardware ● Apple adopts Open Firmware on Power Mac 7200 (1995) using DT along IBM ○ Uses Open Firmware and DT until Macs switched to Intel CPUs ○ Still uses a DT form in iPhone/iPad/iPod ARM Based devices ○ PCI devices represented in DT, generated by firmware
  • 14. Device Tree : History ● 2005 : Linux PowerPC support starts switching to Device tree ● 2006 : First device tree in Linux codebase “mpc8641_hpcn.dts” ● 2007 : ○ Initial Sony PS3 support with basic DTS ○ Common Device Tree implementation for Sparc and PowerPC in “drivers/of” ● 2009 : microblaze switched to Device Tree ● 2011 : ARM switched to Device Tree ● 2014 : Device Tree used by 12 over 28 architecture
  • 15. Device Tree: Present How and where is it used ?
  • 16. Device Tree : Specifications http://devicetree.org ● A new initiative appeared to facilitate the future evolution of the Device Tree Standard. ○ Sponsored by ARM, IBM, Linaro and NXP ○ Continuation of the ePAPR specifications ○ Adapted to current and future hardware ● v0.2 has been tagged on 20th December 2017 ● Community Work is done around a github and a mailing-list like a classic Open-Source project
  • 17. Device Tree: Present ● Linux ○ Supported in 14 architectures : arc, arm, arm64, c6x, cris, h8300, metag, microblaze, mips, nios2, openrisc, powerpc, sh, xtensa (+ 2 x86 boards) ○ Mandatory for new Hardware in (at least) ARM/ARM64 ○ ARM : 960 board, ARM64 : 138, powerpc : 202 ■ ~1100 ARM board (partially) supported !
  • 18. Device Tree: Present ● BSD* ○ FreeBSD : support for ARM, AVR32, MIPS, PowerPC based platforms ○ Some discussions appeared for NetBSD, but they are afraid about the “Linuxisms”...
  • 19. Device Tree: Present ● U-Boot ○ Used in main U-Boot with the Linux Device Trees along the U-Boot “Driver Model” ○ Used as Boot Image in Flattened Image Tree format to store multiple kernels and add security ○ Supports loading Overlays before starting the kernel ● EFI ○ Can pass a Device Tree for non-ACPI ARM/ARM64 systems
  • 20. Device Tree: Basics ● Will cover only basics ● You can find extended Device Tree informations in the following : ○ “Engaging Device Trees” Geert Uytterhoeven ○ “Device Tree for Dummies” Thomas Petazzoni ○ “Contemporary Device Tree” Matt Porter ○ “Device Tree The Disaster so Far” Mark Rutland ○ NXP AN5125 “Introduction to Device Trees” ○ https://www.devicetree.org/specifications/ ○ Power.org™ Standard for Embedded Power Architecture™ Platform Requirements (ePAPR)
  • 21. Device Tree: Source Format ● You will find up to 820000+ lines of Device Tree source in current Linux Master ● “Device Tree Compiler” aka DTC can “compile” the source format into : ○ Source Format ○ Device Tree Blob : What will be used by U-Boot/Linux ○ Blob in Assembly ● DTC can also read any of these binary formats to source format
  • 23. Device Tree: System Representation / memory cpu soc Bank0 CPU1 CPU0 bus1 bus0 Ethernet GPU Adapters PCI Bus / memory Bank0 cpu CPU0 CPU1 soc bus0 Ethernet Adapters bus1 GPU PCI Bus Flattened Device Tree
  • 24. Device Tree: Tools ● DTC ○ Official Compiler ○ Maintained by David Gibson & Jon Loeliger ● PyFDT : https://github.com/superna9999/pyfdt ○ My Python implementation of Device Tree data structure ○ Loads Binary Blobs into native object model ○ Can produce Source, Blobs and experimental Json format ● Other ? ○ Zephyr has a custom Python based Source Interpreter
  • 25. Device Tree: Source Format ● Nodes ○ Groupings of properties and child nodes ● Properties ○ Key-Value Pairs ■ Text strings “my string” ■ Cells (32-bit) <0xdeadbeef 11 0xf00d> ■ Binary data [0x01 0x02 0x03 0x04] ■ mixed data, concatenate with a comma ● “my string”, <0xdeadbeef>, [0x04], “your string” ● Phandles ○ Reference to another node
  • 26. Device Tree: Source Format / { node1@0 { a-cell-property = <1 2 3 4>; a-string-list-property = "first string", "second string"; a-byte-data-property = [0x01 0x23 0x34 0x56]; child-node1@0 { first-child-property; second-child-property = <1>; third-child-property = <&node2 12 235>; a-string-property = "Hello, world"; }; node2: child-node2@1 { }; }; }; Phandle with parameters each number (cell) is a uint32
  • 27. Device Tree: System Representation soc-family.dtsi soc-variant.dtsi board-family.dtsi board.dts board.dts #include #include #include dtc -O dtb
  • 28. Device Tree: System Representation meson-gx.dtsi meson-gxl.dtsi meson-gx-p23x-q20x.dtsi meson-gxl-s905d-p230.dts meson-gxl-s905d-p230.dtb #include #include #include dtc -O dtb meson-gxl-s905d.dtsi #include meson-gxl-mali.dtsi #include
  • 29. Device Tree : Work Flow Now, GCC is used to pre-process the DTS Source, to include shared C headers
  • 30. Device Tree: Future Where and how will it be used ?
  • 31. Device Tree: Future ● Overlays (even if it was already been partially mainlined) ○ Overlays permits dynamically changing the Device Tree on a running system ○ Is used a lot on Single Board Computers ○ Very handy to support HATs or Daughter Boards ○ Plumbing is already in the kernel for years ○ But still in discussion about how to handle maintenance of these overlays fragments.
  • 32. Device Tree: Future ● Overlays ○ You can specify which node you which to change ○ You can specify multiple changes : fragments ○ Syntax Example : fragment@0 { target = <&node0>; __overlay__ { subnode1: subnode { my-attribute = “abcd”; }; }; }; };
  • 33. Device Tree: Future ● Overlays ○ Not yet totally formalized ○ Official DTC compiler does not support this ● U-Boot Device Tree support in SPL ○ SPL (Secondary Program Loader) is memory constraint ○ Possible techniques: ■ “grep” the device tree to only keep the needed nodes ■ Generate C headers from Device Tree blobs ○ Still in discussion
  • 34. Device Tree: Future ● Ongoing porting into Zephyr RTOS ○ The DeviceTree is not used at runtime, but used to generate some compile time defines used by: ■ the build system (CMake) ■ the config system (Kconfig) ○ This gives more flexibility over C header files or Kconfig config files ○ Can leverage the concept of Overlays ○ Shares the same memory constraint as U-Boot SPL
  • 35. Device Tree: Future ● Some discussion about using YAML ○ YAML Usage : ■ As a replacement/complement source file format ■ As an intermediate format ○ YAML is simpler to parse, ne need to write a new parser frontend ○ Today’s Device Tree Compile is in C and we need a compatible compiler in a more portable language ○ using YAML could be a solution
  • 36. Device Tree: Future ● Some discussion about Bindings ○ How to maintain, sync with between projects ? ■ "Foreign Bindings" - Maxime Ripard ○ How to reduce multiplication of similar bindings ■ "DT Generic Bindings" - Geert Uytterhoeven ○ How to avoid duplicating Device Tree nodes ■ "Duplicate Data" - Thomas Petazzoni If you want more infos : https://elinux.org/Device_tree_future
  • 37. Device Tree: Future ● And why not use it to store classic data ? ○ U-Boot leverage the binary format to store boot binary data, why not classic files ? ○ I started a side project to actually use it to store files as a read-only filesystem : dtfs ■ https://github.com/superna9999/dtfs ○ Leverages my Python Device Tree manipulation library to pack the files into a binary blob. ■ https://github.com/superna9999/pyfdt ○ TODO: actual linux block driver
  • 38. Thank you ! Any questions ?