<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15092</bug_id>
          
          <creation_ts>2023-04-04 09:21:05 +0000</creation_ts>
          <short_desc>Document devicetree.bbclass</short_desc>
          <delta_ts>2023-04-28 16:23:19 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>9</classification_id>
          <classification>Documentation</classification>
          <product>Reference</product>
          <component>handbook</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>4.3 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Luca Ceresoli">luca.ceresoli</reporter>
          <assigned_to name="Michael Opdenacker">michael.opdenacker</assigned_to>
          <cc>poky.doc.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>95283</commentid>
    <comment_count>0</comment_count>
    <who name="Luca Ceresoli">luca.ceresoli</who>
    <bug_when>2023-04-04 09:21:05 +0000</bug_when>
    <thetext>devicetree.bbclass is in oe-core since several years, and according to my experience it works well and it is very useful for real products, where the hardware is custom and the device tree is out of the kernel tree.

Thus it should be mentioned in the &quot;Classes&quot; chapter of the reference manual.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95285</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Opdenacker">michael.opdenacker</who>
    <bug_when>2023-04-04 17:32:03 +0000</bug_when>
    <thetext>Hi Luca
Thanks for the suggestion!
Would you have an example recipe using this class?
That would help to explain how to use it.
Any further details (like a quick draft) will help too.
Cheers
Michael.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95293</commentid>
    <comment_count>2</comment_count>
    <who name="Luca Ceresoli">luca.ceresoli</who>
    <bug_when>2023-04-05 14:32:29 +0000</bug_when>
    <thetext>I have this one, which definitely arguments how easy it is to use the class (just renamed the machine to hide customer details):

------- recipes-kernel/linux/devicetree-acme.bb: --------
inherit devicetree

COMPATIBLE_MACHINE = &quot;^mymachine$&quot;

SRC_URI:mymachine = &quot;file://mymachine.dts&quot;
---------------------------------------------------------

Looking at the source code, I&apos;d say the initial comment is already a pretty good documentation. Starting from that and adding a few details, I came up with this draft:

The devicetree class allows building a recipe that compiles device tree
source files that are not in the kernel tree.
The compilation of the device tree sources is the same as the kernel
device tree compilation process, this includes being able to include sources
from the kernel such as SoC dtsi files or header files such as gpio.h.

The do_compile() task will compile two kinds of files:
 * Regular device tree sources with a .dts extension
 * Device tree overlays, detected from the presence of the &quot;/plugin/;&quot;
   string in the file content

The output of this class behaves similar to how kernel-devicetree.bbclass
operates in that the output files are installed into /boot/devicetree.
However this class on purpose separates the deployed device trees into the
&apos;devicetree&apos; subdirectory. This prevents clashes with the kernel-devicetree
output. Additionally the device trees are populated into the sysroot for
access via the sysroot from within other recipes.

An extra padding is appended to non-overlay device trees blobs, used as extra space typically for additional properties during boot. The padding size can be modified by setting DT_PADDING_SIZE to the desired padding size, in bytes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95347</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Opdenacker">michael.opdenacker</who>
    <bug_when>2023-04-12 19:12:27 +0000</bug_when>
    <thetext>Many thanks Luca! This helped a lot.
A patch has been sent:
https://lists.yoctoproject.org/g/docs/message/3836</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95483</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Opdenacker">michael.opdenacker</who>
    <bug_when>2023-04-28 16:23:19 +0000</bug_when>
    <thetext>Now fixed thanks to this commit:
https://git.yoctoproject.org/yocto-docs/commit/?id=f65816f5ea62e6c4301c0bd0c6aad91110963f9e

Thanks Luca for the proposed text!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>