Hey everyone! If you are looking for concise steps to create and apply a patch in a yocto build, this article will serve you well.
The reference taken in this article is of iMX93EVK yocto build. For this exercise, we are modifying a lpspi dts file in the BSP and creating a patch file but you may apply the same steps to other files in the BSP as well.
Step-1 Make changes to the dts file in your directory
example - arch/arm64/boot/dts/freescale/imx93-11x11-evk-lpspi.dts
Step-2 In your yocto build, go to the git folder
cd imx-yocto-bsp-home/build_11x11/tmp/work/imx93_11x11_lpddr4x_evk-poky-linux/linux-imx/6.1.36+gitAUTOINC+04b05c5527-r0/git
Step-3 Execute 'git diff' to check the difference between your changes and the default ones
Check the status by executing 'git status'
Step-4 Execute 'git add <file>' , 'git commit -m <message>', and 'git format-patch -1'
to add a file and create a git format patch file for your changes.
copy the generated patch file to a location which yocto build look for the patches
Example- My yocto build looks for the patch in various locations, one of them is this one :-
sources/meta-imx/meta-bsp/recipes-kernel/linux/files,
so after creating the directory 'files', we can move the patch file to this folder
Step-5 Edit the .bb file for linux recipes-kernel
for example - Open /home/nxg06361/imx-yocto-bsp-home/sources/meta-imx/meta-bsp/recipes-kernel/linux/linux-imx_6.1.bb for editing
Append the patch file name to the SRC_URI variable
You can also verify that your patch has been successfully applied or not by doing 'git log'
Voila ! that's all you need to do in order to create and apply a git patch for your yocto build.