[yocto] How to define and build device tree in Yocto?

Gabriele Zampieri gabbla.malist at gmail.com
Mon May 6 04:27:16 PDT 2019


Hi,

> but there is no imx6ull-14x14-evk.dts

it is located in arch/arm/boot/dts/imx6ull-14x14-evk.dts and it is compiled
(among others dts) while building virtual/kernel task.

Setting KERNEL_DEVICETREE =  "imx6ull-14x14-evk.dtb" simply tells to
bitbake to put a copy of imx6ull-14x14-evk.dtb inside your image deploy
directory. You can dig through meta/classes/kernel-devicetree.bbclass to
see how KERNEL_DEVICETREE is used.

If you do not need to modify the dts, you will find all the image related
stuff in poky/build/tmp/deploy/images/<MACHINE>/<IMAGE>.

If you need to patch the dts (or any other kernel related file):

- Clone you kernel source tree locally
- Checkout the correct branch
- Do your edits, then commit
- Get a patch with the customization through git format-patch (or any other
way)

Now, in your meta layer:
- create recipes-kernel/linux/<your-kernel-provider>.bbappend file
- create recipes-kernel/linux/files/<MACHINE>/ directory

Then:
- Copy your patch in recipes-kernel/linux/files/<MACHINE>
- Edit the bbappend file with:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:" # Add files to the search
paths
SRC_URI_append_<MACHINE> = " file://0001-your-commit-message.patch"

bitbake will apply the patch after the kernel unpack automatically, then
build the tree with the patch(es) applied.

You can also add a completely new dts via patch, then add it to
KERNEL_DEVICETREE.

Best regards,
Gabriele

Il giorno lun 6 mag 2019 alle ore 09:36 JH <jupiter.hce at gmail.com> ha
scritto:

> Thanks Gabriele,
>
> Yes, I have already added KERNEL_DEVICETREE =  "imx6ull-14x14-evk.dtb"
> to generate an image running on imx6 EVK. What I don't understand is
> how that imx6ull-14x14-evk.dtb was compiled? I thought all dtb are
> compiled from dts files, but there is no imx6ull-14x14-evk.dts, the
> imx6ullevk.conf defined the EVK but there is no detail in that file.
>
> My second question is my new hardware based on imx6ull MCU now has a
> dts file, since I could not see any samples how is the dtb compiled
> from a dts file, I have no idea where to put the dts file, how to link
> that dts file to generate a dtb file in recipe. Appreciate more
> clarification.
>
> Thank you.
>
> - jh
>
> On 5/6/19, Gabriele Zampieri <gabbla.malist at gmail.com> wrote:
> > Hi,
> >
> > The easiest way is to add them via patches. You can write a recipe that
> > patch the Linux tree and put it in your meta layer (usually in
> > meta-xxx/recipes-kernel/linux). Then you need to tell Yocto to export the
> > dtb via KERNEL_DEVICETREE variable (
> >
> https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-KERNEL_DEVICETREE
> ).
> > I usually put this variable in my machine configuration.
> >
> > Gabriele
> >
> > Il giorno dom 5 mag 2019 alle ore 14:04 JH <jupiter.hce at gmail.com> ha
> > scritto:
> >
> >> Hi,
> >>
> >> I think the device tree blob is build from device tree source, but I
> >> could not find any dts files in recipe source directory, there are
> >> many dts files in build directory and there are dtb in build
> >> directory.
> >>
> >> If I have a device tree source, where I should put it and how to
> >> define the recipe to built it?
> >>
> >> Thank you.
> >>
> >> Kind regards,
> >>
> >> - jupiter
> >> --
> >> _______________________________________________
> >> yocto mailing list
> >> yocto at yoctoproject.org
> >> https://lists.yoctoproject.org/listinfo/yocto
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20190506/265329cd/attachment-0001.html>


More information about the yocto mailing list