customize-patches.txt 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // -*- mode:doc -*- ;
  2. [[customize-patches]]
  3. === Adding project-specific patches
  4. It is sometimes useful to apply 'extra' patches to packages - on top of
  5. those provided in Buildroot. This might be used to support custom
  6. features in a project, for example, or when working on a new
  7. architecture.
  8. The +BR2_GLOBAL_PATCH_DIR+ configuration option can be used to specify
  9. a space separated list of one or more directories containing package
  10. patches.
  11. For a specific version +<packageversion>+ of a specific package
  12. +<packagename>+, patches are applied from +BR2_GLOBAL_PATCH_DIR+ as
  13. follows:
  14. . For every directory - +<global-patch-dir>+ - that exists in
  15. +BR2_GLOBAL_PATCH_DIR+, a +<package-patch-dir>+ will be determined as
  16. follows:
  17. +
  18. * +<global-patch-dir>/<packagename>/<packageversion>/+ if the
  19. directory exists.
  20. +
  21. * Otherwise, +<global-patch-dir>/<packagename>+ if the directory
  22. exists.
  23. . Patches will then be applied from a +<package-patch-dir>+ as
  24. follows:
  25. +
  26. * If a +series+ file exists in the package directory, then patches are
  27. applied according to the +series+ file;
  28. +
  29. * Otherwise, patch files matching +<packagename>-*.patch+
  30. are applied in alphabetical order.
  31. So, to ensure they are applied in the right order, it is highly
  32. recommended to name the patch files like this:
  33. +<packagename>-<number>-<description>.patch+, where +<number>+
  34. refers to the '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 an 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.