custom-distribution.rst 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. Creating Your Own Distribution
  3. ******************************
  4. When you build an image using the Yocto Project and do not alter any
  5. distribution :term:`Metadata`, you are
  6. creating a Poky distribution. If you wish to gain more control over
  7. package alternative selections, compile-time options, and other
  8. low-level configurations, you can create your own distribution.
  9. To create your own distribution, the basic steps consist of creating
  10. your own distribution layer, creating your own distribution
  11. configuration file, and then adding any needed code and Metadata to the
  12. layer. The following steps provide some more detail:
  13. - *Create a layer for your new distro:* Create your distribution layer
  14. so that you can keep your Metadata and code for the distribution
  15. separate. It is strongly recommended that you create and use your own
  16. layer for configuration and code. Using your own layer as compared to
  17. just placing configurations in a ``local.conf`` configuration file
  18. makes it easier to reproduce the same build configuration when using
  19. multiple build machines. See the
  20. ":ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script`"
  21. section for information on how to quickly set up a layer.
  22. - *Create the distribution configuration file:* The distribution
  23. configuration file needs to be created in the ``conf/distro``
  24. directory of your layer. You need to name it using your distribution
  25. name (e.g. ``mydistro.conf``).
  26. .. note::
  27. The :term:`DISTRO` variable in your ``local.conf`` file determines the
  28. name of your distribution.
  29. You can split out parts of your configuration file into include files
  30. and then "require" them from within your distribution configuration
  31. file. Be sure to place the include files in the
  32. ``conf/distro/include`` directory of your layer. A common example
  33. usage of include files would be to separate out the selection of
  34. desired version and revisions for individual recipes.
  35. Your configuration file needs to set the following required
  36. variables:
  37. - :term:`DISTRO_NAME`
  38. - :term:`DISTRO_VERSION`
  39. These following variables are optional and you typically set them
  40. from the distribution configuration file:
  41. - :term:`DISTRO_FEATURES`
  42. - :term:`DISTRO_EXTRA_RDEPENDS`
  43. - :term:`DISTRO_EXTRA_RRECOMMENDS`
  44. - :term:`TCLIBC`
  45. .. tip::
  46. If you want to base your distribution configuration file on the
  47. very basic configuration from OE-Core, you can use
  48. ``conf/distro/defaultsetup.conf`` as a reference and just include
  49. variables that differ as compared to ``defaultsetup.conf``.
  50. Alternatively, you can create a distribution configuration file
  51. from scratch using the ``defaultsetup.conf`` file or configuration files
  52. from another distribution such as Poky as a reference.
  53. - *Provide miscellaneous variables:* Be sure to define any other
  54. variables for which you want to create a default or enforce as part
  55. of the distribution configuration. You can include nearly any
  56. variable from the ``local.conf`` file. The variables you use are not
  57. limited to the list in the previous bulleted item.
  58. - *Point to Your distribution configuration file:* In your ``local.conf``
  59. file in the :term:`Build Directory`, set your :term:`DISTRO` variable to
  60. point to your distribution's configuration file. For example, if your
  61. distribution's configuration file is named ``mydistro.conf``, then
  62. you point to it as follows::
  63. DISTRO = "mydistro"
  64. - *Add more to the layer if necessary:* Use your layer to hold other
  65. information needed for the distribution:
  66. - Add recipes for installing distro-specific configuration files
  67. that are not already installed by another recipe. If you have
  68. distro-specific configuration files that are included by an
  69. existing recipe, you should add an append file (``.bbappend``) for
  70. those. For general information and recommendations on how to add
  71. recipes to your layer, see the
  72. ":ref:`dev-manual/layers:creating your own layer`" and
  73. ":ref:`dev-manual/layers:following best practices when creating layers`"
  74. sections.
  75. - Add any image recipes that are specific to your distribution.
  76. - Add a ``psplash`` append file for a branded splash screen. For
  77. information on append files, see the
  78. ":ref:`dev-manual/layers:appending other layers metadata with your layer`"
  79. section.
  80. - Add any other append files to make custom changes that are
  81. specific to individual recipes.