new-machine.rst 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. Adding a New Machine
  3. ********************
  4. Adding a new machine to the Yocto Project is a straightforward process.
  5. This section describes how to add machines that are similar to those
  6. that the Yocto Project already supports.
  7. .. note::
  8. Although well within the capabilities of the Yocto Project, adding a
  9. totally new architecture might require changes to ``gcc``/``glibc``
  10. and to the site information, which is beyond the scope of this
  11. manual.
  12. For a complete example that shows how to add a new machine, see the
  13. ":ref:`bsp-guide/bsp:creating a new bsp layer using the \`\`bitbake-layers\`\` script`"
  14. section in the Yocto Project Board Support Package (BSP) Developer's
  15. Guide.
  16. Adding the Machine Configuration File
  17. =====================================
  18. To add a new machine, you need to add a new machine configuration file
  19. to the layer's ``conf/machine`` directory. This configuration file
  20. provides details about the device you are adding.
  21. The OpenEmbedded build system uses the root name of the machine
  22. configuration file to reference the new machine. For example, given a
  23. machine configuration file named ``crownbay.conf``, the build system
  24. recognizes the machine as "crownbay".
  25. The most important variables you must set in your machine configuration
  26. file or include from a lower-level configuration file are as follows:
  27. - :term:`TARGET_ARCH` (e.g. "arm")
  28. - ``PREFERRED_PROVIDER_virtual/kernel``
  29. - :term:`MACHINE_FEATURES` (e.g. "screen wifi")
  30. You might also need these variables:
  31. - :term:`SERIAL_CONSOLES` (e.g. "115200;ttyS0 115200;ttyS1")
  32. - :term:`KERNEL_IMAGETYPE` (e.g. "zImage")
  33. - :term:`IMAGE_FSTYPES` (e.g. "tar.gz jffs2")
  34. You can find full details on these variables in the reference section.
  35. You can leverage existing machine ``.conf`` files from
  36. ``meta-yocto-bsp/conf/machine/``.
  37. Adding a Kernel for the Machine
  38. ===============================
  39. The OpenEmbedded build system needs to be able to build a kernel for the
  40. machine. You need to either create a new kernel recipe for this machine,
  41. or extend an existing kernel recipe. You can find several kernel recipe
  42. examples in the Source Directory at ``meta/recipes-kernel/linux`` that
  43. you can use as references.
  44. If you are creating a new kernel recipe, normal recipe-writing rules
  45. apply for setting up a :term:`SRC_URI`. Thus, you need to specify any
  46. necessary patches and set :term:`S` to point at the source code. You need to
  47. create a :ref:`ref-tasks-configure` task that configures the unpacked kernel with
  48. a ``defconfig`` file. You can do this by using a ``make defconfig``
  49. command or, more commonly, by copying in a suitable ``defconfig`` file
  50. and then running ``make oldconfig``. By making use of ``inherit kernel``
  51. and potentially some of the ``linux-*.inc`` files, most other
  52. functionality is centralized and the defaults of the class normally work
  53. well.
  54. If you are extending an existing kernel recipe, it is usually a matter
  55. of adding a suitable ``defconfig`` file. The file needs to be added into
  56. a location similar to ``defconfig`` files used for other machines in a
  57. given kernel recipe. A possible way to do this is by listing the file in
  58. the :term:`SRC_URI` and adding the machine to the expression in
  59. :term:`COMPATIBLE_MACHINE`::
  60. COMPATIBLE_MACHINE = '(qemux86|qemumips)'
  61. For more information on ``defconfig`` files, see the
  62. ":ref:`kernel-dev/common:changing the configuration`"
  63. section in the Yocto Project Linux Kernel Development Manual.
  64. Adding a Formfactor Configuration File
  65. ======================================
  66. A formfactor configuration file provides information about the target
  67. hardware for which the image is being built and information that the
  68. build system cannot obtain from other sources such as the kernel. Some
  69. examples of information contained in a formfactor configuration file
  70. include framebuffer orientation, whether or not the system has a
  71. keyboard, the positioning of the keyboard in relation to the screen, and
  72. the screen resolution.
  73. The build system uses reasonable defaults in most cases. However, if
  74. customization is necessary, you need to create a ``machconfig`` file in
  75. the ``meta/recipes-bsp/formfactor/files`` directory. This directory
  76. contains directories for specific machines such as ``qemuarm`` and
  77. ``qemux86``. For information about the settings available and the
  78. defaults, see the ``meta/recipes-bsp/formfactor/files/config`` file
  79. found in the same area.
  80. Here is an example for "qemuarm" machine::
  81. HAVE_TOUCHSCREEN=1
  82. HAVE_KEYBOARD=1
  83. DISPLAY_CAN_ROTATE=0
  84. DISPLAY_ORIENTATION=0
  85. #DISPLAY_WIDTH_PIXELS=640
  86. #DISPLAY_HEIGHT_PIXELS=480
  87. #DISPLAY_BPP=16
  88. DISPLAY_DPI=150
  89. DISPLAY_SUBPIXEL_ORDER=vrgb