Creating and Adding Patches For Software Components within a PetaLinux Project - 2020.2 English

PetaLinux Tools Documentation Reference Guide (UG1144)

Document ID
Release Date
2020.2 English
To create and add patches for software components within a PetaLinux project, follow these steps:
  1. 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.

  2. Make the changes you want to make to the source.
  3. Run a build to test your changes. You can just petalinux-build -c <recipename> or even build an entire image using petalinux-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.
  4. Optional: Test your changes on the target.
  5. 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
  6. 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
  7. Once you have finished working on the recipe, run petalinux-devtool reset <recipe-name> to remove the source directory for the recipe from workspace.