customize-patches.txt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // -*- mode:doc -*- ;
  2. // vim: set syntax=asciidoc:
  3. [[customize-patches]]
  4. === Adding project-specific patches
  5. It is sometimes useful to apply 'extra' patches to packages - on top of
  6. those provided in Buildroot. This might be used to support custom
  7. features in a project, for example, or when working on a new
  8. architecture.
  9. The +BR2_GLOBAL_PATCH_DIR+ configuration option can be used to specify
  10. a space separated list of one or more directories containing package
  11. patches.
  12. For a specific version +<packageversion>+ of a specific package
  13. +<packagename>+, patches are applied from +BR2_GLOBAL_PATCH_DIR+ as
  14. follows:
  15. . For every directory - +<global-patch-dir>+ - that exists in
  16. +BR2_GLOBAL_PATCH_DIR+, a +<package-patch-dir>+ will be determined as
  17. follows:
  18. +
  19. * +<global-patch-dir>/<packagename>/<packageversion>/+ if the
  20. directory exists.
  21. +
  22. * Otherwise, +<global-patch-dir>/<packagename>+ if the directory
  23. exists.
  24. . Patches will then be applied from a +<package-patch-dir>+ as
  25. follows:
  26. +
  27. * If a +series+ file exists in the package directory, then patches are
  28. applied according to the +series+ file;
  29. +
  30. * Otherwise, patch files matching +*.patch+ are applied in
  31. alphabetical order. So, to ensure they are applied in the right
  32. order, it is highly recommended to name the patch files like this:
  33. +<number>-<description>.patch+, where +<number>+ refers to the
  34. 'apply order'.
  35. For information about how patches are applied for a package, see
  36. xref:patch-apply-order[]
  37. The +BR2_GLOBAL_PATCH_DIR+ option is the preferred method for
  38. specifying a custom patch directory for packages. It can be used to
  39. specify a patch directory for any package in buildroot. It should also
  40. be used in place of the custom patch directory options that are
  41. available for packages such as U-Boot and Barebox. By doing this, it
  42. will allow a user to manage their patches from one top-level
  43. directory.
  44. The exception to +BR2_GLOBAL_PATCH_DIR+ being the preferred method for
  45. specifying custom patches is +BR2_LINUX_KERNEL_PATCH+.
  46. +BR2_LINUX_KERNEL_PATCH+ should be used to specify kernel patches that
  47. are available at a URL. *Note:* +BR2_LINUX_KERNEL_PATCH+ specifies kernel
  48. patches that are applied after patches available in +BR2_GLOBAL_PATCH_DIR+,
  49. as it is done from a post-patch hook of the Linux package.