Yocto patch application

I’ve made a layer similar to meta-toradex-demos. I only have one recipe recipes-images/images. I’ve added a bb file that’s very similar to one of the bb files that’s in meta-toradex-demos/recipes-images/images/tdx-reference-minimal-image.bb. I’ve added SRC_URI += “file://0001-Add-Rudi-text.patch” in the bbappend file so that the patch gets applied. The patch is about a single line modification in a dts file. The image is built but I found that the decompiled dtb file does not have the changes and I checked the dts file and the patch is not applied there either.

I’m new to Yocto and wondering how to get it working?

Thanks so much.

This is the layer directory with custom layer meta-cti-layer

meta-arm meta-freescale-3rdparty meta-qt5 meta-toradex-bsp-common meta-toradex-nxp openembedded-core
meta-cti-rudi meta-freescale-distro meta-security meta-toradex-demos meta-toradex-ti
meta-freescale meta-openembedded meta-ti meta-toradex-distro meta-yocto

Following is the custom layer meta-cti-rudi

├── conf
│ └── layer.conf
├── COPYING.MIT
├── README
└── recipes-images
└── images
├── cti-rudi-minimal-image.bb
├── cti-rudi-minimal-image.bbappend
└── files
└── 0001-Add-Rudi-text.patch

Following is the output of bitbake-layers show-layers
layer path priority

meta-toradex-nxp /home/hj/cti-rudi-aquila/build/…/layers/meta-toradex-nxp 22
meta-freescale /home/hj/cti-rudi-aquila/build/…/layers/meta-freescale 5
meta-freescale-3rdparty /home/hj/cti-rudi-aquila/build/…/layers/meta-freescale-3rdparty 4
meta-toradex-ti /home/hj/cti-rudi-aquila/build/…/layers/meta-toradex-ti 22
meta-arm-toolchain /home/hj/cti-rudi-aquila/build/…/layers/meta-arm/meta-arm-toolchain 5
meta-arm /home/hj/cti-rudi-aquila/build/…/layers/meta-arm/meta-arm 5
meta-ti-bsp /home/hj/cti-rudi-aquila/build/…/layers/meta-ti/meta-ti-bsp 6
meta-ti-extras /home/hj/cti-rudi-aquila/build/…/layers/meta-ti/meta-ti-extras 6
meta-toradex-bsp-common /home/hj/cti-rudi-aquila/build/…/layers/meta-toradex-bsp-common 23
meta-oe /home/hj/cti-rudi-aquila/build/…/layers/meta-openembedded/meta-oe 5
meta-filesystems /home/hj/cti-rudi-aquila/build/…/layers/meta-openembedded/meta-filesystems 5
meta-gnome /home/hj/cti-rudi-aquila/build/…/layers/meta-openembedded/meta-gnome 5
meta-xfce /home/hj/cti-rudi-aquila/build/…/layers/meta-openembedded/meta-xfce 5
meta-networking /home/hj/cti-rudi-aquila/build/…/layers/meta-openembedded/meta-networking 5
meta-multimedia /home/hj/cti-rudi-aquila/build/…/layers/meta-openembedded/meta-multimedia 5
meta-python /home/hj/cti-rudi-aquila/build/…/layers/meta-openembedded/meta-python 5
meta-freescale-distro /home/hj/cti-rudi-aquila/build/…/layers/meta-freescale-distro 4
meta-toradex-demos /home/hj/cti-rudi-aquila/build/…/layers/meta-toradex-demos 24
meta-cti-rudi /home/hj/cti-rudi-aquila/build/…/layers/meta-cti-rudi 34
meta-qt5 /home/hj/cti-rudi-aquila/build/…/layers/meta-qt5 7
meta-tpm /home/hj/cti-rudi-aquila/build/…/layers/meta-security/meta-tpm 10
meta-toradex-distro /home/hj/cti-rudi-aquila/build/…/layers/meta-toradex-distro 21
meta-poky /home/hj/cti-rudi-aquila/build/…/layers/meta-yocto/meta-poky 5
meta /home/hj/cti-rudi-aquila/build/…/layers/openembedded-core/meta 5
0001-Add-Rudi-text.patch (347 Bytes)
cti-rudi-minimal-image.bb (1.6 KB)
cti-rudi-minimal-image.bbappend (115 Bytes)
layer.conf (906 Bytes)

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


It looks like you’re trying to apply a patch to a device tree source (DTS) file through a Yocto recipe, but the patch is not being applied. Here are a few steps to troubleshoot and ensure that your patch is correctly applied:

  1. Check the Patch File:
    Ensure that your patch file 0001-Add-Rudi-text.patch is correctly formatted and applies cleanly to the target DTS file. You can manually apply the patch using the patch command to verify this:

    patch -p1 < 0001-Add-Rudi-text.patch
    
  2. Verify the bbappend File:
    Ensure that your cti-rudi-minimal-image.bbappend file is correctly referencing the patch. The SRC_URI should include the patch file:

    SRC_URI += "file://0001-Add-Rudi-text.patch"
    
  3. Layer Configuration:
    Ensure that your layer configuration (layer.conf) includes the path to the files directory where the patch is located. You should have something like this in your layer.conf:

    FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
    
  4. Patch Application:
    Ensure that the patch is being applied at the correct stage. If the patch is for a device tree file, it should be applied in the context of the kernel or U-Boot recipe, not the image recipe. You might need to create a bbappend for the kernel or U-Boot recipe instead of the image recipe.

    For example, if you are patching a device tree file in the kernel, you should create a bbappend for the kernel recipe:

    meta-cti-rudi/
    ├── recipes-kernel/
    │   └── linux/
    │       └── linux-toradex_%.bbappend
    └── files/
        └── 0001-Add-Rudi-text.patch
    

    And in linux-toradex_%.bbappend:

    FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
    SRC_URI += "file://0001-Add-Rudi-text.patch"
    
  5. Rebuild the Image:
    After making these changes, clean the build and rebuild the image to ensure that the patch is applied:

    bitbake -c cleanall <image-name>
    bitbake <image-name>
    
  6. Check Logs:
    Check the build logs to see if the patch is being applied. You can find the logs in the tmp/work directory of your build. Look for messages related to patch application.

If you follow these steps and ensure that the patch is correctly referenced and applied in the appropriate recipe, you should be able to see the changes in the decompiled DTB file. If you still encounter issues, please provide more details about the specific DTS file you are trying to patch and the exact contents of your patch file.

Please, also check if these links can help you solve your problem:

https://community.nxp.com/t5/i-MX-Processors/Yocto-build-is-ignoring-changes-in-recipe/td-p/858040.

Thanks AI, that was the issue.