yp-intro.rst 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. *****************************
  3. Introducing the Yocto Project
  4. *****************************
  5. What is the Yocto Project?
  6. ==========================
  7. The Yocto Project is an open source collaboration project that helps
  8. developers create custom Linux-based systems that are designed for
  9. embedded products regardless of the product's hardware architecture.
  10. Yocto Project provides a flexible toolset and a development environment
  11. that allows embedded device developers across the world to collaborate
  12. through shared technologies, software stacks, configurations, and best
  13. practices used to create these tailored Linux images.
  14. Thousands of developers worldwide have discovered that Yocto Project
  15. provides advantages in both systems and applications development,
  16. archival and management benefits, and customizations used for speed,
  17. footprint, and memory utilization. The project is a standard when it
  18. comes to delivering embedded software stacks. The project allows
  19. software customizations and build interchange for multiple hardware
  20. platforms as well as software stacks that can be maintained and scaled.
  21. .. image:: figures/key-dev-elements.png
  22. :width: 100%
  23. For further introductory information on the Yocto Project, you might be
  24. interested in this
  25. `article <https://www.embedded.com/why-the-yocto-project-for-my-iot-project/>`__
  26. by Drew Moseley and in this short introductory
  27. `video <https://www.youtube.com/watch?v=utZpKM7i5Z4>`__.
  28. The remainder of this section overviews advantages and challenges tied
  29. to the Yocto Project.
  30. Features
  31. --------
  32. Here are features and advantages of the Yocto Project:
  33. - *Widely Adopted Across the Industry:* Many semiconductor, operating
  34. system, software, and service vendors adopt and support the Yocto
  35. Project in their products and services. For a look at the Yocto
  36. Project community and the companies involved with the Yocto Project,
  37. see the "COMMUNITY" and "ECOSYSTEM" tabs on the
  38. :yocto_home:`Yocto Project <>` home page.
  39. - *Architecture Agnostic:* Yocto Project supports Intel, ARM, MIPS, AMD, PPC,
  40. RISC-V and other architectures. Most ODMs, OSVs, and chip vendors create and
  41. supply BSPs that support their hardware. If you have custom silicon, you can
  42. create a BSP that supports that architecture. See
  43. :doc:`/ref-manual/yocto-project-supported-features` for details on the level
  44. of support for some of these architectures.
  45. Aside from broad architecture support, the Yocto Project fully
  46. supports a wide range of devices emulated by the Quick EMUlator
  47. (QEMU).
  48. - *Images and Code Transfer Easily:* Yocto Project output can easily
  49. move between architectures without moving to new development
  50. environments. Additionally, if you have used the Yocto Project to
  51. create an image or application and you find yourself not able to
  52. support it, commercial Linux vendors such as Wind River, Mentor
  53. Graphics, Timesys, and ENEA could take it and provide ongoing
  54. support. These vendors have offerings that are built using the Yocto
  55. Project.
  56. - *Flexibility:* Corporations use the Yocto Project many different
  57. ways. One example is to create an internal Linux distribution as a
  58. code base the corporation can use across multiple product groups.
  59. Through customization and layering, a project group can leverage the
  60. base Linux distribution to create a distribution that works for their
  61. product needs.
  62. - *Ideal for Constrained Embedded and IoT devices:* Unlike a full Linux
  63. distribution, you can use the Yocto Project to create exactly what
  64. you need for embedded devices. You only add the feature support or
  65. packages that you absolutely need for the device. For devices that
  66. have display hardware, you can use available system components such
  67. as X11, Wayland, GTK+, Qt, Clutter, and SDL (among others) to create
  68. a rich user experience. For devices that do not have a display or
  69. where you want to use alternative UI frameworks, you can choose to
  70. not build these components.
  71. - *Comprehensive Toolchain Capabilities:* Toolchains for supported
  72. architectures satisfy most use cases. However, if your hardware
  73. supports features that are not part of a standard toolchain, you can
  74. easily customize that toolchain through specification of
  75. platform-specific tuning parameters. And, should you need to use a
  76. third-party toolchain, mechanisms built into the Yocto Project allow
  77. for that.
  78. - *Mechanism Rules Over Policy:* Focusing on mechanism rather than
  79. policy ensures that you are free to set policies based on the needs
  80. of your design instead of adopting decisions enforced by some system
  81. software provider.
  82. - *Uses a Layer Model:* The Yocto Project :ref:`layer
  83. infrastructure <overview-manual/yp-intro:the yocto project layer model>`
  84. groups related functionality into separate bundles. You can incrementally
  85. add these grouped functionalities to your project as needed. Using layers to
  86. isolate and group functionality reduces project complexity and
  87. redundancy, allows you to easily extend the system, make
  88. customizations, and keep functionality organized.
  89. - *Supports Partial Builds:* You can build and rebuild individual
  90. packages as needed. Yocto Project accomplishes this through its
  91. :ref:`overview-manual/concepts:shared state cache` (sstate) scheme.
  92. Being able to build and debug components individually eases project
  93. development.
  94. - *Releases According to a Strict Schedule:* Major releases occur on a
  95. :doc:`six-month cycle </ref-manual/release-process>`
  96. predictably in October and April. The most recent two releases
  97. support point releases to address common vulnerabilities and
  98. exposures. This predictability is crucial for projects based on the
  99. Yocto Project and allows development teams to plan activities.
  100. - *Rich Ecosystem of Individuals and Organizations:* For open source
  101. projects, the value of community is very important. Support forums,
  102. expertise, and active developers who continue to push the Yocto
  103. Project forward are readily available.
  104. - *Binary Reproducibility:* The Yocto Project allows you to be very
  105. specific about dependencies and achieves very high percentages of
  106. binary reproducibility (e.g. 99.8% for ``core-image-minimal``). When
  107. distributions are not specific about which packages are pulled in and
  108. in what order to support dependencies, other build systems can
  109. arbitrarily include packages.
  110. - *License Manifest:* The Yocto Project provides a :ref:`license
  111. manifest <dev-manual/licenses:maintaining open source license compliance during your product's lifecycle>`
  112. for review by people who need to track the use of open source
  113. licenses (e.g. legal teams).
  114. Challenges
  115. ----------
  116. Here are challenges you might encounter when developing using the Yocto Project:
  117. - *Steep Learning Curve:* The Yocto Project has a steep learning curve
  118. and has many different ways to accomplish similar tasks. It can be
  119. difficult to choose between such ways.
  120. - *Understanding What Changes You Need to Make For Your Design Requires
  121. Some Research:* Beyond the simple tutorial stage, understanding what
  122. changes need to be made for your particular design can require a
  123. significant amount of research and investigation. For information
  124. that helps you transition from trying out the Yocto Project to using
  125. it for your project, see the ":ref:`what-i-wish-id-known:what i wish i'd known about yocto project`" and
  126. ":ref:`transitioning-to-a-custom-environment:transitioning to a custom environment for systems development`"
  127. documents on the Yocto Project website.
  128. - *Project Workflow Could Be Confusing:* The :ref:`Yocto Project
  129. workflow <overview-manual/development-environment:the yocto project development environment>`
  130. could be confusing if you are used to traditional desktop and server
  131. software development.
  132. In a desktop development environment, there are mechanisms to easily pull
  133. and install new packages, which are typically pre-compiled binaries
  134. from servers accessible over the Internet. Using the Yocto Project,
  135. you must modify your configuration and rebuild to add additional
  136. packages.
  137. - *Working in a Cross-Build Environment Can Feel Unfamiliar:* When
  138. developing code to run on a target, compilation, execution, and
  139. testing done on the actual target can be faster than running a
  140. BitBake build on a development host and then deploying binaries to
  141. the target for test. While the Yocto Project does support development
  142. tools on the target, the additional step of integrating your changes
  143. back into the Yocto Project build environment would be required.
  144. Yocto Project supports an intermediate approach that involves making
  145. changes on the development system within the BitBake environment and
  146. then deploying only the updated packages to the target.
  147. The Yocto Project :term:`OpenEmbedded Build System`
  148. produces packages
  149. in standard formats (i.e. RPM, DEB, IPK, and TAR). You can deploy
  150. these packages into the running system on the target by using
  151. utilities on the target such as ``rpm`` or ``ipk``.
  152. - *Initial Build Times Can be Significant:* Long initial build times
  153. are unfortunately unavoidable due to the large number of packages
  154. initially built from scratch for a fully functioning Linux system.
  155. Once that initial build is completed, however, the shared-state
  156. (sstate) cache mechanism Yocto Project uses keeps the system from
  157. rebuilding packages that have not been "touched" since the last
  158. build. The sstate mechanism significantly reduces times for
  159. successive builds.
  160. The Yocto Project Layer Model
  161. =============================
  162. The Yocto Project's "Layer Model" is a development model for embedded
  163. and IoT Linux creation that distinguishes the Yocto Project from other
  164. simple build systems. The Layer Model simultaneously supports
  165. collaboration and customization. Layers are repositories that contain
  166. related sets of instructions that tell the :term:`OpenEmbedded Build System`
  167. what to do. You can
  168. collaborate, share, and reuse layers.
  169. Layers can contain changes to previous instructions or settings at any
  170. time. This powerful override capability is what allows you to customize
  171. previously supplied collaborative or community layers to suit your
  172. product requirements.
  173. You use different layers to logically separate information in your
  174. build. As an example, you could have BSP, GUI, distro configuration,
  175. middleware, or application layers. Putting your entire build into one
  176. layer limits and complicates future customization and reuse. Isolating
  177. information into layers, on the other hand, helps simplify future
  178. customizations and reuse. You might find it tempting to keep everything
  179. in one layer when working on a single project. However, the more modular
  180. your Metadata, the easier it is to cope with future changes.
  181. .. note::
  182. - Use Board Support Package (BSP) layers from silicon vendors when
  183. possible.
  184. - Familiarize yourself with the
  185. :yocto_home:`Yocto Project Compatible Layers </software-overview/layers/>`
  186. or the :oe_layerindex:`OpenEmbedded Layer Index <>`.
  187. The latter contains more layers but they are less universally
  188. validated.
  189. - Layers support the inclusion of technologies, hardware components,
  190. and software components. The :ref:`Yocto Project
  191. Compatible <dev-manual/layers:making sure your layer is compatible with yocto project>`
  192. designation provides a minimum level of standardization that
  193. contributes to a strong ecosystem. "YP Compatible" is applied to
  194. appropriate products and software components such as BSPs, other
  195. OE-compatible layers, and related open-source projects, allowing
  196. the producer to use Yocto Project badges and branding assets.
  197. To illustrate how layers are used to keep things modular, consider
  198. machine customizations. These types of customizations typically reside
  199. in a special layer, rather than a general layer, called a BSP Layer.
  200. Furthermore, the machine customizations should be isolated from recipes
  201. and Metadata that support a new GUI environment, for example. This
  202. situation gives you a couple of layers: one for the machine
  203. configurations, and one for the GUI environment. It is important to
  204. understand, however, that the BSP layer can still make machine-specific
  205. additions to recipes within the GUI environment layer without polluting
  206. the GUI layer itself with those machine-specific changes. You can
  207. accomplish this through a recipe that is a BitBake append
  208. (``.bbappend``) file, which is described later in this section.
  209. .. note::
  210. For general information on BSP layer structure, see the
  211. :doc:`/bsp-guide/index`.
  212. The :term:`Source Directory`
  213. contains both general layers and BSP layers right out of the box. You
  214. can easily identify layers that ship with a Yocto Project release in the
  215. Source Directory by their names. Layers typically have names that begin
  216. with the string ``meta-``.
  217. .. note::
  218. It is not a requirement that a layer name begin with the prefix
  219. ``meta-``, but it is a commonly accepted standard in the Yocto Project
  220. community.
  221. For example, if you were to examine the :yocto_git:`tree view </poky/tree/>`
  222. of the ``poky`` repository, you will see several layers: ``meta``,
  223. ``meta-skeleton``, ``meta-selftest``, ``meta-poky``, and
  224. ``meta-yocto-bsp``. Each of these repositories represents a distinct
  225. layer.
  226. For procedures on how to create layers, see the
  227. ":ref:`dev-manual/layers:understanding and creating layers`"
  228. section in the Yocto Project Development Tasks Manual.
  229. Components and Tools
  230. ====================
  231. The Yocto Project employs a collection of components and tools used by
  232. the project itself, by project developers, and by those using the Yocto
  233. Project. These components and tools are open source projects and
  234. metadata that are separate from the reference distribution
  235. (:term:`Poky`) and the :term:`OpenEmbedded Build System`. Most of the
  236. components and tools are downloaded separately.
  237. This section provides brief overviews of the components and tools
  238. associated with the Yocto Project.
  239. Development Tools
  240. -----------------
  241. Here are tools that help you develop images and applications using
  242. the Yocto Project:
  243. - *CROPS:* `CROPS <https://github.com/crops/poky-container/>`__ is an
  244. open source, cross-platform development framework that leverages
  245. `Docker Containers <https://www.docker.com/>`__. CROPS provides an
  246. easily managed, extensible environment that allows you to build
  247. binaries for a variety of architectures on Windows, Linux and Mac OS
  248. X hosts.
  249. - *devtool:* This command-line tool is available as part of the
  250. extensible SDK (eSDK) and is its cornerstone. You can use ``devtool``
  251. to help build, test, and package software within the eSDK. You can
  252. use the tool to optionally integrate what you build into an image
  253. built by the OpenEmbedded build system.
  254. The ``devtool`` command employs a number of sub-commands that allow
  255. you to add, modify, and upgrade recipes. As with the OpenEmbedded
  256. build system, "recipes" represent software packages within
  257. ``devtool``. When you use ``devtool add``, a recipe is automatically
  258. created. When you use ``devtool modify``, the specified existing
  259. recipe is used in order to determine where to get the source code and
  260. how to patch it. In both cases, an environment is set up so that when
  261. you build the recipe a source tree that is under your control is used
  262. in order to allow you to make changes to the source as desired. By
  263. default, both new recipes and the source go into a "workspace"
  264. directory under the eSDK. The ``devtool upgrade`` command updates an
  265. existing recipe so that you can build it for an updated set of source
  266. files.
  267. You can read about the ``devtool`` workflow in the Yocto Project
  268. Application Development and Extensible Software Development Kit
  269. (eSDK) Manual in the
  270. ":ref:`sdk-manual/extensible:using \`\`devtool\`\` in your sdk workflow`"
  271. section.
  272. - *Extensible Software Development Kit (eSDK):* The eSDK provides a
  273. cross-development toolchain and libraries tailored to the contents of
  274. a specific image. The eSDK makes it easy to add new applications and
  275. libraries to an image, modify the source for an existing component,
  276. test changes on the target hardware, and integrate into the rest of
  277. the OpenEmbedded build system. The eSDK gives you a toolchain
  278. experience supplemented with the powerful set of ``devtool`` commands
  279. tailored for the Yocto Project environment.
  280. For information on the eSDK, see the :doc:`/sdk-manual/index` Manual.
  281. - *Toaster:* Toaster is a web interface to the Yocto Project
  282. OpenEmbedded build system. Toaster allows you to configure, run, and
  283. view information about builds. For information on Toaster, see the
  284. :doc:`/toaster-manual/index`.
  285. - *VSCode IDE Extension:* The `Yocto Project BitBake
  286. <https://marketplace.visualstudio.com/items?itemName=yocto-project.yocto-bitbake>`__
  287. extension for Visual Studio Code provides a rich set of features for working
  288. with BitBake recipes. The extension provides syntax highlighting,
  289. hover tips, and completion for BitBake files as well as embedded Python and
  290. Bash languages. Additional views and commands allow you to efficiently
  291. browse, build and edit recipes. It also provides SDK integration for
  292. cross-compiling and debugging through ``devtool``.
  293. Learn more about the VSCode Extension on the `extension's frontpage
  294. <https://marketplace.visualstudio.com/items?itemName=yocto-project.yocto-bitbake>`__.
  295. Production Tools
  296. ----------------
  297. Here are tools that help with production related activities using the
  298. Yocto Project:
  299. - *Auto Upgrade Helper:* This utility when used in conjunction with the
  300. :term:`OpenEmbedded Build System`
  301. (BitBake and
  302. OE-Core) automatically generates upgrades for recipes that are based
  303. on new versions of the recipes published upstream. See
  304. :ref:`dev-manual/upgrading-recipes:using the auto upgrade helper (auh)`
  305. for how to set it up.
  306. - *Recipe Reporting System:* The Recipe Reporting System tracks recipe
  307. versions available for Yocto Project. The main purpose of the system
  308. is to help you manage the recipes you maintain and to offer a dynamic
  309. overview of the project. The Recipe Reporting System is built on top
  310. of the :oe_layerindex:`OpenEmbedded Layer Index <>`, which
  311. is a website that indexes OpenEmbedded-Core layers.
  312. - *Patchwork:* `Patchwork <https://patchwork.yoctoproject.org/>`__
  313. is a fork of a project originally started by
  314. `OzLabs <https://ozlabs.org/>`__. The project is a web-based tracking
  315. system designed to streamline the process of bringing contributions
  316. into a project. The Yocto Project uses Patchwork as an organizational
  317. tool to handle patches, which number in the thousands for every
  318. release.
  319. - *AutoBuilder:* AutoBuilder is a project that automates build tests
  320. and quality assurance (QA). By using the public AutoBuilder, anyone
  321. can determine the status of the current development branch of Poky.
  322. .. note::
  323. AutoBuilder is based on buildbot.
  324. A goal of the Yocto Project is to lead the open source industry with
  325. a project that automates testing and QA procedures. In doing so, the
  326. project encourages a development community that publishes QA and test
  327. plans, publicly demonstrates QA and test plans, and encourages
  328. development of tools that automate and test and QA procedures for the
  329. benefit of the development community.
  330. You can learn more about the AutoBuilder used by the Yocto Project
  331. Autobuilder :doc:`here </test-manual/understand-autobuilder>`.
  332. - *Pseudo:* Pseudo is the Yocto Project implementation of
  333. :manpage:`fakeroot <fakeroot(1)>`, which is used to run
  334. commands in an environment that seemingly has root privileges.
  335. During a build, it can be necessary to perform operations that
  336. require system administrator privileges. For example, file ownership
  337. or permissions might need to be defined. Pseudo is a tool that you
  338. can either use directly or through the environment variable
  339. ``LD_PRELOAD``. Either method allows these operations to succeed
  340. even without system administrator privileges.
  341. Thanks to Pseudo, the Yocto Project never needs root privileges to
  342. build images for your target system.
  343. You can read more about Pseudo in the
  344. ":ref:`overview-manual/concepts:fakeroot and pseudo`" section.
  345. Open-Embedded Build System Components
  346. -------------------------------------
  347. Here are components associated with the :term:`OpenEmbedded Build System`:
  348. - *BitBake:* BitBake is a core component of the Yocto Project and is
  349. used by the OpenEmbedded build system to build images. While BitBake
  350. is key to the build system, BitBake is maintained separately from the
  351. Yocto Project.
  352. BitBake is a generic task execution engine that allows shell and
  353. Python tasks to be run efficiently and in parallel while working
  354. within complex inter-task dependency constraints. In short, BitBake
  355. is a build engine that works through recipes written in a specific
  356. format in order to perform sets of tasks.
  357. You can learn more about BitBake in the :doc:`BitBake User
  358. Manual <bitbake:index>`.
  359. - *OpenEmbedded-Core:* OpenEmbedded-Core (OE-Core) is a common layer of
  360. metadata (i.e. recipes, classes, and associated files) used by
  361. OpenEmbedded-derived systems, which includes the Yocto Project. The
  362. Yocto Project and the OpenEmbedded Project both maintain the
  363. OpenEmbedded-Core. You can find the OE-Core metadata in the Yocto
  364. Project :yocto_git:`Source Repositories </poky/tree/meta>`.
  365. Historically, the Yocto Project integrated the OE-Core metadata
  366. throughout the Yocto Project source repository reference system
  367. (Poky). After Yocto Project Version 1.0, the Yocto Project and
  368. OpenEmbedded agreed to work together and share a common core set of
  369. metadata (OE-Core), which contained much of the functionality
  370. previously found in Poky. This collaboration achieved a long-standing
  371. OpenEmbedded objective for having a more tightly controlled and
  372. quality-assured core. The results also fit well with the Yocto
  373. Project objective of achieving a smaller number of fully featured
  374. tools as compared to many different ones.
  375. Sharing a core set of metadata results in Poky as an integration
  376. layer on top of OE-Core. You can see that in this
  377. :ref:`figure <overview-manual/yp-intro:what is the yocto project?>`.
  378. The Yocto Project combines various components such as BitBake, OE-Core,
  379. script "glue", and documentation for its build system.
  380. Reference Distribution (Poky)
  381. -----------------------------
  382. Poky is the Yocto Project reference distribution. It contains the
  383. :term:`OpenEmbedded Build System`
  384. (BitBake and OE-Core) as well as a set of metadata to get you started
  385. building your own distribution. See the figure in
  386. ":ref:`overview-manual/yp-intro:what is the yocto project?`"
  387. section for an illustration that shows Poky and its relationship with
  388. other parts of the Yocto Project.
  389. To use the Yocto Project tools and components, you can download
  390. (``clone``) Poky and use it to bootstrap your own distribution.
  391. .. note::
  392. Poky does not contain binary files. It is a working example of how to
  393. build your own custom Linux distribution from source.
  394. You can read more about Poky in the
  395. ":ref:`overview-manual/yp-intro:reference embedded distribution (poky)`"
  396. section.
  397. Packages for Finished Targets
  398. -----------------------------
  399. Here are components associated with packages for finished targets:
  400. - *Matchbox:* Matchbox is an Open Source, base environment for the X
  401. Window System running on non-desktop, embedded platforms such as
  402. handhelds, set-top boxes, kiosks, and anything else for which screen
  403. space, input mechanisms, or system resources are limited.
  404. Matchbox consists of a number of interchangeable and optional
  405. applications that you can tailor to a specific, non-desktop platform
  406. to enhance usability in constrained environments.
  407. You can find the Matchbox source in the Yocto Project
  408. :yocto_git:`Source Repositories <>`.
  409. - *Opkg:* Open PacKaGe management (opkg) is a lightweight package
  410. management system based on the itsy package (ipkg) management system.
  411. Opkg is written in C and resembles Advanced Package Tool (APT) and
  412. Debian Package (dpkg) in operation.
  413. Opkg is intended for use on embedded Linux devices and is used in
  414. this capacity in the :oe_home:`OpenEmbedded <>` and
  415. `OpenWrt <https://openwrt.org/>`__ projects, as well as the Yocto
  416. Project.
  417. .. note::
  418. As best it can, opkg maintains backwards compatibility with ipkg
  419. and conforms to a subset of Debian's policy manual regarding
  420. control files.
  421. You can find the opkg source in the Yocto Project
  422. :yocto_git:`Source Repositories <>`.
  423. Archived Components
  424. -------------------
  425. The Build Appliance is a virtual machine image that enables you to build
  426. and boot a custom embedded Linux image with the Yocto Project using a
  427. non-Linux development system.
  428. Historically, the Build Appliance was the second of three methods by
  429. which you could use the Yocto Project on a system that was not native to
  430. Linux.
  431. #. *Hob:* Hob, which is now deprecated and is no longer available since
  432. the 2.1 release of the Yocto Project provided a rudimentary,
  433. GUI-based interface to the Yocto Project. Toaster has fully replaced
  434. Hob.
  435. #. *Build Appliance:* Post Hob, the Build Appliance became available. It
  436. was never recommended that you use the Build Appliance as a
  437. day-to-day production development environment with the Yocto Project.
  438. Build Appliance was useful as a way to try out development in the
  439. Yocto Project environment.
  440. #. *CROPS:* The final and best solution available now for developing
  441. using the Yocto Project on a system not native to Linux is with
  442. :ref:`CROPS <overview-manual/yp-intro:development tools>`.
  443. Development Methods
  444. ===================
  445. The Yocto Project development environment usually involves a
  446. :term:`Build Host` and target
  447. hardware. You use the Build Host to build images and develop
  448. applications, while you use the target hardware to execute deployed
  449. software.
  450. This section provides an introduction to the choices or development
  451. methods you have when setting up your Build Host. Depending on your
  452. particular workflow preference and the type of operating system your
  453. Build Host runs, you have several choices.
  454. .. note::
  455. For additional detail about the Yocto Project development
  456. environment, see the ":doc:`/overview-manual/development-environment`"
  457. chapter.
  458. - *Native Linux Host:* By far the best option for a Build Host. A
  459. system running Linux as its native operating system allows you to
  460. develop software by directly using the
  461. :term:`BitBake` tool. You can
  462. accomplish all aspects of development from a regular shell in a
  463. supported Linux distribution.
  464. For information on how to set up a Build Host on a system running
  465. Linux as its native operating system, see the
  466. ":ref:`dev-manual/start:setting up a native linux host`"
  467. section in the Yocto Project Development Tasks Manual.
  468. - *CROss PlatformS (CROPS):* Typically, you use
  469. `CROPS <https://github.com/crops/poky-container/>`__, which leverages
  470. `Docker Containers <https://www.docker.com/>`__, to set up a Build
  471. Host that is not running Linux (e.g. Microsoft Windows or macOS).
  472. .. note::
  473. You can, however, use CROPS on a Linux-based system.
  474. CROPS is an open source, cross-platform development framework that
  475. provides an easily managed, extensible environment for building
  476. binaries targeted for a variety of architectures on Windows, macOS,
  477. or Linux hosts. Once the Build Host is set up using CROPS, you can
  478. prepare a shell environment to mimic that of a shell being used on a
  479. system natively running Linux.
  480. For information on how to set up a Build Host with CROPS, see the
  481. ":ref:`dev-manual/start:setting up to use cross platforms (crops)`"
  482. section in the Yocto Project Development Tasks Manual.
  483. - *Windows Subsystem For Linux (WSL 2):* You may use Windows Subsystem
  484. For Linux version 2 to set up a Build Host using Windows 10 or later,
  485. or Windows Server 2019 or later.
  486. The Windows Subsystem For Linux allows Windows to run a real Linux
  487. kernel inside of a lightweight virtual machine (VM).
  488. For information on how to set up a Build Host with WSL 2, see the
  489. ":ref:`dev-manual/start:setting up to use windows subsystem for linux (wsl 2)`"
  490. section in the Yocto Project Development Tasks Manual.
  491. - *Toaster:* Regardless of what your Build Host is running, you can use
  492. Toaster to develop software using the Yocto Project. Toaster is a web
  493. interface to the Yocto Project's :term:`OpenEmbedded Build System`.
  494. The interface allows you to configure and run your builds. Information
  495. about builds is collected and stored in a database. You can use Toaster
  496. to configure and start builds on multiple remote build servers.
  497. For information about and how to use Toaster, see the
  498. :doc:`/toaster-manual/index`.
  499. - *Using the VSCode Extension:* You can use the `Yocto Project BitBake
  500. <https://marketplace.visualstudio.com/items?itemName=yocto-project.yocto-bitbake>`__
  501. extension for Visual Studio Code to start your BitBake builds through a
  502. graphical user interface.
  503. Learn more about the VSCode Extension on the `extension's marketplace page
  504. <https://marketplace.visualstudio.com/items?itemName=yocto-project.yocto-bitbake>`__
  505. Reference Embedded Distribution (Poky)
  506. ======================================
  507. "Poky", which is pronounced *Pock*-ee, is the name of the Yocto
  508. Project's reference distribution or Reference OS Kit. Poky contains the
  509. :term:`OpenEmbedded Build System` (:term:`BitBake` and
  510. :term:`OpenEmbedded-Core (OE-Core)`) as well as a set of
  511. :term:`Metadata` to get you started building your own distro. In other
  512. words, Poky is a base specification of the functionality needed for a
  513. typical embedded system as well as the components from the Yocto Project
  514. that allow you to build a distribution into a usable binary image.
  515. Poky is a combined repository of BitBake, OpenEmbedded-Core (which is
  516. found in ``meta``), ``meta-poky``, ``meta-yocto-bsp``, and documentation
  517. provided all together and known to work well together. You can view
  518. these items that make up the Poky repository in the
  519. :yocto_git:`Source Repositories </poky/tree/>`.
  520. .. note::
  521. If you are interested in all the contents of the
  522. poky
  523. Git repository, see the ":ref:`ref-manual/structure:top-level core components`"
  524. section in the Yocto Project Reference Manual.
  525. The following figure illustrates what generally comprises Poky:
  526. .. image:: figures/poky-reference-distribution.png
  527. :width: 100%
  528. - BitBake is a task executor and scheduler that is the heart of the
  529. OpenEmbedded build system.
  530. - ``meta-poky``, which is Poky-specific metadata.
  531. - ``meta-yocto-bsp``, which are Yocto Project-specific Board Support
  532. Packages (BSPs).
  533. - OpenEmbedded-Core (OE-Core) metadata, which includes shared
  534. configurations, global variable definitions, shared classes,
  535. packaging, and recipes. Classes define the encapsulation and
  536. inheritance of build logic. Recipes are the logical units of software
  537. and images to be built.
  538. - Documentation, which contains the Yocto Project source files used to
  539. make the set of user manuals.
  540. .. note::
  541. While Poky is a "complete" distribution specification and is tested
  542. and put through QA, you cannot use it as a product "out of the box"
  543. in its current form.
  544. To use the Yocto Project tools, you can use Git to clone (download) the
  545. Poky repository then use your local copy of the reference distribution
  546. to bootstrap your own distribution.
  547. .. note::
  548. Poky does not contain binary files. It is a working example of how to
  549. build your own custom Linux distribution from source.
  550. Poky has a regular, well established, six-month release cycle under its
  551. own version. Major releases occur at the same time major releases (point
  552. releases) occur for the Yocto Project, which are typically in the Spring
  553. and Fall. For more information on the Yocto Project release schedule and
  554. cadence, see the ":doc:`/ref-manual/release-process`" chapter in the
  555. Yocto Project Reference Manual.
  556. Much has been said about Poky being a "default configuration". A default
  557. configuration provides a starting image footprint. You can use Poky out
  558. of the box to create an image ranging from a shell-accessible minimal
  559. image all the way up to a Linux Standard Base-compliant image that uses
  560. a GNOME Mobile and Embedded (GMAE) based reference user interface called
  561. Sato.
  562. One of the most powerful properties of Poky is that every aspect of a
  563. build is controlled by the metadata. You can use metadata to augment
  564. these base image types by adding metadata :ref:`layers
  565. <overview-manual/yp-intro:the yocto project layer model>` that extend
  566. functionality.
  567. These layers can provide, for example, an additional software stack for
  568. an image type, add a board support package (BSP) for additional
  569. hardware, or even create a new image type.
  570. Metadata is loosely grouped into configuration files or package recipes.
  571. A recipe is a collection of non-executable metadata used by BitBake to
  572. set variables or define additional build-time tasks. A recipe contains
  573. fields such as the recipe description, the recipe version, the license
  574. of the package and the upstream source repository. A recipe might also
  575. indicate that the build process uses autotools, make, distutils or any
  576. other build process, in which case the basic functionality can be
  577. defined by the classes it inherits from the OE-Core layer's class
  578. definitions in ``./meta/classes``. Within a recipe you can also define
  579. additional tasks as well as task prerequisites. Recipe syntax through
  580. BitBake also supports both ``:prepend`` and ``:append`` operators as a
  581. method of extending task functionality. These operators inject code into
  582. the beginning or end of a task. For information on these BitBake
  583. operators, see the
  584. ":ref:`bitbake-user-manual/bitbake-user-manual-metadata:appending and prepending (override style syntax)`"
  585. section in the BitBake User's Manual.
  586. The OpenEmbedded Build System Workflow
  587. ======================================
  588. The :term:`OpenEmbedded Build System` uses a "workflow" to
  589. accomplish image and SDK generation. The following figure overviews that
  590. workflow:
  591. .. image:: figures/YP-flow-diagram.png
  592. :width: 100%
  593. Here is a brief summary of the "workflow":
  594. #. Developers specify architecture, policies, patches and configuration
  595. details.
  596. #. The build system fetches and downloads the source code from the
  597. specified location. The build system supports standard methods such
  598. as tarballs or source code repositories systems such as Git.
  599. #. Once source code is downloaded, the build system extracts the sources
  600. into a local work area where patches are applied and common steps for
  601. configuring and compiling the software are run.
  602. #. The build system then installs the software into a temporary staging
  603. area where the binary package format you select (DEB, RPM, or IPK) is
  604. used to roll up the software.
  605. #. Different QA and sanity checks run throughout entire build process.
  606. #. After the binaries are created, the build system generates a binary
  607. package feed that is used to create the final root file image.
  608. #. The build system generates the file system image and a customized
  609. Extensible SDK (eSDK) for application development in parallel.
  610. For a very detailed look at this workflow, see the
  611. ":ref:`overview-manual/concepts:openembedded build system concepts`" section.
  612. Some Basic Terms
  613. ================
  614. It helps to understand some basic fundamental terms when learning the
  615. Yocto Project. Although there is a list of terms in the ":doc:`Yocto Project
  616. Terms </ref-manual/terms>`" section of the Yocto Project
  617. Reference Manual, this section provides the definitions of some terms
  618. helpful for getting started:
  619. - *Configuration Files:* Files that hold global definitions of
  620. variables, user-defined variables, and hardware configuration
  621. information. These files tell the :term:`OpenEmbedded Build System`
  622. what to build and
  623. what to put into the image to support a particular platform.
  624. - *Extensible Software Development Kit (eSDK):* A custom SDK for
  625. application developers. This eSDK allows developers to incorporate
  626. their library and programming changes back into the image to make
  627. their code available to other application developers. For information
  628. on the eSDK, see the :doc:`/sdk-manual/index` manual.
  629. - *Layer:* A collection of related recipes. Layers allow you to
  630. consolidate related metadata to customize your build. Layers also
  631. isolate information used when building for multiple architectures.
  632. Layers are hierarchical in their ability to override previous
  633. specifications. You can include any number of available layers from
  634. the Yocto Project and customize the build by adding your own layers
  635. after them. You can search the Layer Index for layers used within
  636. Yocto Project.
  637. For more detailed information on layers, see the
  638. ":ref:`dev-manual/layers:understanding and creating layers`"
  639. section in the Yocto Project Development Tasks Manual. For a
  640. discussion specifically on BSP Layers, see the
  641. ":ref:`bsp-guide/bsp:bsp layers`" section in the Yocto
  642. Project Board Support Packages (BSP) Developer's Guide.
  643. - *Metadata:* A key element of the Yocto Project is the Metadata that
  644. is used to construct a Linux distribution and is contained in the
  645. files that the OpenEmbedded build system parses when building an
  646. image. In general, Metadata includes recipes, configuration files,
  647. and other information that refers to the build instructions
  648. themselves, as well as the data used to control what things get built
  649. and the effects of the build. Metadata also includes commands and
  650. data used to indicate what versions of software are used, from where
  651. they are obtained, and changes or additions to the software itself
  652. (patches or auxiliary files) that are used to fix bugs or customize
  653. the software for use in a particular situation. OpenEmbedded-Core is
  654. an important set of validated metadata.
  655. - *OpenEmbedded Build System:* The terms "BitBake" and "build system"
  656. are sometimes used for the OpenEmbedded Build System.
  657. BitBake is a task scheduler and execution engine that parses
  658. instructions (i.e. recipes) and configuration data. After a parsing
  659. phase, BitBake creates a dependency tree to order the compilation,
  660. schedules the compilation of the included code, and finally executes
  661. the building of the specified custom Linux image (distribution).
  662. BitBake is similar to the ``make`` tool.
  663. During a build process, the build system tracks dependencies and
  664. performs a native or cross-compilation of each package. As a first
  665. step in a cross-build setup, the framework attempts to create a
  666. cross-compiler toolchain (i.e. Extensible SDK) suited for the target
  667. platform.
  668. - *OpenEmbedded-Core (OE-Core):* OE-Core is metadata comprised of
  669. foundation recipes, classes, and associated files that are meant to
  670. be common among many different OpenEmbedded-derived systems,
  671. including the Yocto Project. OE-Core is a curated subset of an
  672. original repository developed by the OpenEmbedded community that has
  673. been pared down into a smaller, core set of continuously validated
  674. recipes. The result is a tightly controlled and quality-assured core
  675. set of recipes.
  676. You can see the Metadata in the ``meta`` directory of the Yocto
  677. Project :yocto_git:`Source Repositories <>`.
  678. - *Packages:* In the context of the Yocto Project, this term refers to
  679. a recipe's packaged output produced by BitBake (i.e. a "baked
  680. recipe"). A package is generally the compiled binaries produced from
  681. the recipe's sources. You "bake" something by running it through
  682. BitBake.
  683. It is worth noting that the term "package" can, in general, have
  684. subtle meanings. For example, the packages referred to in the
  685. ":ref:`ref-manual/system-requirements:required packages for the build host`"
  686. section in the Yocto Project Reference Manual are compiled binaries
  687. that, when installed, add functionality to your host Linux
  688. distribution.
  689. Another point worth noting is that historically within the Yocto
  690. Project, recipes were referred to as packages --- thus, the existence
  691. of several BitBake variables that are seemingly mis-named, (e.g.
  692. :term:`PR`,
  693. :term:`PV`, and
  694. :term:`PE`).
  695. - *Poky:* Poky is a reference embedded distribution and a reference
  696. test configuration. Poky provides the following:
  697. - A base-level functional distro used to illustrate how to customize
  698. a distribution.
  699. - A means by which to test the Yocto Project components (i.e. Poky
  700. is used to validate the Yocto Project).
  701. - A vehicle through which you can download the Yocto Project.
  702. Poky is not a product level distro. Rather, it is a good starting
  703. point for customization.
  704. .. note::
  705. Poky is an integration layer on top of OE-Core.
  706. - *Recipe:* The most common form of metadata. A recipe contains a list
  707. of settings and tasks (i.e. instructions) for building packages that
  708. are then used to build the binary image. A recipe describes where you
  709. get source code and which patches to apply. Recipes describe
  710. dependencies for libraries or for other recipes as well as
  711. configuration and compilation options. Related recipes are
  712. consolidated into a layer.