Re: Question regarding custom device tree update


Sohil Shah <sohils@...>
 

Hi Robert,

Thank you for your reply.
This works and I got my dtb generated in my build directory!

Best wishes,
Sohil


On Wed, Jul 7, 2021 at 10:29 PM Robert Calhoun <rcalhoun@...> wrote:
> From: yocto@... <yocto@...> on behalf of Sohil Shah <sohils@...>
> Sent: Wednesday, June 30, 2021 09:46
> To: yocto@... <yocto@...>
> Subject: [yocto] Question regarding custom device tree update
>
> (...)
> I want to build the image using my custom dts file where I enable certain peripherals and disable the ones not required. (A test to update dtb's in future).
>
> I tried different methods found here
> https://stackoverflow.com/questions/38917745/quick-rebuild-of-device-tree-only-with-yocto-bitbake
>
> But, I seem to run into some errors when I try to build the image.
>
> Please help and let me know if I missed any required information from my side.
>
>Thank you and Regards,
> Sohil

Hi Sohil,

First make a custom layer for you modifications and add it to bblayers.conf. Then modify your machine definition of KERNEL_DEVICETREE (in meta-yourlayer/conf/machine/machinname.conf) to specify multiple device trees, e.g.

KERNEL_DEVICETREE = "at91-sama5d27_wlsom1_ek.dtb at91-sama5d27_wlsom1_ek_custom.dtb"

Note this should specify the "dtb" (compiled device tree name), not the "dts" (source.)

Next, make a .bbappend for your linux recipe that will provide the .dts source, something like:

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

SRC_URI += " \
 file://at91-sama5d27_wlsom1_ek_custom.dts;subdir=git/arch/arm/boot/dts \
"

Make a subdirectory with package name (e.g. linux-yocto) and put your dts in there. The "subdir" directive tells bitbake to drop the dts into the appropriate directory for the linux build process to find it. The device tree(s) will be built along with linux and put in the image's /boot directory. You can select which device tree you want to boot with via u-boot, or by manipulating the symbolic links in the /boot directory.

Best wishes,

Rob Calhoun

Join {yocto@lists.yoctoproject.org to automatically receive all group messages.