customize-packages.txt 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. [[customize-packages]]
  4. === Adding project-specific packages
  5. In general, any new package should be added directly in the +package+
  6. directory and submitted to the Buildroot upstream project. How to add
  7. packages to Buildroot in general is explained in full detail in
  8. xref:adding-packages[] and will not be repeated here. However, your
  9. project may need some proprietary packages that cannot be upstreamed.
  10. This section will explain how you can keep such project-specific
  11. packages in a project-specific directory.
  12. As shown in xref:customize-dir-structure[], the recommended location for
  13. project-specific packages is +package/<company>/+. If you are using the
  14. +BR2_EXTERNAL+ feature (see xref:outside-br-custom[]) the recommended
  15. location is +$(BR2_EXTERNAL)/package/+.
  16. However, Buildroot will not be aware of the packages in this location,
  17. unless we perform some additional steps. As explained in
  18. xref:adding-packages[], a package in Buildroot basically consists of two
  19. files: a +.mk+ file (describing how to build the package) and a
  20. +Config.in+ file (describing the configuration options for this
  21. package).
  22. Buildroot will automatically include the +.mk+ files in first-level
  23. subdirectories of the +package+ directory (using the pattern
  24. +package/\*/*.mk+). If we want Buildroot to include +.mk+ files from
  25. deeper subdirectories (like +package/<company>/package1/+) then we
  26. simply have to add a +.mk+ file in a first-level subdirectory that
  27. includes these additional +.mk+ files. Therefore, create a file
  28. +package/<company>/<company>.mk+ with following contents (assuming you
  29. have only one extra directory level below +package/<company>/+):
  30. -----
  31. include $(sort $(wildcard package/<company>/*/*.mk))
  32. -----
  33. If you are using +BR2_EXTERNAL+, create a file
  34. +$(BR2_EXTERNAL)/external.mk+ with following contents (again assuming only
  35. one extra level):
  36. -----
  37. include $(sort $(wildcard $(BR2_EXTERNAL)/package/*/*.mk))
  38. -----
  39. For the +Config.in+ files, create a file +package/<company>/Config.in+
  40. that includes the +Config.in+ files of all your packages. An exhaustive
  41. list has to be provided since wildcards are not supported in the source command of kconfig.
  42. For example:
  43. -----
  44. source "package/<company>/package1/Config.in"
  45. source "package/<company>/package2/Config.in"
  46. -----
  47. Include this new file +package/<company>/Config.in+ from
  48. +package/Config.in+, preferably in a company-specific menu to make
  49. merges with future Buildroot versions easier.
  50. If you are using +BR2_EXTERNAL+, create a file
  51. +$(BR2_EXTERNAL)/Config.in+ with similar contents:
  52. -----
  53. source "$BR2_EXTERNAL/package/package1/Config.in"
  54. source "$BR2_EXTERNAL/package/package2/Config.in"
  55. -----
  56. You do not have to add an include for this +$(BR2_EXTERNAL)/Config.in+
  57. file as it is included automatically.