Hi Mark,

That is extremely helpful - thank you for the quick and comprehensive response 
:). More comments below...

> 
> 3) Add a device-tree.bbappend and add to the device-tree whatever value(s)
> you need.  If you want to use the Linux kernel sources for your device-tree, 
> you
> can "restore" the lines that were disabled in the devicetree class:
> 
> ...
>
> KERNEL_INCLUDE ??= " \
>          ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts \
>          ${STAGING_KERNEL_DIR}/arch/${ARCH}/boot/dts/* \
>          ${STAGING_KERNEL_DIR}/scripts/dtc/include-prefixes \
>          "
> 
> (the python block runs AFTER the variables are processed, so the bbappend
> approach works fine.)

Yep, this is exactly how I did it initially, but it felt dirty.

> 
> But speaking more toward your specific example of the gpio stuff.  There IS a
> copy of the gpio.h file inside of the device-tree repository.  (More on that
> below)
> 
> > I sort of get the impression that the DTS coming from
> > gen-machineconf/lopper are not intended to be hand edited? (they've
> > got phandles for some reason, which are just noise)
> 
> The workflow we designed is:
> 
> Vivado -> XSA
>    XSA -> SDTGen -> SDT artifacts
>      (SDT artifacts can modify them here)
>        SDT artifacts -> gen-machine-conf -> YP config & domain DTS
>          (YP config & domain DTS files can be modified here)
>            YP build
> 
> In the two places above where the artifacts can be modified, we highly
> recommend NOT modifying things by hand.  Instead write a script to do it in a
> reproducible way.  We expect that every time you regenerate your XSA you will
> need to go through the process, including SDTGen and gen-machine-conf, so
> being able to apply your customization in an automated approach really is what
> you want.

I think I see. For example, if I am adding an I2C GPIO expander (which needs 
some defines from the #include), then I could write a script which adds it to 
the bus and feed that to gen-machine-conf? Assuming that's right, are there any 
examples of such scripts? I can't find any arguments (in 
https://github.com/Xilinx/gen-machine-conf/blob/main/gen-machineconf) where I 
might pass them.

Regarding scripting the XSA -> SDT step, I suppose that the purpose there is 
for transformations/modifications that are applicable to all domains (e.g. 
FSBL, not just Linux)? 

> So if you need to customize (or synchronize?) the gpio.h with your
> development, I think it can be done early as a patch to the SDTGen device-tree
> repository that is being used, then everything "should" flow through the 
> system
> automatically.   (Note, I've never done this, but it's my understanding of how
> you can approach this.)

I won't need to modify gpio.h - rather, just utilize its #defines in my own 
bindings. 

> > A little guidance would be appreciated.
> 
> Hopefully the above helps.  I'm far from an expert on DTS files and how they
> should be done.  I tried to influence the overall workflow in a way that both
> beginners and experts can find it useful.  If you have suggestions, please 
> let us
> know.
> 

I think it helps a lot, so thanks again :)

> 
> One final note, we're also aware of some situations where you may need
> multiple device-trees (at the same time) for different board revisions.  At 
> this
> point I don't have good suggestions how to manage this.  Best I can suggest is
> run gen-machine-conf multiple times, manually copy out the device-trees you
> want and then create a custom device-tree recipe that builds and packages
> them all however you need them.  (This is far from simply unfortunately.)

I'll need to do something like this internally soon - I'll let you know what I 
decide on. To be honest, I might end up hijacking the device-tree recipe via 
bbappend to apply some .dtsi overlays.

Thanks,
Chris 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5505): 
https://lists.yoctoproject.org/g/meta-xilinx/message/5505
Mute This Topic: https://lists.yoctoproject.org/mt/110007484/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-xilinx/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to