1*cd60bc56SAndroid Build Coastguard WorkerDevice Tree Dynamic Object format internals 2*cd60bc56SAndroid Build Coastguard Worker------------------------------------------- 3*cd60bc56SAndroid Build Coastguard Worker 4*cd60bc56SAndroid Build Coastguard WorkerThe Device Tree for most platforms is a static representation of 5*cd60bc56SAndroid Build Coastguard Workerthe hardware capabilities. This is insufficient for platforms 6*cd60bc56SAndroid Build Coastguard Workerthat need to dynamically insert Device Tree fragments into the 7*cd60bc56SAndroid Build Coastguard Workerlive tree. 8*cd60bc56SAndroid Build Coastguard Worker 9*cd60bc56SAndroid Build Coastguard WorkerThis document explains the the Device Tree object format and 10*cd60bc56SAndroid Build Coastguard Workermodifications made to the Device Tree compiler, which make it possible. 11*cd60bc56SAndroid Build Coastguard Worker 12*cd60bc56SAndroid Build Coastguard Worker1. Simplified Problem Definition 13*cd60bc56SAndroid Build Coastguard Worker-------------------------------- 14*cd60bc56SAndroid Build Coastguard Worker 15*cd60bc56SAndroid Build Coastguard WorkerAssume we have a platform which boots using following simplified Device Tree. 16*cd60bc56SAndroid Build Coastguard Worker 17*cd60bc56SAndroid Build Coastguard Worker---- foo.dts ----------------------------------------------------------------- 18*cd60bc56SAndroid Build Coastguard Worker /* FOO platform */ 19*cd60bc56SAndroid Build Coastguard Worker / { 20*cd60bc56SAndroid Build Coastguard Worker compatible = "corp,foo"; 21*cd60bc56SAndroid Build Coastguard Worker 22*cd60bc56SAndroid Build Coastguard Worker /* shared resources */ 23*cd60bc56SAndroid Build Coastguard Worker res: res { 24*cd60bc56SAndroid Build Coastguard Worker }; 25*cd60bc56SAndroid Build Coastguard Worker 26*cd60bc56SAndroid Build Coastguard Worker /* On chip peripherals */ 27*cd60bc56SAndroid Build Coastguard Worker ocp: ocp { 28*cd60bc56SAndroid Build Coastguard Worker /* peripherals that are always instantiated */ 29*cd60bc56SAndroid Build Coastguard Worker peripheral1 { ... }; 30*cd60bc56SAndroid Build Coastguard Worker }; 31*cd60bc56SAndroid Build Coastguard Worker }; 32*cd60bc56SAndroid Build Coastguard Worker---- foo.dts ----------------------------------------------------------------- 33*cd60bc56SAndroid Build Coastguard Worker 34*cd60bc56SAndroid Build Coastguard WorkerWe have a number of peripherals that after probing (using some undefined method) 35*cd60bc56SAndroid Build Coastguard Workershould result in different Device Tree configuration. 36*cd60bc56SAndroid Build Coastguard Worker 37*cd60bc56SAndroid Build Coastguard WorkerWe cannot boot with this static tree because due to the configuration of the 38*cd60bc56SAndroid Build Coastguard Workerfoo platform there exist multiple conficting peripherals DT fragments. 39*cd60bc56SAndroid Build Coastguard Worker 40*cd60bc56SAndroid Build Coastguard WorkerSo for the bar peripheral we would have this: 41*cd60bc56SAndroid Build Coastguard Worker 42*cd60bc56SAndroid Build Coastguard Worker---- foo+bar.dts ------------------------------------------------------------- 43*cd60bc56SAndroid Build Coastguard Worker /* FOO platform + bar peripheral */ 44*cd60bc56SAndroid Build Coastguard Worker / { 45*cd60bc56SAndroid Build Coastguard Worker compatible = "corp,foo"; 46*cd60bc56SAndroid Build Coastguard Worker 47*cd60bc56SAndroid Build Coastguard Worker /* shared resources */ 48*cd60bc56SAndroid Build Coastguard Worker res: res { 49*cd60bc56SAndroid Build Coastguard Worker }; 50*cd60bc56SAndroid Build Coastguard Worker 51*cd60bc56SAndroid Build Coastguard Worker /* On chip peripherals */ 52*cd60bc56SAndroid Build Coastguard Worker ocp: ocp { 53*cd60bc56SAndroid Build Coastguard Worker /* peripherals that are always instantiated */ 54*cd60bc56SAndroid Build Coastguard Worker peripheral1 { ... }; 55*cd60bc56SAndroid Build Coastguard Worker 56*cd60bc56SAndroid Build Coastguard Worker /* bar peripheral */ 57*cd60bc56SAndroid Build Coastguard Worker bar { 58*cd60bc56SAndroid Build Coastguard Worker compatible = "corp,bar"; 59*cd60bc56SAndroid Build Coastguard Worker ... /* various properties and child nodes */ 60*cd60bc56SAndroid Build Coastguard Worker }; 61*cd60bc56SAndroid Build Coastguard Worker }; 62*cd60bc56SAndroid Build Coastguard Worker }; 63*cd60bc56SAndroid Build Coastguard Worker---- foo+bar.dts ------------------------------------------------------------- 64*cd60bc56SAndroid Build Coastguard Worker 65*cd60bc56SAndroid Build Coastguard WorkerWhile for the baz peripheral we would have this: 66*cd60bc56SAndroid Build Coastguard Worker 67*cd60bc56SAndroid Build Coastguard Worker---- foo+baz.dts ------------------------------------------------------------- 68*cd60bc56SAndroid Build Coastguard Worker /* FOO platform + baz peripheral */ 69*cd60bc56SAndroid Build Coastguard Worker / { 70*cd60bc56SAndroid Build Coastguard Worker compatible = "corp,foo"; 71*cd60bc56SAndroid Build Coastguard Worker 72*cd60bc56SAndroid Build Coastguard Worker /* shared resources */ 73*cd60bc56SAndroid Build Coastguard Worker res: res { 74*cd60bc56SAndroid Build Coastguard Worker /* baz resources */ 75*cd60bc56SAndroid Build Coastguard Worker baz_res: res_baz { ... }; 76*cd60bc56SAndroid Build Coastguard Worker }; 77*cd60bc56SAndroid Build Coastguard Worker 78*cd60bc56SAndroid Build Coastguard Worker /* On chip peripherals */ 79*cd60bc56SAndroid Build Coastguard Worker ocp: ocp { 80*cd60bc56SAndroid Build Coastguard Worker /* peripherals that are always instantiated */ 81*cd60bc56SAndroid Build Coastguard Worker peripheral1 { ... }; 82*cd60bc56SAndroid Build Coastguard Worker 83*cd60bc56SAndroid Build Coastguard Worker /* baz peripheral */ 84*cd60bc56SAndroid Build Coastguard Worker baz { 85*cd60bc56SAndroid Build Coastguard Worker compatible = "corp,baz"; 86*cd60bc56SAndroid Build Coastguard Worker /* reference to another point in the tree */ 87*cd60bc56SAndroid Build Coastguard Worker ref-to-res = <&baz_res>; 88*cd60bc56SAndroid Build Coastguard Worker ... /* various properties and child nodes */ 89*cd60bc56SAndroid Build Coastguard Worker }; 90*cd60bc56SAndroid Build Coastguard Worker }; 91*cd60bc56SAndroid Build Coastguard Worker }; 92*cd60bc56SAndroid Build Coastguard Worker---- foo+baz.dts ------------------------------------------------------------- 93*cd60bc56SAndroid Build Coastguard Worker 94*cd60bc56SAndroid Build Coastguard WorkerWe note that the baz case is more complicated, since the baz peripheral needs to 95*cd60bc56SAndroid Build Coastguard Workerreference another node in the DT tree. 96*cd60bc56SAndroid Build Coastguard Worker 97*cd60bc56SAndroid Build Coastguard Worker2. Device Tree Object Format Requirements 98*cd60bc56SAndroid Build Coastguard Worker----------------------------------------- 99*cd60bc56SAndroid Build Coastguard Worker 100*cd60bc56SAndroid Build Coastguard WorkerSince the Device Tree is used for booting a number of very different hardware 101*cd60bc56SAndroid Build Coastguard Workerplatforms it is imperative that we tread very carefully. 102*cd60bc56SAndroid Build Coastguard Worker 103*cd60bc56SAndroid Build Coastguard Worker2.a) No changes to the Device Tree binary format for the base tree. We cannot 104*cd60bc56SAndroid Build Coastguard Workermodify the tree format at all and all the information we require should be 105*cd60bc56SAndroid Build Coastguard Workerencoded using Device Tree itself. We can add nodes that can be safely ignored 106*cd60bc56SAndroid Build Coastguard Workerby both bootloaders and the kernel. The plugin dtbs are optionally tagged 107*cd60bc56SAndroid Build Coastguard Workerwith a different magic number in the header but otherwise they're simple 108*cd60bc56SAndroid Build Coastguard Workerblobs. 109*cd60bc56SAndroid Build Coastguard Worker 110*cd60bc56SAndroid Build Coastguard Worker2.b) Changes to the DTS source format should be absolutely minimal, and should 111*cd60bc56SAndroid Build Coastguard Workeronly be needed for the DT fragment definitions, and not the base boot DT. 112*cd60bc56SAndroid Build Coastguard Worker 113*cd60bc56SAndroid Build Coastguard Worker2.c) An explicit option should be used to instruct DTC to generate the required 114*cd60bc56SAndroid Build Coastguard Workerinformation needed for object resolution. Platforms that don't use the 115*cd60bc56SAndroid Build Coastguard Workerdynamic object format can safely ignore it. 116*cd60bc56SAndroid Build Coastguard Worker 117*cd60bc56SAndroid Build Coastguard Worker2.d) Finally, DT syntax changes should be kept to a minimum. It should be 118*cd60bc56SAndroid Build Coastguard Workerpossible to express everything using the existing DT syntax. 119*cd60bc56SAndroid Build Coastguard Worker 120*cd60bc56SAndroid Build Coastguard Worker3. Implementation 121*cd60bc56SAndroid Build Coastguard Worker----------------- 122*cd60bc56SAndroid Build Coastguard Worker 123*cd60bc56SAndroid Build Coastguard WorkerThe basic unit of addressing in Device Tree is the phandle. Turns out it's 124*cd60bc56SAndroid Build Coastguard Workerrelatively simple to extend the way phandles are generated and referenced 125*cd60bc56SAndroid Build Coastguard Workerso that it's possible to dynamically convert symbolic references (labels) 126*cd60bc56SAndroid Build Coastguard Workerto phandle values. This is a valid assumption as long as the author uses 127*cd60bc56SAndroid Build Coastguard Workerreference syntax and does not assign phandle values manually (which might 128*cd60bc56SAndroid Build Coastguard Workerbe a problem with decompiled source files). 129*cd60bc56SAndroid Build Coastguard Worker 130*cd60bc56SAndroid Build Coastguard WorkerWe can roughly divide the operation into two steps. 131*cd60bc56SAndroid Build Coastguard Worker 132*cd60bc56SAndroid Build Coastguard Worker3.a) Compilation of the base board DTS file using the '-@' option 133*cd60bc56SAndroid Build Coastguard Workergenerates a valid DT blob with an added __symbols__ node at the root node, 134*cd60bc56SAndroid Build Coastguard Workercontaining a list of all nodes that are marked with a label. 135*cd60bc56SAndroid Build Coastguard Worker 136*cd60bc56SAndroid Build Coastguard WorkerUsing the foo.dts file above the following node will be generated; 137*cd60bc56SAndroid Build Coastguard Worker 138*cd60bc56SAndroid Build Coastguard Worker$ dtc -@ -O dtb -o foo.dtb -b 0 foo.dts 139*cd60bc56SAndroid Build Coastguard Worker$ fdtdump foo.dtb 140*cd60bc56SAndroid Build Coastguard Worker... 141*cd60bc56SAndroid Build Coastguard Worker/ { 142*cd60bc56SAndroid Build Coastguard Worker ... 143*cd60bc56SAndroid Build Coastguard Worker res { 144*cd60bc56SAndroid Build Coastguard Worker ... 145*cd60bc56SAndroid Build Coastguard Worker phandle = <0x00000001>; 146*cd60bc56SAndroid Build Coastguard Worker ... 147*cd60bc56SAndroid Build Coastguard Worker }; 148*cd60bc56SAndroid Build Coastguard Worker ocp { 149*cd60bc56SAndroid Build Coastguard Worker ... 150*cd60bc56SAndroid Build Coastguard Worker phandle = <0x00000002>; 151*cd60bc56SAndroid Build Coastguard Worker ... 152*cd60bc56SAndroid Build Coastguard Worker }; 153*cd60bc56SAndroid Build Coastguard Worker __symbols__ { 154*cd60bc56SAndroid Build Coastguard Worker res="/res"; 155*cd60bc56SAndroid Build Coastguard Worker ocp="/ocp"; 156*cd60bc56SAndroid Build Coastguard Worker }; 157*cd60bc56SAndroid Build Coastguard Worker}; 158*cd60bc56SAndroid Build Coastguard Worker 159*cd60bc56SAndroid Build Coastguard WorkerNotice that all the nodes that had a label have been recorded, and that 160*cd60bc56SAndroid Build Coastguard Workerphandles have been generated for them. 161*cd60bc56SAndroid Build Coastguard Worker 162*cd60bc56SAndroid Build Coastguard WorkerThis blob can be used to boot the board normally, the __symbols__ node will 163*cd60bc56SAndroid Build Coastguard Workerbe safely ignored both by the bootloader and the kernel (the only loss will 164*cd60bc56SAndroid Build Coastguard Workerbe a few bytes of memory and disk space). 165*cd60bc56SAndroid Build Coastguard Worker 166*cd60bc56SAndroid Build Coastguard WorkerWe generate a __symbols__ node to record nodes that had labels in the base 167*cd60bc56SAndroid Build Coastguard Workertree (or subsequent loaded overlays) so that they can be matched up with 168*cd60bc56SAndroid Build Coastguard Workerreferences made to them in Device Tree objects. 169*cd60bc56SAndroid Build Coastguard Worker 170*cd60bc56SAndroid Build Coastguard Worker3.b) The Device Tree fragments must be compiled with the same option but they 171*cd60bc56SAndroid Build Coastguard Workermust also have a tag (/plugin/) that allows undefined references to nodes 172*cd60bc56SAndroid Build Coastguard Workerthat are not present at compilation time to be recorded so that the runtime 173*cd60bc56SAndroid Build Coastguard Workerloader can fix them. 174*cd60bc56SAndroid Build Coastguard Worker 175*cd60bc56SAndroid Build Coastguard WorkerSo the bar peripheral's DTS format would be of the form: 176*cd60bc56SAndroid Build Coastguard Worker 177*cd60bc56SAndroid Build Coastguard Worker/dts-v1/; 178*cd60bc56SAndroid Build Coastguard Worker/plugin/; /* allow undefined references and record them */ 179*cd60bc56SAndroid Build Coastguard Worker/ { 180*cd60bc56SAndroid Build Coastguard Worker .... /* various properties for loader use; i.e. part id etc. */ 181*cd60bc56SAndroid Build Coastguard Worker fragment@0 { 182*cd60bc56SAndroid Build Coastguard Worker target = <&ocp>; 183*cd60bc56SAndroid Build Coastguard Worker __overlay__ { 184*cd60bc56SAndroid Build Coastguard Worker /* bar peripheral */ 185*cd60bc56SAndroid Build Coastguard Worker bar { 186*cd60bc56SAndroid Build Coastguard Worker compatible = "corp,bar"; 187*cd60bc56SAndroid Build Coastguard Worker ... /* various properties and child nodes */ 188*cd60bc56SAndroid Build Coastguard Worker } 189*cd60bc56SAndroid Build Coastguard Worker }; 190*cd60bc56SAndroid Build Coastguard Worker }; 191*cd60bc56SAndroid Build Coastguard Worker}; 192*cd60bc56SAndroid Build Coastguard Worker 193*cd60bc56SAndroid Build Coastguard WorkerNote that there's a target property that specifies the location where the 194*cd60bc56SAndroid Build Coastguard Workercontents of the overlay node will be placed, and it references the node 195*cd60bc56SAndroid Build Coastguard Workerin the foo.dts file. 196*cd60bc56SAndroid Build Coastguard Worker 197*cd60bc56SAndroid Build Coastguard Worker$ dtc -@ -O dtb -o bar.dtbo -b 0 bar.dts 198*cd60bc56SAndroid Build Coastguard Worker$ fdtdump bar.dtbo 199*cd60bc56SAndroid Build Coastguard Worker... 200*cd60bc56SAndroid Build Coastguard Worker/ { 201*cd60bc56SAndroid Build Coastguard Worker ... /* properties */ 202*cd60bc56SAndroid Build Coastguard Worker fragment@0 { 203*cd60bc56SAndroid Build Coastguard Worker target = <0xffffffff>; 204*cd60bc56SAndroid Build Coastguard Worker __overlay__ { 205*cd60bc56SAndroid Build Coastguard Worker bar { 206*cd60bc56SAndroid Build Coastguard Worker compatible = "corp,bar"; 207*cd60bc56SAndroid Build Coastguard Worker ... /* various properties and child nodes */ 208*cd60bc56SAndroid Build Coastguard Worker } 209*cd60bc56SAndroid Build Coastguard Worker }; 210*cd60bc56SAndroid Build Coastguard Worker }; 211*cd60bc56SAndroid Build Coastguard Worker __fixups__ { 212*cd60bc56SAndroid Build Coastguard Worker ocp = "/fragment@0:target:0"; 213*cd60bc56SAndroid Build Coastguard Worker }; 214*cd60bc56SAndroid Build Coastguard Worker}; 215*cd60bc56SAndroid Build Coastguard Worker 216*cd60bc56SAndroid Build Coastguard WorkerNo __symbols__ node has been generated (no label in bar.dts). 217*cd60bc56SAndroid Build Coastguard WorkerNote that the target's ocp label is undefined, so the phandle 218*cd60bc56SAndroid Build Coastguard Workervalue is filled with the illegal value '0xffffffff', while a __fixups__ 219*cd60bc56SAndroid Build Coastguard Workernode has been generated, which marks the location in the tree where 220*cd60bc56SAndroid Build Coastguard Workerthe label lookup should store the runtime phandle value of the ocp node. 221*cd60bc56SAndroid Build Coastguard Worker 222*cd60bc56SAndroid Build Coastguard WorkerThe format of the __fixups__ node entry is 223*cd60bc56SAndroid Build Coastguard Worker 224*cd60bc56SAndroid Build Coastguard Worker <label> = "<local-full-path>:<property-name>:<offset>" 225*cd60bc56SAndroid Build Coastguard Worker [, "<local-full-path>:<property-name>:<offset>"...]; 226*cd60bc56SAndroid Build Coastguard Worker 227*cd60bc56SAndroid Build Coastguard Worker <label> Is the label we're referring 228*cd60bc56SAndroid Build Coastguard Worker <local-full-path> Is the full path of the node the reference is 229*cd60bc56SAndroid Build Coastguard Worker <property-name> Is the name of the property containing the 230*cd60bc56SAndroid Build Coastguard Worker reference 231*cd60bc56SAndroid Build Coastguard Worker <offset> The offset (in bytes) of where the property's 232*cd60bc56SAndroid Build Coastguard Worker phandle value is located. 233*cd60bc56SAndroid Build Coastguard Worker 234*cd60bc56SAndroid Build Coastguard WorkerDoing the same with the baz peripheral's DTS format is a little bit more 235*cd60bc56SAndroid Build Coastguard Workerinvolved, since baz contains references to local labels which require 236*cd60bc56SAndroid Build Coastguard Workerlocal fixups. 237*cd60bc56SAndroid Build Coastguard Worker 238*cd60bc56SAndroid Build Coastguard Worker/dts-v1/; 239*cd60bc56SAndroid Build Coastguard Worker/plugin/; /* allow undefined label references and record them */ 240*cd60bc56SAndroid Build Coastguard Worker/ { 241*cd60bc56SAndroid Build Coastguard Worker .... /* various properties for loader use; i.e. part id etc. */ 242*cd60bc56SAndroid Build Coastguard Worker fragment@0 { 243*cd60bc56SAndroid Build Coastguard Worker target = <&res>; 244*cd60bc56SAndroid Build Coastguard Worker __overlay__ { 245*cd60bc56SAndroid Build Coastguard Worker /* baz resources */ 246*cd60bc56SAndroid Build Coastguard Worker baz_res: res_baz { ... }; 247*cd60bc56SAndroid Build Coastguard Worker }; 248*cd60bc56SAndroid Build Coastguard Worker }; 249*cd60bc56SAndroid Build Coastguard Worker fragment@1 { 250*cd60bc56SAndroid Build Coastguard Worker target = <&ocp>; 251*cd60bc56SAndroid Build Coastguard Worker __overlay__ { 252*cd60bc56SAndroid Build Coastguard Worker /* baz peripheral */ 253*cd60bc56SAndroid Build Coastguard Worker baz { 254*cd60bc56SAndroid Build Coastguard Worker compatible = "corp,baz"; 255*cd60bc56SAndroid Build Coastguard Worker /* reference to another point in the tree */ 256*cd60bc56SAndroid Build Coastguard Worker ref-to-res = <&baz_res>; 257*cd60bc56SAndroid Build Coastguard Worker ... /* various properties and child nodes */ 258*cd60bc56SAndroid Build Coastguard Worker } 259*cd60bc56SAndroid Build Coastguard Worker }; 260*cd60bc56SAndroid Build Coastguard Worker }; 261*cd60bc56SAndroid Build Coastguard Worker}; 262*cd60bc56SAndroid Build Coastguard Worker 263*cd60bc56SAndroid Build Coastguard WorkerNote that &bar_res reference. 264*cd60bc56SAndroid Build Coastguard Worker 265*cd60bc56SAndroid Build Coastguard Worker$ dtc -@ -O dtb -o baz.dtbo -b 0 baz.dts 266*cd60bc56SAndroid Build Coastguard Worker$ fdtdump baz.dtbo 267*cd60bc56SAndroid Build Coastguard Worker... 268*cd60bc56SAndroid Build Coastguard Worker/ { 269*cd60bc56SAndroid Build Coastguard Worker ... /* properties */ 270*cd60bc56SAndroid Build Coastguard Worker fragment@0 { 271*cd60bc56SAndroid Build Coastguard Worker target = <0xffffffff>; 272*cd60bc56SAndroid Build Coastguard Worker __overlay__ { 273*cd60bc56SAndroid Build Coastguard Worker res_baz { 274*cd60bc56SAndroid Build Coastguard Worker .... 275*cd60bc56SAndroid Build Coastguard Worker phandle = <0x00000001>; 276*cd60bc56SAndroid Build Coastguard Worker }; 277*cd60bc56SAndroid Build Coastguard Worker }; 278*cd60bc56SAndroid Build Coastguard Worker }; 279*cd60bc56SAndroid Build Coastguard Worker fragment@1 { 280*cd60bc56SAndroid Build Coastguard Worker target = <0xffffffff>; 281*cd60bc56SAndroid Build Coastguard Worker __overlay__ { 282*cd60bc56SAndroid Build Coastguard Worker baz { 283*cd60bc56SAndroid Build Coastguard Worker compatible = "corp,baz"; 284*cd60bc56SAndroid Build Coastguard Worker ... /* various properties and child nodes */ 285*cd60bc56SAndroid Build Coastguard Worker ref-to-res = <0x00000001>; 286*cd60bc56SAndroid Build Coastguard Worker } 287*cd60bc56SAndroid Build Coastguard Worker }; 288*cd60bc56SAndroid Build Coastguard Worker }; 289*cd60bc56SAndroid Build Coastguard Worker __fixups__ { 290*cd60bc56SAndroid Build Coastguard Worker res = "/fragment@0:target:0"; 291*cd60bc56SAndroid Build Coastguard Worker ocp = "/fragment@1:target:0"; 292*cd60bc56SAndroid Build Coastguard Worker }; 293*cd60bc56SAndroid Build Coastguard Worker __local_fixups__ { 294*cd60bc56SAndroid Build Coastguard Worker fragment@1 { 295*cd60bc56SAndroid Build Coastguard Worker __overlay__ { 296*cd60bc56SAndroid Build Coastguard Worker baz { 297*cd60bc56SAndroid Build Coastguard Worker ref-to-res = <0>; 298*cd60bc56SAndroid Build Coastguard Worker }; 299*cd60bc56SAndroid Build Coastguard Worker }; 300*cd60bc56SAndroid Build Coastguard Worker }; 301*cd60bc56SAndroid Build Coastguard Worker }; 302*cd60bc56SAndroid Build Coastguard Worker}; 303*cd60bc56SAndroid Build Coastguard Worker 304*cd60bc56SAndroid Build Coastguard WorkerThis is similar to the bar case, but the reference of a local label by the 305*cd60bc56SAndroid Build Coastguard Workerbaz node generates a __local_fixups__ entry that records the place that the 306*cd60bc56SAndroid Build Coastguard Workerlocal reference is being made. No matter how phandles are allocated from dtc 307*cd60bc56SAndroid Build Coastguard Workerthe run time loader must apply an offset to each phandle in every dynamic 308*cd60bc56SAndroid Build Coastguard WorkerDT object loaded. The __local_fixups__ node records the offset relative to the 309*cd60bc56SAndroid Build Coastguard Workerstart of every local reference within that property so that the loader can apply 310*cd60bc56SAndroid Build Coastguard Workerthe offset. 311*cd60bc56SAndroid Build Coastguard Worker 312*cd60bc56SAndroid Build Coastguard WorkerThere is an alternative syntax to the expanded form for overlays with phandle 313*cd60bc56SAndroid Build Coastguard Workertargets which makes the format similar to the one using in .dtsi include files. 314*cd60bc56SAndroid Build Coastguard Worker 315*cd60bc56SAndroid Build Coastguard WorkerSo for the &ocp target example above one can simply write: 316*cd60bc56SAndroid Build Coastguard Worker 317*cd60bc56SAndroid Build Coastguard Worker/dts-v1/; 318*cd60bc56SAndroid Build Coastguard Worker/plugin/; 319*cd60bc56SAndroid Build Coastguard Worker&ocp { 320*cd60bc56SAndroid Build Coastguard Worker /* bar peripheral */ 321*cd60bc56SAndroid Build Coastguard Worker bar { 322*cd60bc56SAndroid Build Coastguard Worker compatible = "corp,bar"; 323*cd60bc56SAndroid Build Coastguard Worker ... /* various properties and child nodes */ 324*cd60bc56SAndroid Build Coastguard Worker } 325*cd60bc56SAndroid Build Coastguard Worker}; 326*cd60bc56SAndroid Build Coastguard Worker 327*cd60bc56SAndroid Build Coastguard WorkerThe resulting dtb object is identical. 328