customize-patches.txt 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 +<packagename>-*.patch+
  31. are applied in alphabetical order.
  32. So, to ensure they are applied in the right order, it is highly
  33. recommended to name the patch files like this:
  34. +<packagename>-<number>-<description>.patch+, where +<number>+
  35. refers to the 'apply order'.
  36. For information about how patches are applied for a package, see
  37. xref:patch-apply-order[]
  38. The +BR2_GLOBAL_PATCH_DIR+ option is the preferred method for
  39. specifying a custom patch directory for packages. It can be used to
  40. specify a patch directory for any package in buildroot. It should also
  41. be used in place of the custom patch directory options that are
  42. available for packages such as U-Boot and Barebox. By doing this, it
  43. will allow a user to manage their patches from one top-level
  44. directory.
  45. The exception to +BR2_GLOBAL_PATCH_DIR+ being the preferred method for
  46. specifying custom patches is +BR2_LINUX_KERNEL_PATCH+.
  47. +BR2_LINUX_KERNEL_PATCH+ should be used to specify kernel patches that
  48. are available at an URL. *Note:* +BR2_LINUX_KERNEL_PATCH+ specifies kernel
  49. patches that are applied after patches available in +BR2_GLOBAL_PATCH_DIR+,
  50. as it is done from a post-patch hook of the Linux package.