To create and add patches for software
components within a PetaLinux project, follow these steps:
- Get the source code from git url specified in meta-layers:
petalinux-devtool modify <recipe-name>
For example:
petalinux-devtool modify linux-xlnx
Note:petalinux-config -c <recipe-name>
automatically fetches the source to the workspace directory.The previous command fetches the sources for the recipe and unpack them to a <plnx-proj-root>/components/yocto/workspace/sources/<recipe-name> directory and initialize it as a git repository if it is not already one.
- Make the changes you want to make to the source.
- Run a build to test your changes. You can just
petalinux-build -c <recipename>
or even build an entire image usingpetalinux-build
incorporating the changes assuming a package produced by the recipe is part of an image. There is no need to force anything; the build system will detect changes to the source and recompile as necessary. - Optional: Test your changes on the target.
- Place your changes in the form of a patch to the PetaLinux
project. To commit your changes, use the following
commands.
git add <filename> git commit -s
-
petalinux-devtool finish <recipe-name> <destination layer path>
creates a patch for the committed changes in recipe sources directory.For example:
petalinux-devtool finish linux-xlnx <plnx-proj-dir>/project-spec/meta-user
petalinux-devtool update-recipe linux-xlnx -a <destination layer path>
creates a patch for the committed changes in recipe sources directory without removing the bbappend and source directory from the workspace directory.For example:
petalinux-devtool update-recipe linux-xlnx -a <plnx-proj-dir>/project-spec/meta-user
- Once you have finished working on the recipe, run
petalinux-devtool reset <recipe-name>
to remove the source directory for the recipe from workspace.