user space and device tree recipe combined in yocto build
Asked Answered
L

1

1

I am trying to create a recipe which is composed of a user application which is dependent on certain peripheral interface spi

I have created a recipe for the same but only application becomes the part of the built image.

How can I and what to modify to include the device tree as well?

MKI-33Axx.dts is my platform device tree and my modifications are in this file only for spi and I want this file to be picked up not the original one.

I have read that KERNEL_DEVICETREE_append needs to be provided the modified "dtb" file not the dts file.Do I have to compile the device tree separately then added it to the image after I build the image? But i am still not clear on this. Can some one please tell how to and where to activate this? so that i can append this device tree change as well with my recipe.

Leckie answered 19/6, 2021 at 19:30 Comment(2)
In my experience you specify a .dtsi file which declares the non-defaults which are compiled into the DTB.Yusuk
@Yusuk This is 100% not true if you use KERNEL_DEVICETREE variable (source).Gorgeous
A
2

KERNEL_DEVICETREE variable is used to specify the device tree files that need to be generated and added to the boot partition, but the bootloader will only charge one of them in the RAM while booting.

Example, for U-boot, the file specified in DEFAULT_FDT_FILE in the board's defconfig file will be used. But you can change the DTB by pausing U-boot and specifying the DTB file with:

setenv fdt_file new_file.dtb (make sure of "fdt_file" var with "printenv")

You can use recipetool to automatically add your new device tree file to your linux recipe, check my answer here.

You don't have to compile the DTS separatly, because adding it to KERNEL_DEVICETREE variable will cause it to be shipped in the boot partition.

Any modifications on the Linux kernel can be added into :

meta-custom/recipes-kernel/linux/linux-(PROVIDER)_%.append

the (PROVIDER) could be found in the machine configuration file, and it is a provider for virtual/kernel recipe.

You create patches for your Linux, go to:

tmp/work/.../linux-(PROVIDER)/../git

do your edits and:

git add modified_file
git commit -m "updates"
git format-patch -1

This will generate a "updates.patch" file, that you can add it to linux-(PROVIDER)_%.append file:

SRC_URI += "file://updates.patch"

Make sure you copy the patch file to:

meta-custom/recipes-kernel/linux/files

Now, the Linux build will triggered and apply the patch.

Alto answered 21/6, 2021 at 12:6 Comment(3)
Sorry ,how different is your this answer with previous one.?Leckie
here you are appending the a .path where as in previous answer you are copying the location of whole file.Leckie
I did not understand what's the exact issue.Alto

© 2022 - 2024 — McMap. All rights reserved.