yp-intro.rst 41 KB

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