overview-manual-yp-intro.rst 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942
  1. .. SPDX-License-Identifier: CC-BY-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. :align: center
  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. .. _gs-features:
  31. Features
  32. --------
  33. The following list describes features and advantages of the Yocto
  34. Project:
  35. - *Widely Adopted Across the Industry:* Semiconductor, operating
  36. system, software, and service vendors exist whose products and
  37. services adopt and support the Yocto Project. For a look at the Yocto
  38. Project community and the companies involved with the Yocto Project,
  39. see the "COMMUNITY" and "ECOSYSTEM" tabs on the
  40. :yocto_home:`Yocto Project <>` home page.
  41. - *Architecture Agnostic:* Yocto Project supports Intel, ARM, MIPS,
  42. AMD, PPC and other architectures. Most ODMs, OSVs, and chip vendors
  43. create and supply BSPs that support their hardware. If you have
  44. custom silicon, you can create a BSP that supports that architecture.
  45. Aside from lots of architecture support, the Yocto Project fully
  46. supports a wide range of device emulation through 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, GTK+, Qt, Clutter, and SDL (among others) to create a rich
  68. user experience. For devices that do not have a display or where you
  69. want to use alternative UI frameworks, you can choose to not install
  70. 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 `layer
  83. infrastructure <#the-yocto-project-layer-model>`__ groups related
  84. functionality into separate bundles. You can incrementally add these
  85. 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. `shared-state cache <#shared-state-cache>`__ (sstate) scheme. Being
  92. 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/ref-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/dev-manual-common-tasks: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. .. _gs-challenges:
  115. Challenges
  116. ----------
  117. The following list presents challenges you might encounter when
  118. developing using the Yocto Project:
  119. - *Steep Learning Curve:* The Yocto Project has a steep learning curve
  120. and has many different ways to accomplish similar tasks. It can be
  121. difficult to choose how to proceed when varying methods exist by
  122. which to accomplish a given task.
  123. - *Understanding What Changes You Need to Make For Your Design Requires
  124. Some Research:* Beyond the simple tutorial stage, understanding what
  125. changes need to be made for your particular design can require a
  126. significant amount of research and investigation. For information
  127. that helps you transition from trying out the Yocto Project to using
  128. it for your project, see the ":ref:`what-i-wish-id-known:what i wish i'd known about yocto project`" and
  129. ":ref:`transitioning-to-a-custom-environment:transitioning to a custom environment for systems development`"
  130. documents on the Yocto Project website.
  131. - *Project Workflow Could Be Confusing:* The `Yocto Project
  132. workflow <#overview-development-environment>`__ could be confusing if
  133. you are used to traditional desktop and server software development.
  134. In a desktop development environment, mechanisms exist to easily pull
  135. and install new packages, which are typically pre-compiled binaries
  136. from servers accessible over the Internet. Using the Yocto Project,
  137. you must modify your configuration and rebuild to add additional
  138. packages.
  139. - *Working in a Cross-Build Environment Can Feel Unfamiliar:* When
  140. developing code to run on a target, compilation, execution, and
  141. testing done on the actual target can be faster than running a
  142. BitBake build on a development host and then deploying binaries to
  143. the target for test. While the Yocto Project does support development
  144. tools on the target, the additional step of integrating your changes
  145. back into the Yocto Project build environment would be required.
  146. Yocto Project supports an intermediate approach that involves making
  147. changes on the development system within the BitBake environment and
  148. then deploying only the updated packages to the target.
  149. The Yocto Project :term:`OpenEmbedded Build System`
  150. produces packages
  151. in standard formats (i.e. RPM, DEB, IPK, and TAR). You can deploy
  152. these packages into the running system on the target by using
  153. utilities on the target such as ``rpm`` or ``ipk``.
  154. - *Initial Build Times Can be Significant:* Long initial build times
  155. are unfortunately unavoidable due to the large number of packages
  156. initially built from scratch for a fully functioning Linux system.
  157. Once that initial build is completed, however, the shared-state
  158. (sstate) cache mechanism Yocto Project uses keeps the system from
  159. rebuilding packages that have not been "touched" since the last
  160. build. The sstate mechanism significantly reduces times for
  161. successive builds.
  162. The Yocto Project Layer Model
  163. =============================
  164. The Yocto Project's "Layer Model" is a development model for embedded
  165. and IoT Linux creation that distinguishes the Yocto Project from other
  166. simple build systems. The Layer Model simultaneously supports
  167. collaboration and customization. Layers are repositories that contain
  168. related sets of instructions that tell the :term:`OpenEmbedded Build System`
  169. what to do. You can
  170. collaborate, share, and reuse layers.
  171. Layers can contain changes to previous instructions or settings at any
  172. time. This powerful override capability is what allows you to customize
  173. previously supplied collaborative or community layers to suit your
  174. product requirements.
  175. You use different layers to logically separate information in your
  176. build. As an example, you could have BSP, GUI, distro configuration,
  177. middleware, or application layers. Putting your entire build into one
  178. layer limits and complicates future customization and reuse. Isolating
  179. information into layers, on the other hand, helps simplify future
  180. customizations and reuse. You might find it tempting to keep everything
  181. in one layer when working on a single project. However, the more modular
  182. your Metadata, the easier it is to cope with future changes.
  183. .. note::
  184. - Use Board Support Package (BSP) layers from silicon vendors when
  185. possible.
  186. - Familiarize yourself with the `Yocto Project curated layer
  187. index <https://caffelli-staging.yoctoproject.org/software-overview/layers/>`__
  188. or the `OpenEmbedded layer
  189. index <http://layers.openembedded.org/layerindex/branch/master/layers/>`__.
  190. The latter contains more layers but they are less universally
  191. validated.
  192. - Layers support the inclusion of technologies, hardware components,
  193. and software components. The :ref:`Yocto Project
  194. Compatible <dev-manual/dev-manual-common-tasks:making sure your layer is compatible with yocto project>`
  195. designation provides a minimum level of standardization that
  196. contributes to a strong ecosystem. "YP Compatible" is applied to
  197. appropriate products and software components such as BSPs, other
  198. OE-compatible layers, and related open-source projects, allowing
  199. the producer to use Yocto Project badges and branding assets.
  200. To illustrate how layers are used to keep things modular, consider
  201. machine customizations. These types of customizations typically reside
  202. in a special layer, rather than a general layer, called a BSP Layer.
  203. Furthermore, the machine customizations should be isolated from recipes
  204. and Metadata that support a new GUI environment, for example. This
  205. situation gives you a couple of layers: one for the machine
  206. configurations, and one for the GUI environment. It is important to
  207. understand, however, that the BSP layer can still make machine-specific
  208. additions to recipes within the GUI environment layer without polluting
  209. the GUI layer itself with those machine-specific changes. You can
  210. accomplish this through a recipe that is a BitBake append
  211. (``.bbappend``) file, which is described later in this section.
  212. .. note::
  213. For general information on BSP layer structure, see the
  214. Yocto Project Board Support Packages (BSP) Developer's Guide
  215. .
  216. The :term:`Source Directory`
  217. contains both general layers and BSP layers right out of the box. You
  218. can easily identify layers that ship with a Yocto Project release in the
  219. Source Directory by their names. Layers typically have names that begin
  220. with the string ``meta-``.
  221. .. note::
  222. It is not a requirement that a layer name begin with the prefix
  223. meta-
  224. , but it is a commonly accepted standard in the Yocto Project
  225. community.
  226. For example, if you were to examine the `tree
  227. view <https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/>`__ of the
  228. ``poky`` repository, you will see several layers: ``meta``,
  229. ``meta-skeleton``, ``meta-selftest``, ``meta-poky``, and
  230. ``meta-yocto-bsp``. Each of these repositories represents a distinct
  231. layer.
  232. For procedures on how to create layers, see the
  233. ":ref:`dev-manual/dev-manual-common-tasks:understanding and creating layers`"
  234. section in the Yocto Project Development Tasks Manual.
  235. Components and Tools
  236. ====================
  237. The Yocto Project employs a collection of components and tools used by
  238. the project itself, by project developers, and by those using the Yocto
  239. Project. These components and tools are open source projects and
  240. metadata that are separate from the reference distribution
  241. (:term:`Poky`) and the
  242. :term:`OpenEmbedded Build System`. Most of the
  243. components and tools are downloaded separately.
  244. This section provides brief overviews of the components and tools
  245. associated with the Yocto Project.
  246. .. _gs-development-tools:
  247. Development Tools
  248. -----------------
  249. The following list consists of tools that help you develop images and
  250. applications using the Yocto Project:
  251. - *CROPS:* `CROPS <https://github.com/crops/poky-container/>`__ is an
  252. open source, cross-platform development framework that leverages
  253. `Docker Containers <https://www.docker.com/>`__. CROPS provides an
  254. easily managed, extensible environment that allows you to build
  255. binaries for a variety of architectures on Windows, Linux and Mac OS
  256. X hosts.
  257. - *devtool:* This command-line tool is available as part of the
  258. extensible SDK (eSDK) and is its cornerstone. You can use ``devtool``
  259. to help build, test, and package software within the eSDK. You can
  260. use the tool to optionally integrate what you build into an image
  261. built by the OpenEmbedded build system.
  262. The ``devtool`` command employs a number of sub-commands that allow
  263. you to add, modify, and upgrade recipes. As with the OpenEmbedded
  264. build system, "recipes" represent software packages within
  265. ``devtool``. When you use ``devtool add``, a recipe is automatically
  266. created. When you use ``devtool modify``, the specified existing
  267. recipe is used in order to determine where to get the source code and
  268. how to patch it. In both cases, an environment is set up so that when
  269. you build the recipe a source tree that is under your control is used
  270. in order to allow you to make changes to the source as desired. By
  271. default, both new recipes and the source go into a "workspace"
  272. directory under the eSDK. The ``devtool upgrade`` command updates an
  273. existing recipe so that you can build it for an updated set of source
  274. files.
  275. You can read about the ``devtool`` workflow in the Yocto Project
  276. Application Development and Extensible Software Development Kit
  277. (eSDK) Manual in the
  278. ":ref:`sdk-manual/sdk-extensible:using \`\`devtool\`\` in your sdk workflow`"
  279. section.
  280. - *Extensible Software Development Kit (eSDK):* The eSDK provides a
  281. cross-development toolchain and libraries tailored to the contents of
  282. a specific image. The eSDK makes it easy to add new applications and
  283. libraries to an image, modify the source for an existing component,
  284. test changes on the target hardware, and integrate into the rest of
  285. the OpenEmbedded build system. The eSDK gives you a toolchain
  286. experience supplemented with the powerful set of ``devtool`` commands
  287. tailored for the Yocto Project environment.
  288. For information on the eSDK, see the :doc:`../sdk-manual/sdk-manual` Manual.
  289. - *Toaster:* Toaster is a web interface to the Yocto Project
  290. OpenEmbedded build system. Toaster allows you to configure, run, and
  291. view information about builds. For information on Toaster, see the
  292. :doc:`../toaster-manual/toaster-manual`.
  293. .. _gs-production-tools:
  294. Production Tools
  295. ----------------
  296. The following list consists of tools that help production related
  297. activities using the Yocto Project:
  298. - *Auto Upgrade Helper:* This utility when used in conjunction with the
  299. :term:`OpenEmbedded Build System`
  300. (BitBake and
  301. OE-Core) automatically generates upgrades for recipes that are based
  302. on new versions of the recipes published upstream. See
  303. :ref:`dev-manual/dev-manual-common-tasks:using the auto upgrade helper (auh)`
  304. for how to set it up.
  305. - *Recipe Reporting System:* The Recipe Reporting System tracks recipe
  306. versions available for Yocto Project. The main purpose of the system
  307. is to help you manage the recipes you maintain and to offer a dynamic
  308. overview of the project. The Recipe Reporting System is built on top
  309. of the `OpenEmbedded Layer
  310. Index <http://layers.openembedded.org/layerindex/layers/>`__, which
  311. is a website that indexes OpenEmbedded-Core layers.
  312. - *Patchwork:* `Patchwork <http://jk.ozlabs.org/projects/patchwork/>`__
  313. is a fork of a project originally started by
  314. `OzLabs <http://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 "master" branch of Poky.
  322. .. note::
  323. AutoBuilder is based on
  324. buildbot
  325. .
  326. A goal of the Yocto Project is to lead the open source industry with
  327. a project that automates testing and QA procedures. In doing so, the
  328. project encourages a development community that publishes QA and test
  329. plans, publicly demonstrates QA and test plans, and encourages
  330. development of tools that automate and test and QA procedures for the
  331. benefit of the development community.
  332. You can learn more about the AutoBuilder used by the Yocto Project
  333. Autobuilder :doc:`here <../test-manual/test-manual-understand-autobuilder>`.
  334. - *Cross-Prelink:* Prelinking is the process of pre-computing the load
  335. addresses and link tables generated by the dynamic linker as compared
  336. to doing this at runtime. Doing this ahead of time results in
  337. performance improvements when the application is launched and reduced
  338. memory usage for libraries shared by many applications.
  339. Historically, cross-prelink is a variant of prelink, which was
  340. conceived by `Jakub
  341. Jelínek <http://people.redhat.com/jakub/prelink.pdf>`__ a number of
  342. years ago. Both prelink and cross-prelink are maintained in the same
  343. repository albeit on separate branches. By providing an emulated
  344. runtime dynamic linker (i.e. ``glibc``-derived ``ld.so`` emulation),
  345. the cross-prelink project extends the prelink software's ability to
  346. prelink a sysroot environment. Additionally, the cross-prelink
  347. software enables the ability to work in sysroot style environments.
  348. The dynamic linker determines standard load address calculations
  349. based on a variety of factors such as mapping addresses, library
  350. usage, and library function conflicts. The prelink tool uses this
  351. information, from the dynamic linker, to determine unique load
  352. addresses for executable and linkable format (ELF) binaries that are
  353. shared libraries and dynamically linked. The prelink tool modifies
  354. these ELF binaries with the pre-computed information. The result is
  355. faster loading and often lower memory consumption because more of the
  356. library code can be re-used from shared Copy-On-Write (COW) pages.
  357. The original upstream prelink project only supports running prelink
  358. on the end target device due to the reliance on the target device's
  359. dynamic linker. This restriction causes issues when developing a
  360. cross-compiled system. The cross-prelink adds a synthesized dynamic
  361. loader that runs on the host, thus permitting cross-prelinking
  362. without ever having to run on a read-write target filesystem.
  363. - *Pseudo:* Pseudo is the Yocto Project implementation of
  364. `fakeroot <http://man.he.net/man1/fakeroot>`__, which is used to run
  365. commands in an environment that seemingly has root privileges.
  366. During a build, it can be necessary to perform operations that
  367. require system administrator privileges. For example, file ownership
  368. or permissions might need definition. Pseudo is a tool that you can
  369. either use directly or through the environment variable
  370. ``LD_PRELOAD``. Either method allows these operations to succeed as
  371. if system administrator privileges exist even when they do not.
  372. You can read more about Pseudo in the "`Fakeroot and
  373. Pseudo <#fakeroot-and-pseudo>`__" section.
  374. .. _gs-openembedded-build-system:
  375. Open-Embedded Build System Components
  376. -------------------------------------
  377. The following list consists of components associated with the
  378. :term:`OpenEmbedded Build System`:
  379. - *BitBake:* BitBake is a core component of the Yocto Project and is
  380. used by the OpenEmbedded build system to build images. While BitBake
  381. is key to the build system, BitBake is maintained separately from the
  382. Yocto Project.
  383. BitBake is a generic task execution engine that allows shell and
  384. Python tasks to be run efficiently and in parallel while working
  385. within complex inter-task dependency constraints. In short, BitBake
  386. is a build engine that works through recipes written in a specific
  387. format in order to perform sets of tasks.
  388. You can learn more about BitBake in the :doc:`BitBake User
  389. Manual <bitbake:index>`.
  390. - *OpenEmbedded-Core:* OpenEmbedded-Core (OE-Core) is a common layer of
  391. metadata (i.e. recipes, classes, and associated files) used by
  392. OpenEmbedded-derived systems, which includes the Yocto Project. The
  393. Yocto Project and the OpenEmbedded Project both maintain the
  394. OpenEmbedded-Core. You can find the OE-Core metadata in the Yocto
  395. Project :yocto_git:`Source Repositories </cgit/cgit.cgi/poky/tree/meta>`.
  396. Historically, the Yocto Project integrated the OE-Core metadata
  397. throughout the Yocto Project source repository reference system
  398. (Poky). After Yocto Project Version 1.0, the Yocto Project and
  399. OpenEmbedded agreed to work together and share a common core set of
  400. metadata (OE-Core), which contained much of the functionality
  401. previously found in Poky. This collaboration achieved a long-standing
  402. OpenEmbedded objective for having a more tightly controlled and
  403. quality-assured core. The results also fit well with the Yocto
  404. Project objective of achieving a smaller number of fully featured
  405. tools as compared to many different ones.
  406. Sharing a core set of metadata results in Poky as an integration
  407. layer on top of OE-Core. You can see that in this
  408. `figure <#yp-key-dev-elements>`__. The Yocto Project combines various
  409. components such as BitBake, OE-Core, script "glue", and documentation
  410. for its build system.
  411. .. _gs-reference-distribution-poky:
  412. Reference Distribution (Poky)
  413. -----------------------------
  414. Poky is the Yocto Project reference distribution. It contains the
  415. :term:`OpenEmbedded Build System`
  416. (BitBake and OE-Core) as well as a set of metadata to get you started
  417. building your own distribution. See the
  418. `figure <#what-is-the-yocto-project>`__ in "What is the Yocto Project?"
  419. section for an illustration that shows Poky and its relationship with
  420. other parts of the Yocto Project.
  421. To use the Yocto Project tools and components, you can download
  422. (``clone``) Poky and use it to bootstrap your own distribution.
  423. .. note::
  424. Poky does not contain binary files. It is a working example of how to
  425. build your own custom Linux distribution from source.
  426. You can read more about Poky in the "`Reference Embedded Distribution
  427. (Poky) <#reference-embedded-distribution>`__" section.
  428. .. _gs-packages-for-finished-targets:
  429. Packages for Finished Targets
  430. -----------------------------
  431. The following lists components associated with packages for finished
  432. targets:
  433. - *Matchbox:* Matchbox is an Open Source, base environment for the X
  434. Window System running on non-desktop, embedded platforms such as
  435. handhelds, set-top boxes, kiosks, and anything else for which screen
  436. space, input mechanisms, or system resources are limited.
  437. Matchbox consists of a number of interchangeable and optional
  438. applications that you can tailor to a specific, non-desktop platform
  439. to enhance usability in constrained environments.
  440. You can find the Matchbox source in the Yocto Project
  441. :yocto_git:`Source Repositories <>`.
  442. - *Opkg* Open PacKaGe management (opkg) is a lightweight package
  443. management system based on the itsy package (ipkg) management system.
  444. Opkg is written in C and resembles Advanced Package Tool (APT) and
  445. Debian Package (dpkg) in operation.
  446. Opkg is intended for use on embedded Linux devices and is used in
  447. this capacity in the
  448. `OpenEmbedded <http://www.openembedded.org/wiki/Main_Page>`__ and
  449. `OpenWrt <https://openwrt.org/>`__ projects, as well as the Yocto
  450. Project.
  451. .. note::
  452. As best it can, opkg maintains backwards compatibility with ipkg
  453. and conforms to a subset of Debian's policy manual regarding
  454. control files.
  455. .. _gs-archived-components:
  456. Archived Components
  457. -------------------
  458. The Build Appliance is a virtual machine image that enables you to build
  459. and boot a custom embedded Linux image with the Yocto Project using a
  460. non-Linux development system.
  461. Historically, the Build Appliance was the second of three methods by
  462. which you could use the Yocto Project on a system that was not native to
  463. Linux.
  464. 1. *Hob:* Hob, which is now deprecated and is no longer available since
  465. the 2.1 release of the Yocto Project provided a rudimentary,
  466. GUI-based interface to the Yocto Project. Toaster has fully replaced
  467. Hob.
  468. 2. *Build Appliance:* Post Hob, the Build Appliance became available. It
  469. was never recommended that you use the Build Appliance as a
  470. day-to-day production development environment with the Yocto Project.
  471. Build Appliance was useful as a way to try out development in the
  472. Yocto Project environment.
  473. 3. *CROPS:* The final and best solution available now for developing
  474. using the Yocto Project on a system not native to Linux is with
  475. `CROPS <#gs-crops-overview>`__.
  476. .. _gs-development-methods:
  477. Development Methods
  478. ===================
  479. The Yocto Project development environment usually involves a
  480. :term:`Build Host` and target
  481. hardware. You use the Build Host to build images and develop
  482. applications, while you use the target hardware to test deployed
  483. software.
  484. This section provides an introduction to the choices or development
  485. methods you have when setting up your Build Host. Depending on the your
  486. particular workflow preference and the type of operating system your
  487. Build Host runs, several choices exist that allow you to use the Yocto
  488. Project.
  489. .. note::
  490. For additional detail about the Yocto Project development
  491. environment, see the "
  492. The Yocto Project Development Environment
  493. " chapter.
  494. - *Native Linux Host:* By far the best option for a Build Host. A
  495. system running Linux as its native operating system allows you to
  496. develop software by directly using the
  497. :term:`BitBake` tool. You can
  498. accomplish all aspects of development from a familiar shell of a
  499. supported Linux distribution.
  500. For information on how to set up a Build Host on a system running
  501. Linux as its native operating system, see the
  502. ":ref:`dev-manual/dev-manual-start:setting up a native linux host`"
  503. section in the Yocto Project Development Tasks Manual.
  504. - *CROss PlatformS (CROPS):* Typically, you use
  505. `CROPS <https://github.com/crops/poky-container/>`__, which leverages
  506. `Docker Containers <https://www.docker.com/>`__, to set up a Build
  507. Host that is not running Linux (e.g. Microsoft Windows or macOS).
  508. .. note::
  509. You can, however, use CROPS on a Linux-based system.
  510. CROPS is an open source, cross-platform development framework that
  511. provides an easily managed, extensible environment for building
  512. binaries targeted for a variety of architectures on Windows, macOS,
  513. or Linux hosts. Once the Build Host is set up using CROPS, you can
  514. prepare a shell environment to mimic that of a shell being used on a
  515. system natively running Linux.
  516. For information on how to set up a Build Host with CROPS, see the
  517. ":ref:`dev-manual/dev-manual-start:setting up to use cross platforms (crops)`"
  518. section in the Yocto Project Development Tasks Manual.
  519. - *Windows Subsystem For Linux (WSLv2):* You may use Windows Subsystem
  520. For Linux v2 to set up a build host using Windows 10.
  521. .. note::
  522. The Yocto Project is not compatible with WSLv1, it is compatible
  523. but not officially supported nor validated with WSLv2, if you
  524. still decide to use WSL please upgrade to WSLv2.
  525. The Windows Subsystem For Linux allows Windows 10 to run a real Linux
  526. kernel inside of a lightweight utility virtual machine (VM) using
  527. virtualization technology.
  528. For information on how to set up a Build Host with WSLv2, see the
  529. ":ref:dev-manual/dev-manual-start:setting up to use windows subsystem for linux (wslv2)`"
  530. section in the Yocto Project Development Tasks Manual.
  531. - *Toaster:* Regardless of what your Build Host is running, you can use
  532. Toaster to develop software using the Yocto Project. Toaster is a web
  533. interface to the Yocto Project's :term:`OpenEmbedded Build System`.
  534. The interface
  535. enables you to configure and run your builds. Information about
  536. builds is collected and stored in a database. You can use Toaster to
  537. configure and start builds on multiple remote build servers.
  538. For information about and how to use Toaster, see the
  539. :doc:`../toaster-manual/toaster-manual`.
  540. .. _reference-embedded-distribution:
  541. Reference Embedded Distribution (Poky)
  542. ======================================
  543. "Poky", which is pronounced *Pock*-ee, is the name of the Yocto
  544. Project's reference distribution or Reference OS Kit. Poky contains the
  545. :term:`OpenEmbedded Build System`
  546. (:term:`BitBake` and
  547. :term:`OpenEmbedded-Core (OE-Core)`) as well as a set
  548. of :term:`Metadata` to get you started
  549. building your own distro. In other words, Poky is a base specification
  550. of the functionality needed for a typical embedded system as well as the
  551. components from the Yocto Project that allow you to build a distribution
  552. into a usable binary image.
  553. Poky is a combined repository of BitBake, OpenEmbedded-Core (which is
  554. found in ``meta``), ``meta-poky``, ``meta-yocto-bsp``, and documentation
  555. provided all together and known to work well together. You can view
  556. these items that make up the Poky repository in the
  557. :yocto_git:`Source Repositories </cgit/cgit.cgi/poky/tree/>`.
  558. .. note::
  559. If you are interested in all the contents of the
  560. poky
  561. Git repository, see the "
  562. Top-Level Core Components
  563. " section in the Yocto Project Reference Manual.
  564. The following figure illustrates what generally comprises Poky:
  565. .. image:: figures/poky-reference-distribution.png
  566. :align: center
  567. - BitBake is a task executor and scheduler that is the heart of the
  568. OpenEmbedded build system.
  569. - ``meta-poky``, which is Poky-specific metadata.
  570. - ``meta-yocto-bsp``, which are Yocto Project-specific Board Support
  571. Packages (BSPs).
  572. - OpenEmbedded-Core (OE-Core) metadata, which includes shared
  573. configurations, global variable definitions, shared classes,
  574. packaging, and recipes. Classes define the encapsulation and
  575. inheritance of build logic. Recipes are the logical units of software
  576. and images to be built.
  577. - Documentation, which contains the Yocto Project source files used to
  578. make the set of user manuals.
  579. .. note::
  580. While Poky is a "complete" distribution specification and is tested
  581. and put through QA, you cannot use it as a product "out of the box"
  582. in its current form.
  583. To use the Yocto Project tools, you can use Git to clone (download) the
  584. Poky repository then use your local copy of the reference distribution
  585. to bootstrap your own distribution.
  586. .. note::
  587. Poky does not contain binary files. It is a working example of how to
  588. build your own custom Linux distribution from source.
  589. Poky has a regular, well established, six-month release cycle under its
  590. own version. Major releases occur at the same time major releases (point
  591. releases) occur for the Yocto Project, which are typically in the Spring
  592. and Fall. For more information on the Yocto Project release schedule and
  593. cadence, see the ":doc:`../ref-manual/ref-release-process`" chapter in the
  594. Yocto Project Reference Manual.
  595. Much has been said about Poky being a "default configuration." A default
  596. configuration provides a starting image footprint. You can use Poky out
  597. of the box to create an image ranging from a shell-accessible minimal
  598. image all the way up to a Linux Standard Base-compliant image that uses
  599. a GNOME Mobile and Embedded (GMAE) based reference user interface called
  600. Sato.
  601. One of the most powerful properties of Poky is that every aspect of a
  602. build is controlled by the metadata. You can use metadata to augment
  603. these base image types by adding metadata
  604. `layers <#the-yocto-project-layer-model>`__ that extend functionality.
  605. These layers can provide, for example, an additional software stack for
  606. an image type, add a board support package (BSP) for additional
  607. hardware, or even create a new image type.
  608. Metadata is loosely grouped into configuration files or package recipes.
  609. A recipe is a collection of non-executable metadata used by BitBake to
  610. set variables or define additional build-time tasks. A recipe contains
  611. fields such as the recipe description, the recipe version, the license
  612. of the package and the upstream source repository. A recipe might also
  613. indicate that the build process uses autotools, make, distutils or any
  614. other build process, in which case the basic functionality can be
  615. defined by the classes it inherits from the OE-Core layer's class
  616. definitions in ``./meta/classes``. Within a recipe you can also define
  617. additional tasks as well as task prerequisites. Recipe syntax through
  618. BitBake also supports both ``_prepend`` and ``_append`` operators as a
  619. method of extending task functionality. These operators inject code into
  620. the beginning or end of a task. For information on these BitBake
  621. operators, see the
  622. ":ref:`bitbake:bitbake-user-manual/bitbake-user-manual-metadata:appending and prepending (override style syntax)`"
  623. section in the BitBake User's Manual.
  624. .. _openembedded-build-system-workflow:
  625. The OpenEmbedded Build System Workflow
  626. ======================================
  627. The :term:`OpenEmbedded Build System` uses a "workflow" to
  628. accomplish image and SDK generation. The following figure overviews that
  629. workflow:
  630. .. image:: figures/YP-flow-diagram.png
  631. :align: center
  632. Following is a brief summary of the "workflow":
  633. 1. Developers specify architecture, policies, patches and configuration
  634. details.
  635. 2. The build system fetches and downloads the source code from the
  636. specified location. The build system supports standard methods such
  637. as tarballs or source code repositories systems such as Git.
  638. 3. Once source code is downloaded, the build system extracts the sources
  639. into a local work area where patches are applied and common steps for
  640. configuring and compiling the software are run.
  641. 4. The build system then installs the software into a temporary staging
  642. area where the binary package format you select (DEB, RPM, or IPK) is
  643. used to roll up the software.
  644. 5. Different QA and sanity checks run throughout entire build process.
  645. 6. After the binaries are created, the build system generates a binary
  646. package feed that is used to create the final root file image.
  647. 7. The build system generates the file system image and a customized
  648. Extensible SDK (eSDK) for application development in parallel.
  649. For a very detailed look at this workflow, see the "`OpenEmbedded Build
  650. System Concepts <#openembedded-build-system-build-concepts>`__" section.
  651. Some Basic Terms
  652. ================
  653. It helps to understand some basic fundamental terms when learning the
  654. Yocto Project. Although a list of terms exists in the ":doc:`Yocto Project
  655. Terms <../ref-manual/ref-terms>`" section of the Yocto Project
  656. Reference Manual, this section provides the definitions of some terms
  657. helpful for getting started:
  658. - *Configuration Files:* Files that hold global definitions of
  659. variables, user-defined variables, and hardware configuration
  660. information. These files tell the :term:`OpenEmbedded Build System`
  661. what to build and
  662. what to put into the image to support a particular platform.
  663. - *Extensible Software Development Kit (eSDK):* A custom SDK for
  664. application developers. This eSDK allows developers to incorporate
  665. their library and programming changes back into the image to make
  666. their code available to other application developers. For information
  667. on the eSDK, see the :doc:`../sdk-manual/sdk-manual` manual.
  668. - *Layer:* A collection of related recipes. Layers allow you to
  669. consolidate related metadata to customize your build. Layers also
  670. isolate information used when building for multiple architectures.
  671. Layers are hierarchical in their ability to override previous
  672. specifications. You can include any number of available layers from
  673. the Yocto Project and customize the build by adding your layers after
  674. them. You can search the Layer Index for layers used within Yocto
  675. Project.
  676. For more detailed information on layers, see the
  677. ":ref:`dev-manual/dev-manual-common-tasks:understanding and creating layers`"
  678. section in the Yocto Project Development Tasks Manual. For a
  679. discussion specifically on BSP Layers, see the
  680. ":ref:`bsp-guide/bsp:bsp layers`" section in the Yocto
  681. Project Board Support Packages (BSP) Developer's Guide.
  682. - *Metadata:* A key element of the Yocto Project is the Metadata that
  683. is used to construct a Linux distribution and is contained in the
  684. files that the OpenEmbedded build system parses when building an
  685. image. In general, Metadata includes recipes, configuration files,
  686. and other information that refers to the build instructions
  687. themselves, as well as the data used to control what things get built
  688. and the effects of the build. Metadata also includes commands and
  689. data used to indicate what versions of software are used, from where
  690. they are obtained, and changes or additions to the software itself
  691. (patches or auxiliary files) that are used to fix bugs or customize
  692. the software for use in a particular situation. OpenEmbedded-Core is
  693. an important set of validated metadata.
  694. - *OpenEmbedded Build System:* The terms "BitBake" and "build system"
  695. are sometimes used for the OpenEmbedded Build System.
  696. BitBake is a task scheduler and execution engine that parses
  697. instructions (i.e. recipes) and configuration data. After a parsing
  698. phase, BitBake creates a dependency tree to order the compilation,
  699. schedules the compilation of the included code, and finally executes
  700. the building of the specified custom Linux image (distribution).
  701. BitBake is similar to the ``make`` tool.
  702. During a build process, the build system tracks dependencies and
  703. performs a native or cross-compilation of the package. As a first
  704. step in a cross-build setup, the framework attempts to create a
  705. cross-compiler toolchain (i.e. Extensible SDK) suited for the target
  706. platform.
  707. - *OpenEmbedded-Core (OE-Core):* OE-Core is metadata comprised of
  708. foundation recipes, classes, and associated files that are meant to
  709. be common among many different OpenEmbedded-derived systems,
  710. including the Yocto Project. OE-Core is a curated subset of an
  711. original repository developed by the OpenEmbedded community that has
  712. been pared down into a smaller, core set of continuously validated
  713. recipes. The result is a tightly controlled and quality-assured core
  714. set of recipes.
  715. You can see the Metadata in the ``meta`` directory of the Yocto
  716. Project `Source
  717. Repositories <http://git.yoctoproject.org/cgit/cgit.cgi>`__.
  718. - *Packages:* In the context of the Yocto Project, this term refers to
  719. a recipe's packaged output produced by BitBake (i.e. a "baked
  720. recipe"). A package is generally the compiled binaries produced from
  721. the recipe's sources. You "bake" something by running it through
  722. BitBake.
  723. It is worth noting that the term "package" can, in general, have
  724. subtle meanings. For example, the packages referred to in the
  725. ":ref:`ref-manual/ref-system-requirements:required packages for the build host`"
  726. section in the Yocto Project Reference Manual are compiled binaries
  727. that, when installed, add functionality to your Linux distribution.
  728. Another point worth noting is that historically within the Yocto
  729. Project, recipes were referred to as packages - thus, the existence
  730. of several BitBake variables that are seemingly mis-named, (e.g.
  731. :term:`PR`,
  732. :term:`PV`, and
  733. :term:`PE`).
  734. - *Poky:* Poky is a reference embedded distribution and a reference
  735. test configuration. Poky provides the following:
  736. - A base-level functional distro used to illustrate how to customize
  737. a distribution.
  738. - A means by which to test the Yocto Project components (i.e. Poky
  739. is used to validate the Yocto Project).
  740. - A vehicle through which you can download the Yocto Project.
  741. Poky is not a product level distro. Rather, it is a good starting
  742. point for customization.
  743. .. note::
  744. Poky is an integration layer on top of OE-Core.
  745. - *Recipe:* The most common form of metadata. A recipe contains a list
  746. of settings and tasks (i.e. instructions) for building packages that
  747. are then used to build the binary image. A recipe describes where you
  748. get source code and which patches to apply. Recipes describe
  749. dependencies for libraries or for other recipes as well as
  750. configuration and compilation options. Related recipes are
  751. consolidated into a layer.