quilt.rst 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. Using Quilt in Your Workflow
  3. ****************************
  4. `Quilt <https://savannah.nongnu.org/projects/quilt>`__ is a powerful tool
  5. that allows you to capture source code changes without having a clean
  6. source tree. This section outlines the typical workflow you can use to
  7. modify source code, test changes, and then preserve the changes in the
  8. form of a patch all using Quilt.
  9. .. note::
  10. With regard to preserving changes to source files, if you clean a
  11. recipe or have :ref:`ref-classes-rm-work` enabled, the
  12. :ref:`devtool workflow <sdk-manual/extensible:using \`\`devtool\`\` in your sdk workflow>`
  13. as described in the Yocto Project Application Development and the
  14. Extensible Software Development Kit (eSDK) manual is a safer
  15. development flow than the flow that uses Quilt.
  16. Follow these general steps:
  17. #. *Find the Source Code:* Temporary source code used by the
  18. OpenEmbedded build system is kept in the :term:`Build Directory`. See the
  19. ":ref:`dev-manual/temporary-source-code:finding temporary source code`" section to
  20. learn how to locate the directory that has the temporary source code for a
  21. particular package.
  22. #. *Change Your Working Directory:* You need to be in the directory that
  23. has the temporary source code. That directory is defined by the
  24. :term:`S` variable.
  25. #. *Create a New Patch:* Before modifying source code, you need to
  26. create a new patch. To create a new patch file, use ``quilt new`` as
  27. below::
  28. $ quilt new my_changes.patch
  29. #. *Notify Quilt and Add Files:* After creating the patch, you need to
  30. notify Quilt about the files you plan to edit. You notify Quilt by
  31. adding the files to the patch you just created::
  32. $ quilt add file1.c file2.c file3.c
  33. #. *Edit the Files:* Make your changes in the source code to the files
  34. you added to the patch.
  35. #. *Test Your Changes:* Once you have modified the source code, the
  36. easiest way to test your changes is by calling the :ref:`ref-tasks-compile`
  37. task as shown in the following example::
  38. $ bitbake -c compile -f package
  39. The ``-f`` or ``--force`` option forces the specified task to
  40. execute. If you find problems with your code, you can just keep
  41. editing and re-testing iteratively until things work as expected.
  42. .. note::
  43. All the modifications you make to the temporary source code disappear
  44. once you run the :ref:`ref-tasks-clean` or :ref:`ref-tasks-cleanall`
  45. tasks using BitBake (i.e. ``bitbake -c clean package`` and
  46. ``bitbake -c cleanall package``). Modifications will also disappear if
  47. you use the :ref:`ref-classes-rm-work` feature as described in
  48. the ":ref:`dev-manual/disk-space:conserving disk space during builds`"
  49. section.
  50. #. *Generate the Patch:* Once your changes work as expected, you need to
  51. use Quilt to generate the final patch that contains all your
  52. modifications::
  53. $ quilt refresh
  54. At this point, the
  55. ``my_changes.patch`` file has all your edits made to the ``file1.c``,
  56. ``file2.c``, and ``file3.c`` files.
  57. You can find the resulting patch file in the ``patches/``
  58. subdirectory of the source (:term:`S`) directory.
  59. #. *Copy the Patch File:* For simplicity, copy the patch file into a
  60. directory named ``files``, which you can create in the same directory
  61. that holds the recipe (``.bb``) file or the append (``.bbappend``)
  62. file. Placing the patch here guarantees that the OpenEmbedded build
  63. system will find the patch. Next, add the patch into the :term:`SRC_URI`
  64. of the recipe. Here is an example::
  65. SRC_URI += "file://my_changes.patch"