Device Tree: Past, Present, and Future

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good morning everybody welcome to our first breakout session of the day my name is Christopher Bix I will be the session chair here this morning I'm the convener of the Brisbane Internet of Things meetup group so the topic this morning is of great interest to me I'd like to begin by acknowledging the traditional custodians of the land on which we meet and paying my respects to elder's past and present this morning we have Neil Armstrong who has been a Linux engineer since 2008 and as it done a great deal of work towards porting and maintaining Linux on arm and various FPGAs and this morning he'll be talking about the device tree component within the the Linux on a subsystem so please join me in welcoming Neil thank you for attending some basic will be towards the history of the best tree for the past present and future and three parts I'm working for the French engineering company called beliebe we are specialized in every open source components in embedded systems the linux rtos and so on doesn't work so first of all diverse tree what does income what is the ratio to is tree it's a long story because it always been an issue for engineers to find a way to describe the odd where the different aware and different variants of hardware for a software purpose so you can use code you can use properly by in binary format you can use properly text formats you can use auto-generated format from very dog or VHDL for example so there's plenty of manner to do but you somehow need to be trying to genique way in a bottler way for the future for job proof software support so let's start with a classic system architecture to see what we need to describe from the diversity perspective so it's a highly simplified after point of view you have a CPU which executes some instruction which will be we'll do some memory fetches on the bus and historically you are the common bus to access to the one so a memory behind the memory controller and all the BIOS paper's like attend at airports adapters and enter first extensions like PCI PCI Express a ex4 graphics for example so I won't speak about poor and cons of architectures you are for example the Intel classic architecture with North Way Southbridge like you see it's similar you still have a bus you still have a memory bus you still have you need to access food is bus to access the memory and all the peripherals like a more modern way of doing Hardware today which groups everything a form of example in the controller and move all the memory in the main CPU but it's still multiple buses going from the CPU to access memory worms and all the peripherals so it doesn't change a lot even if it's organized definitely between the chips on the board so multiple solutions were found in the past so you add a CPI tables for the older Intel world and you had a nervous Aleutian we've opened firmware in the spark and Power PC world so both solutions had the same goal to describe the hardware in the genic Indian Technic way that can be passed and interpreted by earth software Janique software to be able to have a generic implementation for multiple boards so why a CPI which is an ID but designed by Microsoft Intel for BIOS abstraction Windows NT for example it was really really used to tight control on the PC world which is an open world which is quite a strange and on the other side the vestry was used to with within and by engineers for more open hardware and more open platforms out of the PC world so let's start to dig in to the specifications so the first based applications of something called device tree was in the i3 e12 6005 specification in 1994 so they describe device tree it's a set to describe a set of device attached a tree system with a data structure known as a device tree and it's a set of devices in property lists and notes so it is a basis of the vestry and it was formally specified in 1994 and later one hour later the powers purpose equipment machine reference platform specified eg for the PowerPC platform so it was developed by Apple IBM and Motorola for the platforms at the time it was a extension of the i3 specification for PowerPC later on in 2008 you had poor or standard for embedded power of structure but from requirements which specified the vestry in a more formal way and this was the bay specification used for Linux for example to start the support of the vestry so it's clearly specified in the specification so it's loosely what I tend to so if we specification because you cannot because the nature of embedded systems is too complex to use very generic description like it was described in the if we specification so this is why there is a lot of violence that need to be specified so you had multiple implementations of these specifications so you have the famous open of my specification that was implement end of went Sun on spark systems and use the best way to describe Hardware to under hardware then i pair adopted up in fear my arms on the max in 1995 and they dropped joyce three four acp table when they switch to the intel cpus but they still use the rest reform on all the iPhones and i devices which which are winnings i own arm biased associates on the old Macs the PC devices were generated by device firmware so as it still the case of today how to describe the hot pluggable devices like PCI PCI Express and USB so you can do it and I think a part of the same at semi shoo-in I change five actually so a brief history of device three support in operating systems Linux so in 2005 you had the first support code for PowerPC in 2006 you have the first diversified into the codebase and for example in 2007 you have initial ps3 support Sony pathogen-free support really really basic only one node and you started to have a common the best implementation in drivers Oh F which is still used today and you had multiple switches to the best three like open macro blazons and arm or the arm Bob started to twitch in 2011 it was a long discussion because at the time everything but described in C it was very hard to maintain and it was a hard decision to switch to device tree and in 2014 it was used with by 1212 a structure which is Packard what a lot so today how it's used in the way I used for the start today we have a new specification which based on the power power of specification which lead by arm Lenovo in in XP and IBM which goal is travel external specifically not tied to a platform and then Cal said that it managed like an opposite project and it's adapted to current in future hardware so they take in account all the specific specificities bumpo sample of the arm platforms and there's a 0.2 Russian was tagged in a heartful septum half of the sample and the desire a community work so you have maillist you have statuses and a full github community beyond days of it's good to have more understanding of how the best tree today is specified so today in the 4th at 15 which is not tagged tagged maybe on hopefully in Sunday you spotted and 14 architecture so the classical arm I'm 64 PowerPC and to Intel boss it is funny so it's manna to eat for from new boss on majority of our structure for example army I'm 64 how much board we support today and arm you have nearly 1000 boards and 64 is gaining more support because there's less boards on the market overall we have nearly 1100 on Bob's supported partially supported in the canal which is quite a lot and I didn't put the graph but the number of supported board was expansional when they switch to to the vestry or the arm world because it is much simpler and you can describe described more valiant more easily so for the bsd world you have the FreeBSD hood which support the West 3 and they take all the bindings and Linux and the vestry files so they don't have a lot of issues taking stuff for MINIX because usually the the West refers are divided like I sensed not only GPR so you can listen on a non GPL project but net BSD have a lot of issues about the Linux ISM of today's device tree files because a lot of structure and a lot of naming in the properties was we can't avoid it but say I tied to how Linux is designed you boot supports the rs3 it's it's a core component because they switch to the driver model few years ago which is a trimmed-down version of the other of the UNIX driver model which can use the best way to actually load the devices so you don't need to write all the peripherals in scene anymore and like Linux it's done dynamically so it's really good and the leverage or the binary feature of the device tree to store the boot image though it's the name is fit image didn't put the name and they can put multiple multiple configuration for boot files in a single fit image so you can ship a single boot image they can put on multiple boards and you have kernel and the vestry as stated you can sign it so you can ever new secure boot with fit image so it's a great great feature for your boot and photo overlays report you can apply the overlay before were dynamics because over this report engine exists in discussion so it's easier to put you to apply the overlay on the device tree in your boot so in Linux you already have overlay directly applied and nothing to do for the unstick arm 64 board for example which are supported by the FAA specification it's specified how to pass a diverse tree for example and you would support basic EFI for arm 64 and arm and it can use device 3 so it pretty cool so I will only cover the basics of java 3 I want extend Massif you can have a very good support on all these representations there is a good one from Tunis potato mash potato knee for example if you want a formal description you can look at the NXP document and the vestry specification for example and it's interesting to lutulu to look at the power or requirements to have a more discerning of white comes one so it's not if you want more example you can have like 800 thousand lines of the waste streams Linux master so you can really find everything once so it's the best we use the JavaScript compiler so named dtc to compare compiled deserves a device reader so there's no the fact of compiling the device tree there's it's not comparable to GCC for example did you see only on the converse a source file into a bi file and for example can put it in an assembly file for example but everything can be reversed so you can take a binary file and output a source file for example so it's only a conversion of the format so let's talk about a modern way to describe the hardware so this is SOC so like over a flexure it's still very similar because in the Association you still have a common bus for example connected to all the peripherals so sometime you have variants with the memory dirty country to say for example I have the one but still is this the same stuff you're still a local members you still have different accessible bye-bye bus you still have the same adapters to talk to I square C and SPI devices does this to assist why the best trees is still accurate because it's it answer to the same issues we had in 1995 94 so there is a concept of the flattened device tree because the George advice tree can be is passed and interpreted in a flattened way so for example ha which is house it's taught in a binary way so you have this node described in a source file which is a structure is similar to CSC source file and you have you can have described in hardware in a binary form a blob form in this way so you you have simply the tree is simply passed and this kind and I put it in a form in a simple manner so I already already told about the DTC so official compiler maintained by David Kim Sunim John a lowly girl I made the paper on the vestry interpreter which the primary goal which was to load the binary blobs and low and have an achieve object model in Python to add some properties absinthe and Mirage you can even browse multiple blobs in one blobs to an output a new blob and I can produce source but interpreting source is more complex because you need to write a front-end which is not the goal of my - library Sofia which is a new RTOS baked pattern in each foundation has a custom - based sauce proposal for example but someday I will maybe use it to make a front-end to my Python library but I don't have time now so let's talk about source format so how it's described you have some nodes which which are leaf leaves of the tree and you have in each node you can have some properties so properties are only key value pairs you have become some texture strings some cells and 32-bit cells some binary data and you can even mix the different type of value so you can have a string and 32-bit and some binary and so on you have a concept of a pea under so it's like it's like a pointer so you can refer wafer with another node from a property so it's pretty handy to describe how actually the nodes are connected so for example or interrupt and GPIO stuff you can tell all this pin this pin from this particular GPO controller is connected to this paper all with some arguments so you can say this pin as these flags for the problem it takes only Lavelle Lavelle values it's active low and so on this is a description of xored of the source file and the format so you have the here you have a main node this is the main node at the top you have the first sub node and to subset nodes it's described or the possible properties with numbers strings by data the second four node I know as a property without any values and you here you have a piano with parameters so it refers to another node with two parameters for example and this can be interpreted in software to say oh yeah it's know to weave these parameters this is really handy the way it's use you can have pink includes so you can describe the whole SOC family within the vestry so you can have a SOC family you have an associate about family and you can produce aboard the vestry by including of these orgies this is for example an implementation which I did for the energy SOC like my previous tutorial Monday to describe the family and the bot variant so you have the family of the associate you have a variant of the SOC you have for example a notice that it's only on the diode and a specific package of the SOC and you have a family of boards and by including all these you can have a description of a particular board for example this is really used today in a Linux channel for huge Association is from the four examples of with Scalia mixes have used that a lot so what is the workflow to produce a binary blob used by Linux for example so you start from the DTS source file originally you only use DTC to compute to compile it but today GCC is used as a pastor as a program processor because now in Linux you can use shared include files between the source code ends of the vestry to have some defense somewhat macros to simplify the vestry because having bare numbers or numbers what really unreadable so now you have some macros to specify for example numbers to describe the GPIO numbers entered numbers in a more simplified way then you produce the data the binary data though it's called dtb for the best free binary and you give it to the boot order that passes to the channel for sample and in the step the boot loader can also change the device three blob you would usually changed it by adding the MAC address for example adding the memory size and you can add anything you want in the u-boot command command list for example and for example your overall s can be applied between the bottle what others I can add to simplify the usage so what is the future of device tree because there's still a lot of ongoing discussions about the future so one discussion big discussion is a overlays report overlay permits permits to change the device tree dynamically on a running system for example as a main usage if also it is for the single board computers like raspberry pi what we'll see - where you have a header the header with multiple pins are connected directly to SOC but each pin has a different can have multiple functions so you can plug a square CSPI camera and a lot of stuff and you can plug some board on top which has different features different SQL see devices connected behind so the overlays per me to load for the important dynamically some ice quasi devices and some pin control functions dynamically and apply them and you can even we were back and we went with them and go to the and actually unplug and plug out plug at the plug board hat so it works but only the generic management was streamed into a Linux and there is no generic way to load load or Davari there is some very boss specific about every manager like for the big urban black was a well may apply that are upstream but not adapted to a generic board for example for a membership board we don't have any specification on the Hat we only want to simply loaded very and at a plate and there is nothing today streamed there is a old patch set that is somehow maintained by different guys on new canards but it's not easy to actually leverage over a support for some new board computers using midnight so still in the description and i think we are far for funding an actual solution home it's a pity so this is a description of how you whiten over r-e so you only need to specify where you want to add or add something personal on the previous slide where the node 0 so you only say ok I wonder 0 and I want to add the zip system node in na 0 and the old plumbing and a very spontaneous will actually add the node and we pass this node to for sample to taken account modification and instantiate a new device for sample so it's handy to to add support for new hardware dynamically and the diversity computer or the main 9:1 does not support the Ovilus report it only supported in some fox which are distributed for example by possibly Cuban black for example and what they apply sorry yeah but still still description isn't that William maintained over discussion was not really formalized our discussions by the West we about using about you boot because you know your boot is you boot there is the main you boot binary that one's on the DDR and for a lot of associate you need to s pls second type for mom loader which is a tiny good which is used to load your boot so you generate the same the two binaries from the same code base and where you have the menu boots only using the West Street u dot all the other drivers you still need to have a classic C code to initialize all the SPL drivers which is done because you need still have the C code back-end so there is in description multiple techniques to actually use studios with the West we in SPL because you today you can have very huge the West three sides multiple hundreds of kilobytes which is higher than SPI record size so some decent techniques can be to grab the device tree to only take the note we want to use into a spear so you can achieve like one kilobyte with mastery or generate C headers like Sofia uses two generic a static C opera presentation of the device tree so this is still in discussion is not a per team at all this is also done on the DEF here at us so the Sofia TRS is aimed for the cortex-m and equivalent CPUs even it Assoc possum interviews see see since is the RTOS you need you can't have a wonderful kilobytes the vestry and dynamic passing your device we at one time because you can target some context ngos we were like eight kilobytes of memory which is very small so they use they use the same technique as where you disappear so it's in actual development you can you describe also add where in in the device tree and I have a picture Python code to actually generate some compute time defines some headers and structures to actually make it static at Build time and also use this device tree defines for the before the base system see make and K config which is quite powerful and with this they can leverage the concept of overlays even static they can describe some board with some attached hats from diodes with overlays which will be done at Build time and not at one time but still is the same goal into the vestry it's to describe describes our hardware engineer fashion and not depend on the on the on the C code and a different C code but for example is F here we try to use the same buildings at Linux example even if we do it will be quite cutter hard to support were them but it's a goal there is some discussion about describing the best way in general which is a a more simple more simple to pass description the ML is a variant is a diode of GGN in a more simple way so it's there is more there is a lot of member passers in a lot of languages so ever you will find maybe one time some device tree entirely written in Yammer or maybe use it an intermediate format before before the binary format so why not still in discussion other discussions that has been discussed as in plug-in October last year there were discussion about in the dividends tree workshop in Park about multiple subject turning around the vast diversity pot for example how to maintain the buildings between multiple projects between freebsd linux safe here and you boot for example how to have generic bending specific of today you have tons of buildings that's also buildings describes the way you should white so node for a pair for example and you have nearly the same meanings for tons of papers because most of papers only use one edged map one interrupt one wizard control and it's really the same so the discussion but with writing some generic bindings that could be used across a lot of papers very similar in the ways are used by the cpu another question was about duplicating the vestry nodes because in some when you implement them cameras report or some display support you can you can you have a huge nodes and when you have two or three main same components we have two three same times the same huge nodes for nothing because I only changed by maybe one entire number and one was just to address so the description about maybe me doing some generic diversity nodes that can only be changed by a parameter for sample but you cannot you can find more information about on a linux talk the best future wiki page which as summary of all the discussions that were in park so I personally had an idea because today you would can use a binary format to store some good fight for sample and why not directly store files as a fair system for example as static with any file systems so for example I used my pi FD T to actually write the code to white a file system in the registry and it took me like half an hour to do because generating a blob is easy so the hard point will be to actually do the Linux driver which is a another story but still you have plenty of libraries to pass the bass strings in c so it won't be really hard to do actually so it's on my to-do list one day it is if worth questions we are started still have 10 minutes left until the next session please wait for the mark if you have a question thanks for your talk um what's the holdup on getting device tree overlays upstream can you what's the holdup in getting device tree overlays upstream you wanna talk about it now doctor I do highly political subject so I'd like I work on bmc's and I'd like to use it to hot plug in the the parts of the system that only appear when the host process is running and I went down all the steps to use it and I'm like ah it's not upstream that's really unfortunate I'll talk afterwards thanks Dave you mentioned there are two x86 boards that use device tree do you have any of you why they're using device tree you mentioned two x86 boards that are using device tree on your slides I'm just wondering if you know why they chose to use device tree it's a well PC the one they expel when one laptop per child that user open firmware they use pen firmware to boot and some of the of the other way I only described in the West tree but you know ICP tables it's not proper device you support but only as a added support to pass a few notes now I just like to thank you for the presentation we you are the project that I was involved in used to Raspberry Pi 3 for development and then deployed on a Raspberry Pi 0 with some audio software the rasli browser doesn't have the audio circuits on there but with overlays we were able to like push audio out the PWM the single line of code so it saved us a lot of time and effort yeah yeah overlay because I had a handy feature of it it's need to be formalized actually any more questions all right please join me in thanking Neil one more time [Applause]
Info
Channel: LinuxConfAu 2018 - Sydney, Australia
Views: 2,330
Rating: 4.8222222 out of 5
Keywords: lca, lca2018, #linux.conf.au#linux#foss#opensource, NeilArmstrong
Id: PgQezmlst0w
Channel Id: undefined
Length: 37min 28sec (2248 seconds)
Published: Fri Jan 26 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.