dev-manual-start.xml 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288
  1. <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  2. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
  3. [<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
  4. <!--SPDX-License-Identifier: CC-BY-2.0-UK-->
  5. <chapter id='dev-manual-start'>
  6. <title>Setting Up to Use the Yocto Project</title>
  7. <para>
  8. This chapter provides guidance on how to prepare to use the
  9. Yocto Project.
  10. You can learn about creating a team environment that develops using the
  11. Yocto Project, how to set up a
  12. <ulink url='&YOCTO_DOCS_REF_URL;#hardware-build-system-term'>build host</ulink>,
  13. how to locate Yocto Project source repositories, and how to create local
  14. Git repositories.
  15. </para>
  16. <section id="usingpoky-changes-collaborate">
  17. <title>Creating a Team Development Environment</title>
  18. <para>
  19. It might not be immediately clear how you can use the Yocto
  20. Project in a team development environment, or how to scale it for a
  21. large team of developers.
  22. You can adapt the Yocto Project to many different use cases and
  23. scenarios;
  24. however, this flexibility could cause difficulties if you are trying
  25. to create a working setup that scales effectively.
  26. </para>
  27. <para>
  28. To help you understand how to set up this type of environment,
  29. this section presents a procedure that gives you information
  30. that can help you get the results you want.
  31. The procedure is high-level and presents some of the project's most
  32. successful experiences, practices, solutions, and available
  33. technologies that have proved to work well in the past;
  34. however, keep in mind, the procedure here is simply a starting point.
  35. You can build off these steps and customize the procedure to fit any
  36. particular working environment and set of practices.
  37. <orderedlist>
  38. <listitem><para>
  39. <emphasis>Determine Who is Going to be Developing:</emphasis>
  40. You first need to understand who is going to be doing anything
  41. related to the Yocto Project and determine their roles.
  42. Making this determination is essential to completing
  43. subsequent steps, which are to get your equipment together
  44. and set up your development environment's hardware topology.
  45. </para>
  46. <para>The following roles exist:
  47. <itemizedlist>
  48. <listitem><para>
  49. <emphasis>Application Developer:</emphasis>
  50. This type of developer does application level work
  51. on top of an existing software stack.
  52. </para></listitem>
  53. <listitem><para>
  54. <emphasis>Core System Developer:</emphasis>
  55. This type of developer works on the contents of the
  56. operating system image itself.
  57. </para></listitem>
  58. <listitem><para>
  59. <emphasis>Build Engineer:</emphasis>
  60. This type of developer manages Autobuilders and
  61. releases. Depending on the specifics of the environment,
  62. not all situations might need a Build Engineer.
  63. </para></listitem>
  64. <listitem><para>
  65. <emphasis>Test Engineer:</emphasis>
  66. This type of developer creates and manages automated
  67. tests that are used to ensure all application and
  68. core system development meets desired quality
  69. standards.
  70. </para></listitem>
  71. </itemizedlist>
  72. </para></listitem>
  73. <listitem><para>
  74. <emphasis>Gather the Hardware:</emphasis>
  75. Based on the size and make-up of the team, get the hardware
  76. together.
  77. Ideally, any development, build, or test engineer uses
  78. a system that runs a supported Linux distribution.
  79. These systems, in general, should be high performance
  80. (e.g. dual, six-core Xeons with 24 Gbytes of RAM and plenty
  81. of disk space).
  82. You can help ensure efficiency by having any machines used
  83. for testing or that run Autobuilders be as high performance
  84. as possible.
  85. <note>
  86. Given sufficient processing power, you might also consider
  87. building Yocto Project development containers to be run
  88. under Docker, which is described later.
  89. </note>
  90. </para></listitem>
  91. <listitem><para>
  92. <emphasis>Understand the Hardware Topology of the Environment:</emphasis>
  93. Once you understand the hardware involved and the make-up
  94. of the team, you can understand the hardware topology of the
  95. development environment.
  96. You can get a visual idea of the machines and their roles
  97. across the development environment.
  98. <!--
  99. The following figure shows a moderately sized Yocto Project
  100. development environment.
  101. <para role="writernotes">
  102. Need figure.</para>
  103. -->
  104. </para></listitem>
  105. <listitem><para>
  106. <emphasis>Use Git as Your Source Control Manager (SCM):</emphasis>
  107. Keeping your
  108. <ulink url='&YOCTO_DOCS_REF_URL;#metadata'>Metadata</ulink>
  109. (i.e. recipes, configuration files, classes, and so forth)
  110. and any software you are developing under the control of an SCM
  111. system that is compatible with the OpenEmbedded build system
  112. is advisable.
  113. Of all of the SCMs supported by BitBake, the Yocto Project team strongly
  114. recommends using
  115. <ulink url='&YOCTO_DOCS_OM_URL;#git'>Git</ulink>.
  116. Git is a distributed system that is easy to back up,
  117. allows you to work remotely, and then connects back to the
  118. infrastructure.
  119. <note>
  120. For information about BitBake, see the
  121. <ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
  122. </note></para>
  123. <para>It is relatively easy to set up Git services and create
  124. infrastructure like
  125. <ulink url='&YOCTO_GIT_URL;'>http://git.yoctoproject.org</ulink>,
  126. which is based on server software called
  127. <filename>gitolite</filename> with <filename>cgit</filename>
  128. being used to generate the web interface that lets you view the
  129. repositories.
  130. The <filename>gitolite</filename> software identifies users
  131. using SSH keys and allows branch-based access controls to
  132. repositories that you can control as little or as much as
  133. necessary.
  134. <note>
  135. The setup of these services is beyond the scope of this
  136. manual.
  137. However, sites such as the following exist that describe
  138. how to perform setup:
  139. <itemizedlist>
  140. <listitem><para>
  141. <ulink url='http://git-scm.com/book/ch4-8.html'>Git documentation</ulink>:
  142. Describes how to install
  143. <filename>gitolite</filename> on the server.
  144. </para></listitem>
  145. <listitem><para>
  146. <ulink url='http://gitolite.com'>Gitolite</ulink>:
  147. Information for <filename>gitolite</filename>.
  148. </para></listitem>
  149. <listitem><para>
  150. <ulink url='https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools'>Interfaces, frontends, and tools</ulink>:
  151. Documentation on how to create interfaces and
  152. frontends for Git.
  153. </para></listitem>
  154. </itemizedlist>
  155. </note>
  156. </para></listitem>
  157. <listitem><para>
  158. <emphasis>Set up the Application Development Machines:</emphasis>
  159. As mentioned earlier, application developers are creating
  160. applications on top of existing software stacks.
  161. Following are some best practices for setting up machines
  162. used for application development:
  163. <itemizedlist>
  164. <listitem><para>
  165. Use a pre-built toolchain that contains the software
  166. stack itself.
  167. Then, develop the application code on top of the
  168. stack.
  169. This method works well for small numbers of relatively
  170. isolated applications.
  171. </para></listitem>
  172. <listitem><para>
  173. Keep your cross-development toolchains updated.
  174. You can do this through provisioning either as new
  175. toolchain downloads or as updates through a package
  176. update mechanism using <filename>opkg</filename>
  177. to provide updates to an existing toolchain.
  178. The exact mechanics of how and when to do this depend
  179. on local policy.
  180. </para></listitem>
  181. <listitem><para>
  182. Use multiple toolchains installed locally into
  183. different locations to allow development across
  184. versions.
  185. </para></listitem>
  186. </itemizedlist>
  187. </para></listitem>
  188. <listitem><para>
  189. <emphasis>Set up the Core Development Machines:</emphasis>
  190. As mentioned earlier, core developers work on the contents of
  191. the operating system itself.
  192. Following are some best practices for setting up machines
  193. used for developing images:
  194. <itemizedlist>
  195. <listitem><para>
  196. Have the
  197. <ulink url='&YOCTO_DOCS_REF_URL;#build-system-term'>OpenEmbedded build system</ulink>
  198. available on the developer workstations so developers
  199. can run their own builds and directly rebuild the
  200. software stack.
  201. </para></listitem>
  202. <listitem><para>
  203. Keep the core system unchanged as much as
  204. possible and do your work in layers on top of the
  205. core system.
  206. Doing so gives you a greater level of portability when
  207. upgrading to new versions of the core system or Board
  208. Support Packages (BSPs).
  209. </para></listitem>
  210. <listitem><para>
  211. Share layers amongst the developers of a
  212. particular project and contain the policy configuration
  213. that defines the project.
  214. </para></listitem>
  215. </itemizedlist>
  216. </para></listitem>
  217. <listitem><para>
  218. <emphasis>Set up an Autobuilder:</emphasis>
  219. Autobuilders are often the core of the development
  220. environment.
  221. It is here that changes from individual developers are brought
  222. together and centrally tested.
  223. Based on this automated build and test environment, subsequent
  224. decisions about releases can be made.
  225. Autobuilders also allow for "continuous integration" style
  226. testing of software components and regression identification
  227. and tracking.</para>
  228. <para>See "<ulink url='http://autobuilder.yoctoproject.org'>Yocto Project Autobuilder</ulink>"
  229. for more information and links to buildbot.
  230. The Yocto Project team has found this implementation
  231. works well in this role.
  232. A public example of this is the Yocto Project
  233. Autobuilders, which the Yocto Project team uses to test the
  234. overall health of the project.</para>
  235. <para>The features of this system are:
  236. <itemizedlist>
  237. <listitem><para>
  238. Highlights when commits break the build.
  239. </para></listitem>
  240. <listitem><para>
  241. Populates an
  242. <ulink url='&YOCTO_DOCS_OM_URL;#shared-state-cache'>sstate cache</ulink>
  243. from which developers can pull rather than requiring
  244. local builds.
  245. </para></listitem>
  246. <listitem><para>
  247. Allows commit hook triggers, which trigger builds when
  248. commits are made.
  249. </para></listitem>
  250. <listitem><para>
  251. Allows triggering of automated image booting
  252. and testing under the QuickEMUlator (QEMU).
  253. </para></listitem>
  254. <listitem><para>
  255. Supports incremental build testing and
  256. from-scratch builds.
  257. </para></listitem>
  258. <listitem><para>
  259. Shares output that allows developer
  260. testing and historical regression investigation.
  261. </para></listitem>
  262. <listitem><para>
  263. Creates output that can be used for releases.
  264. </para></listitem>
  265. <listitem><para>
  266. Allows scheduling of builds so that resources
  267. can be used efficiently.
  268. </para></listitem>
  269. </itemizedlist>
  270. </para></listitem>
  271. <listitem><para>
  272. <emphasis>Set up Test Machines:</emphasis>
  273. Use a small number of shared, high performance systems
  274. for testing purposes.
  275. Developers can use these systems for wider, more
  276. extensive testing while they continue to develop
  277. locally using their primary development system.
  278. </para></listitem>
  279. <listitem><para>
  280. <emphasis>Document Policies and Change Flow:</emphasis>
  281. The Yocto Project uses a hierarchical structure and a
  282. pull model.
  283. Scripts exist to create and send pull requests
  284. (i.e. <filename>create-pull-request</filename> and
  285. <filename>send-pull-request</filename>).
  286. This model is in line with other open source projects where
  287. maintainers are responsible for specific areas of the project
  288. and a single maintainer handles the final "top-of-tree" merges.
  289. <note>
  290. You can also use a more collective push model.
  291. The <filename>gitolite</filename> software supports both the
  292. push and pull models quite easily.
  293. </note></para>
  294. <para>As with any development environment, it is important
  295. to document the policy used as well as any main project
  296. guidelines so they are understood by everyone.
  297. It is also a good idea to have well-structured
  298. commit messages, which are usually a part of a project's
  299. guidelines.
  300. Good commit messages are essential when looking back in time and
  301. trying to understand why changes were made.</para>
  302. <para>If you discover that changes are needed to the core
  303. layer of the project, it is worth sharing those with the
  304. community as soon as possible.
  305. Chances are if you have discovered the need for changes,
  306. someone else in the community needs them also.
  307. </para></listitem>
  308. <listitem><para>
  309. <emphasis>Development Environment Summary:</emphasis>
  310. Aside from the previous steps, some best practices exist
  311. within the Yocto Project development environment.
  312. Consider the following:
  313. <itemizedlist>
  314. <listitem><para>
  315. Use
  316. <ulink url='&YOCTO_DOCS_OM_URL;#git'>Git</ulink>
  317. as the source control system.
  318. </para></listitem>
  319. <listitem><para>
  320. Maintain your Metadata in layers that make sense
  321. for your situation.
  322. See the
  323. "<ulink url='&YOCTO_DOCS_OM_URL;#the-yocto-project-layer-model'>The Yocto Project Layer Model</ulink>"
  324. section in the Yocto Project Overview and Concepts
  325. Manual and the
  326. "<link linkend='understanding-and-creating-layers'>Understanding and Creating Layers</link>"
  327. section for more information on layers.
  328. </para></listitem>
  329. <listitem><para>
  330. Separate the project's Metadata and code by using
  331. separate Git repositories.
  332. See the
  333. "<ulink url='&YOCTO_DOCS_OM_URL;#yocto-project-repositories'>Yocto Project Source Repositories</ulink>"
  334. section in the Yocto Project Overview and Concepts
  335. Manual for information on these repositories.
  336. See the
  337. "<link linkend='locating-yocto-project-source-files'>Locating Yocto Project Source Files</link>"
  338. section for information on how to set up local Git
  339. repositories for related upstream Yocto Project
  340. Git repositories.
  341. </para></listitem>
  342. <listitem><para>
  343. Set up the directory for the shared state cache
  344. (<ulink url='&YOCTO_DOCS_REF_URL;#var-SSTATE_DIR'><filename>SSTATE_DIR</filename></ulink>)
  345. where it makes sense.
  346. For example, set up the sstate cache on a system used
  347. by developers in the same organization and share the
  348. same source directories on their machines.
  349. </para></listitem>
  350. <listitem><para>
  351. Set up an Autobuilder and have it populate the
  352. sstate cache and source directories.
  353. </para></listitem>
  354. <listitem><para>
  355. The Yocto Project community encourages you
  356. to send patches to the project to fix bugs or add
  357. features.
  358. If you do submit patches, follow the project commit
  359. guidelines for writing good commit messages.
  360. See the "<link linkend='how-to-submit-a-change'>Submitting a Change to the Yocto Project</link>"
  361. section.
  362. </para></listitem>
  363. <listitem><para>
  364. Send changes to the core sooner than later
  365. as others are likely to run into the same issues.
  366. For some guidance on mailing lists to use, see the list
  367. in the
  368. "<link linkend='how-to-submit-a-change'>Submitting a Change to the Yocto Project</link>"
  369. section.
  370. For a description of the available mailing lists, see
  371. the
  372. "<ulink url='&YOCTO_DOCS_REF_URL;#resources-mailinglist'>Mailing Lists</ulink>"
  373. section in the Yocto Project Reference Manual.
  374. </para></listitem>
  375. </itemizedlist>
  376. </para></listitem>
  377. </orderedlist>
  378. </para>
  379. </section>
  380. <section id='dev-preparing-the-build-host'>
  381. <title>Preparing the Build Host</title>
  382. <para>
  383. This section provides procedures to set up a system to be used as your
  384. <ulink url='&YOCTO_DOCS_REF_URL;#hardware-build-system-term'>build host</ulink>
  385. for development using the Yocto Project.
  386. Your build host can be a native Linux machine (recommended), it can
  387. be a machine (Linux, Mac, or Windows) that uses
  388. <ulink url='https://github.com/crops/poky-container'>CROPS</ulink>,
  389. which leverages
  390. <ulink url='https://www.docker.com/'>Docker Containers</ulink> or it can
  391. be a Windows machine capable of running Windows Subsystem For Linux v2 (WSL).
  392. <note>
  393. The Yocto Project is not compatible with
  394. <ulink url='https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux'>Windows Subsystem for Linux v1</ulink>.
  395. It is compatible but not officially supported nor validated with WSLv2.
  396. If you still decide to use WSL please upgrade to
  397. <ulink url='https://docs.microsoft.com/en-us/windows/wsl/wsl2-install'>WSLv2</ulink>.
  398. </note>
  399. </para>
  400. <para>
  401. Once your build host is set up to use the Yocto Project,
  402. further steps are necessary depending on what you want to
  403. accomplish.
  404. See the following references for information on how to prepare for
  405. Board Support Package (BSP) development and kernel development:
  406. <itemizedlist>
  407. <listitem><para>
  408. <emphasis>BSP Development:</emphasis>
  409. See the
  410. "<ulink url='&YOCTO_DOCS_BSP_URL;#preparing-your-build-host-to-work-with-bsp-layers'>Preparing Your Build Host to Work With BSP Layers</ulink>"
  411. section in the Yocto Project Board Support Package (BSP)
  412. Developer's Guide.
  413. </para></listitem>
  414. <listitem><para>
  415. <emphasis>Kernel Development:</emphasis>
  416. See the
  417. "<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#preparing-the-build-host-to-work-on-the-kernel'>Preparing the Build Host to Work on the Kernel</ulink>"
  418. section in the Yocto Project Linux Kernel Development Manual.
  419. </para></listitem>
  420. </itemizedlist>
  421. </para>
  422. <section id='setting-up-a-native-linux-host'>
  423. <title>Setting Up a Native Linux Host</title>
  424. <para>
  425. Follow these steps to prepare a native Linux machine as your
  426. Yocto Project Build Host:
  427. <orderedlist>
  428. <listitem><para>
  429. <emphasis>Use a Supported Linux Distribution:</emphasis>
  430. You should have a reasonably current Linux-based host
  431. system.
  432. You will have the best results with a recent release of
  433. Fedora, openSUSE, Debian, Ubuntu, RHEL or CentOS as these
  434. releases are frequently tested against the Yocto Project
  435. and officially supported.
  436. For a list of the distributions under validation and their
  437. status, see the
  438. "<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>" section
  439. in the Yocto Project Reference Manual and the wiki page at
  440. <ulink url='&YOCTO_WIKI_URL;/wiki/Distribution_Support'>Distribution Support</ulink>.
  441. </para></listitem>
  442. <listitem><para>
  443. <emphasis>Have Enough Free Memory:</emphasis>
  444. Your system should have at least 50 Gbytes of free disk
  445. space for building images.
  446. </para></listitem>
  447. <listitem><para>
  448. <emphasis>Meet Minimal Version Requirements:</emphasis>
  449. The OpenEmbedded build system should be able to run on any
  450. modern distribution that has the following versions for
  451. Git, tar, Python and gcc.
  452. <itemizedlist>
  453. <listitem><para>
  454. Git 1.8.3.1 or greater
  455. </para></listitem>
  456. <listitem><para>
  457. tar 1.28 or greater
  458. </para></listitem>
  459. <listitem><para>
  460. Python 3.5.0 or greater.
  461. </para></listitem>
  462. <listitem><para>
  463. gcc 5.0 or greater.
  464. </para></listitem>
  465. </itemizedlist>
  466. If your build host does not meet any of these three listed
  467. version requirements, you can take steps to prepare the
  468. system so that you can still use the Yocto Project.
  469. See the
  470. "<ulink url='&YOCTO_DOCS_REF_URL;#required-git-tar-python-and-gcc-versions'>Required Git, tar, Python and gcc Versions</ulink>"
  471. section in the Yocto Project Reference Manual for
  472. information.
  473. </para></listitem>
  474. <listitem><para>
  475. <emphasis>Install Development Host Packages:</emphasis>
  476. Required development host packages vary depending on your
  477. build host and what you want to do with the Yocto
  478. Project.
  479. Collectively, the number of required packages is large
  480. if you want to be able to cover all cases.</para>
  481. <para>For lists of required packages for all scenarios,
  482. see the
  483. "<ulink url='&YOCTO_DOCS_REF_URL;#required-packages-for-the-build-host'>Required Packages for the Build Host</ulink>"
  484. section in the Yocto Project Reference Manual.
  485. </para></listitem>
  486. </orderedlist>
  487. Once you have completed the previous steps, you are ready to
  488. continue using a given development path on your native Linux
  489. machine.
  490. If you are going to use BitBake, see the
  491. "<link linkend='cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</link>"
  492. section.
  493. If you are going to use the Extensible SDK, see the
  494. "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-extensible'>Using the Extensible SDK</ulink>"
  495. Chapter in the Yocto Project Application Development and the
  496. Extensible Software Development Kit (eSDK) manual.
  497. If you want to work on the kernel, see the
  498. <ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;'>Yocto Project Linux Kernel Development Manual</ulink>.
  499. If you are going to use Toaster, see the
  500. "<ulink url='&YOCTO_DOCS_TOAST_URL;#toaster-manual-setup-and-use'>Setting Up and Using Toaster</ulink>"
  501. section in the Toaster User Manual.
  502. </para>
  503. </section>
  504. <section id='setting-up-to-use-crops'>
  505. <title>Setting Up to Use CROss PlatformS (CROPS)</title>
  506. <para>
  507. With
  508. <ulink url='https://github.com/crops/poky-container'>CROPS</ulink>,
  509. which leverages
  510. <ulink url='https://www.docker.com/'>Docker Containers</ulink>,
  511. you can create a Yocto Project development environment that
  512. is operating system agnostic.
  513. You can set up a container in which you can develop using the
  514. Yocto Project on a Windows, Mac, or Linux machine.
  515. </para>
  516. <para>
  517. Follow these general steps to prepare a Windows, Mac, or Linux
  518. machine as your Yocto Project build host:
  519. <orderedlist>
  520. <listitem><para>
  521. <emphasis>Determine What Your Build Host Needs:</emphasis>
  522. <ulink url='https://www.docker.com/what-docker'>Docker</ulink>
  523. is a software container platform that you need to install
  524. on the build host.
  525. Depending on your build host, you might have to install
  526. different software to support Docker containers.
  527. Go to the Docker installation page and read about the
  528. platform requirements in
  529. "<ulink url='https://docs.docker.com/install/#supported-platforms'>Supported Platforms</ulink>"
  530. your build host needs to run containers.
  531. </para></listitem>
  532. <listitem><para>
  533. <emphasis>Choose What To Install:</emphasis>
  534. Depending on whether or not your build host meets system
  535. requirements, you need to install "Docker CE Stable" or
  536. the "Docker Toolbox".
  537. Most situations call for Docker CE.
  538. However, if you have a build host that does not meet
  539. requirements (e.g. Pre-Windows 10 or Windows 10 "Home"
  540. version), you must install Docker Toolbox instead.
  541. </para></listitem>
  542. <listitem><para>
  543. <emphasis>Go to the Install Site for Your Platform:</emphasis>
  544. Click the link for the Docker edition associated with
  545. your build host's native software.
  546. For example, if your build host is running Microsoft
  547. Windows Version 10 and you want the Docker CE Stable
  548. edition, click that link under "Supported Platforms".
  549. </para></listitem>
  550. <listitem><para>
  551. <emphasis>Install the Software:</emphasis>
  552. Once you have understood all the pre-requisites, you can
  553. download and install the appropriate software.
  554. Follow the instructions for your specific machine and
  555. the type of the software you need to install:
  556. <itemizedlist>
  557. <listitem><para>
  558. Install
  559. <ulink url='https://docs.docker.com/docker-for-windows/install/#install-docker-for-windows-desktop-app'>Docker CE for Windows</ulink>
  560. for Windows build hosts that meet requirements.
  561. </para></listitem>
  562. <listitem><para>
  563. Install
  564. <ulink url='https://docs.docker.com/docker-for-mac/install/#install-and-run-docker-for-mac'>Docker CE for Macs</ulink>
  565. for Mac build hosts that meet requirements.
  566. </para></listitem>
  567. <listitem><para>
  568. Install
  569. <ulink url='https://docs.docker.com/toolbox/toolbox_install_windows/'>Docker Toolbox for Windows</ulink>
  570. for Windows build hosts that do not meet Docker
  571. requirements.
  572. </para></listitem>
  573. <listitem><para>
  574. Install
  575. <ulink url='https://docs.docker.com/toolbox/toolbox_install_mac/'>Docker Toolbox for MacOS</ulink>
  576. for Mac build hosts that do not meet Docker
  577. requirements.
  578. </para></listitem>
  579. <listitem><para>
  580. Install
  581. <ulink url='https://docs.docker.com/install/linux/docker-ce/centos/'>Docker CE for CentOS</ulink>
  582. for Linux build hosts running the CentOS
  583. distribution.
  584. </para></listitem>
  585. <listitem><para>
  586. Install
  587. <ulink url='https://docs.docker.com/install/linux/docker-ce/debian/'>Docker CE for Debian</ulink>
  588. for Linux build hosts running the Debian
  589. distribution.
  590. </para></listitem>
  591. <listitem><para>
  592. Install
  593. <ulink url='https://docs.docker.com/install/linux/docker-ce/fedora/'>Docker CE for Fedora</ulink>
  594. for Linux build hosts running the Fedora
  595. distribution.
  596. </para></listitem>
  597. <listitem><para>
  598. Install
  599. <ulink url='https://docs.docker.com/install/linux/docker-ce/ubuntu/'>Docker CE for Ubuntu</ulink>
  600. for Linux build hosts running the Ubuntu
  601. distribution.
  602. </para></listitem>
  603. </itemizedlist>
  604. </para></listitem>
  605. <listitem><para>
  606. <emphasis>Optionally Orient Yourself With Docker:</emphasis>
  607. If you are unfamiliar with Docker and the container
  608. concept, you can learn more here -
  609. <ulink url='https://docs.docker.com/get-started/'></ulink>.
  610. </para></listitem>
  611. <listitem><para>
  612. <emphasis>Launch Docker or Docker Toolbox:</emphasis>
  613. You should be able to launch Docker or the Docker Toolbox
  614. and have a terminal shell on your development host.
  615. </para></listitem>
  616. <listitem><para>
  617. <emphasis>Set Up the Containers to Use the Yocto Project:</emphasis>
  618. Go to
  619. <ulink url='https://github.com/crops/docker-win-mac-docs/wiki'></ulink>
  620. and follow the directions for your particular
  621. build host (i.e. Linux, Mac, or Windows).</para>
  622. <para>Once you complete the setup instructions for your
  623. machine, you have the Poky, Extensible SDK, and Toaster
  624. containers available.
  625. You can click those links from the page and learn more
  626. about using each of those containers.
  627. </para></listitem>
  628. </orderedlist>
  629. Once you have a container set up, everything is in place to
  630. develop just as if you were running on a native Linux machine.
  631. If you are going to use the Poky container, see the
  632. "<link linkend='cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</link>"
  633. section.
  634. If you are going to use the Extensible SDK container, see the
  635. "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-extensible'>Using the Extensible SDK</ulink>"
  636. Chapter in the Yocto Project Application Development and the
  637. Extensible Software Development Kit (eSDK) manual.
  638. If you are going to use the Toaster container, see the
  639. "<ulink url='&YOCTO_DOCS_TOAST_URL;#toaster-manual-setup-and-use'>Setting Up and Using Toaster</ulink>"
  640. section in the Toaster User Manual.
  641. </para>
  642. </section>
  643. <section id='setting-up-to-use-wsl'>
  644. <title>Setting Up to Use Windows Subsystem For Linux (WSLv2)</title>
  645. <para>
  646. With <ulink url='https://docs.microsoft.com/en-us/windows/wsl/wsl2-about'>
  647. Windows Subsystem for Linux (WSLv2)</ulink>, you can create a
  648. Yocto Project development environment that allows you to build
  649. on Windows. You can set up a Linux distribution inside Windows
  650. in which you can develop using the Yocto Project.
  651. </para>
  652. <para>
  653. Follow these general steps to prepare a Windows machine using WSLv2
  654. as your Yocto Project build host:
  655. <orderedlist>
  656. <listitem><para>
  657. <emphasis>Make sure your Windows 10 machine is capable of running WSLv2:</emphasis>
  658. WSLv2 is only available for Windows 10 builds > 18917. To
  659. check which build version you are running, you may open a
  660. command prompt on Windows and execute the command "ver".
  661. <literallayout class='monospaced'>
  662. C:\Users\myuser> ver
  663. Microsoft Windows [Version 10.0.19041.153]
  664. </literallayout>
  665. If your build is capable of running WSLv2 you may continue,
  666. for more information on this subject or instructions on how
  667. to upgrade to WSLv2 visit <ulink url='https://docs.microsoft.com/en-us/windows/wsl/wsl2-install'>Windows 10 WSLv2</ulink>
  668. </para></listitem>
  669. <listitem><para>
  670. <emphasis>Install the Linux distribution of your choice inside Windows 10:</emphasis>
  671. Once you know your version of Windows 10 supports WSLv2,
  672. you can install the distribution of your choice from the
  673. Microsoft Store.
  674. Open the Microsoft Store and search for Linux. While there
  675. are several Linux distributions available, the assumption
  676. is that your pick will be one of the distributions supported
  677. by the Yocto Project as stated on the instructions for
  678. using a native Linux host.
  679. After making your selection, simply click "Get" to download
  680. and install the distribution.
  681. </para></listitem>
  682. <listitem><para>
  683. <emphasis>Check your Linux distribution is using WSLv2:</emphasis>
  684. Open a Windows PowerShell and run:
  685. <literallayout class='monospaced'>
  686. C:\WINDOWS\system32> wsl -l -v
  687. NAME STATE VERSION
  688. *Ubuntu Running 2
  689. </literallayout>
  690. Note the version column which says the WSL version being used by
  691. your distribution, on compatible systems, this can be changed back
  692. at any point in time.
  693. </para></listitem>
  694. <listitem><para>
  695. <emphasis>Optionally Orient Yourself on WSL:</emphasis>
  696. If you are unfamiliar with WSL, you can learn more here -
  697. <ulink url='https://docs.microsoft.com/en-us/windows/wsl/wsl2-about'></ulink>.
  698. </para></listitem>
  699. <listitem><para>
  700. <emphasis>Launch your WSL Distibution:</emphasis>
  701. From the Windows start menu simply launch your WSL distribution
  702. just like any other application.
  703. </para></listitem>
  704. <listitem><para>
  705. <emphasis>Optimize your WSLv2 storage often:</emphasis>
  706. Due to the way storage is handled on WSLv2, the storage
  707. space used by the undelying Linux distribution is not
  708. reflected immedately, and since bitbake heavily uses
  709. storage, after several builds, you may be unaware you
  710. are running out of space. WSLv2 uses a VHDX file for
  711. storage, this issue can be easily avoided by manually
  712. optimizing this file often, this can be done in the
  713. following way:
  714. <orderedlist>
  715. <listitem><para>
  716. <emphasis>Find the location of your VHDX file:</emphasis>
  717. First you need to find the distro app package directory,
  718. to achieve this open a Windows Powershell as Administrator
  719. and run:
  720. <literallayout class='monospaced'>
  721. C:\WINDOWS\system32> Get-AppxPackage -Name "*Ubuntu*" | Select PackageFamilyName
  722. PackageFamilyName
  723. -----------------
  724. CanonicalGroupLimited.UbuntuonWindows_79abcdefgh
  725. </literallayout>
  726. You should now replace the <replaceable>PackageFamilyName</replaceable>
  727. and your <replaceable>user</replaceable> on the following
  728. path to find your VHDX file: <filename>C:\Users\user\AppData\Local\Packages\PackageFamilyName\LocalState\</filename>
  729. For example:
  730. <literallayout class='monospaced'>
  731. ls C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\
  732. Mode LastWriteTime Length Name
  733. -a---- 3/14/2020 9:52 PM 57418973184 ext4.vhdx
  734. </literallayout>
  735. Your VHDX file path is: <filename>C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ext4.vhdx</filename>
  736. </para></listitem>
  737. <listitem><para><emphasis>Optimize your VHDX file:</emphasis>
  738. Open a Windows Powershell as Administrator to optimize
  739. your VHDX file, shutting down WSL first:
  740. <literallayout class='monospaced'>
  741. C:\WINDOWS\system32> wsl --shutdown
  742. C:\WINDOWS\system32> optimize-vhd -Path C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ext4.vhdx -Mode full
  743. </literallayout>
  744. A progress bar should be shown while optimizing the VHDX file,
  745. and storage should now be reflected correctly on the Windows
  746. Explorer.
  747. </para></listitem>
  748. </orderedlist>
  749. </para></listitem>
  750. </orderedlist>
  751. <note>
  752. The current implementation of WSLv2 does not have out-of-the-box
  753. access to external devices such as those connected through a
  754. USB port, but it automatically mounts your <filename>C:</filename>
  755. drive on <filename>/mnt/c/</filename> (and others), which
  756. you can use to share deploy artifacts to be later flashed on
  757. hardware through Windows, but your build directory should not
  758. reside inside this mountpoint.
  759. </note>
  760. Once you have WSLv2 set up, everything is in place to
  761. develop just as if you were running on a native Linux machine.
  762. If you are going to use the Extensible SDK container, see the
  763. "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-extensible'>Using the Extensible SDK</ulink>"
  764. Chapter in the Yocto Project Application Development and the
  765. Extensible Software Development Kit (eSDK) manual.
  766. If you are going to use the Toaster container, see the
  767. "<ulink url='&YOCTO_DOCS_TOAST_URL;#toaster-manual-setup-and-use'>Setting Up and Using Toaster</ulink>"
  768. section in the Toaster User Manual.
  769. </para>
  770. </section>
  771. </section>
  772. <section id='locating-yocto-project-source-files'>
  773. <title>Locating Yocto Project Source Files</title>
  774. <para>
  775. This section shows you how to locate, fetch and configure the source
  776. files you'll need to work with the Yocto Project.
  777. <note><title>Notes</title>
  778. <itemizedlist>
  779. <listitem><para>
  780. For concepts and introductory information about Git as it
  781. is used in the Yocto Project, see the
  782. "<ulink url='&YOCTO_DOCS_OM_URL;#git'>Git</ulink>"
  783. section in the Yocto Project Overview and Concepts Manual.
  784. </para></listitem>
  785. <listitem><para>
  786. For concepts on Yocto Project source repositories, see the
  787. "<ulink url='&YOCTO_DOCS_OM_URL;#yocto-project-repositories'>Yocto Project Source Repositories</ulink>"
  788. section in the Yocto Project Overview and Concepts Manual."
  789. </para></listitem>
  790. </itemizedlist>
  791. </note>
  792. </para>
  793. <section id='accessing-source-repositories'>
  794. <title>Accessing Source Repositories</title>
  795. <para>
  796. Working from a copy of the upstream Yocto Project
  797. <ulink url='&YOCTO_DOCS_OM_URL;#source-repositories'>Source Repositories</ulink>
  798. is the preferred method for obtaining and using a Yocto Project
  799. release.
  800. You can view the Yocto Project Source Repositories at
  801. <ulink url='&YOCTO_GIT_URL;'></ulink>.
  802. In particular, you can find the
  803. <filename>poky</filename> repository at
  804. <ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/poky/'></ulink>.
  805. </para>
  806. <para>
  807. Use the following procedure to locate the latest upstream copy of
  808. the <filename>poky</filename> Git repository:
  809. <orderedlist>
  810. <listitem><para>
  811. <emphasis>Access Repositories:</emphasis>
  812. Open a browser and go to
  813. <ulink url='&YOCTO_GIT_URL;'></ulink> to access the
  814. GUI-based interface into the Yocto Project source
  815. repositories.
  816. </para></listitem>
  817. <listitem><para>
  818. <emphasis>Select the Repository:</emphasis>
  819. Click on the repository in which you are interested (e.g.
  820. <filename>poky</filename>).
  821. </para></listitem>
  822. <listitem><para>
  823. <emphasis>Find the URL Used to Clone the Repository:</emphasis>
  824. At the bottom of the page, note the URL used to
  825. <ulink url='&YOCTO_DOCS_OM_URL;#git-commands-clone'>clone</ulink>
  826. that repository (e.g.
  827. <filename>&YOCTO_GIT_URL;/poky</filename>).
  828. <note>
  829. For information on cloning a repository, see the
  830. "<link linkend='cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</link>"
  831. section.
  832. </note>
  833. </para></listitem>
  834. </orderedlist>
  835. </para>
  836. </section>
  837. <section id='accessing-index-of-releases'>
  838. <title>Accessing Index of Releases</title>
  839. <para>
  840. Yocto Project maintains an Index of Releases area that contains
  841. related files that contribute to the Yocto Project.
  842. Rather than Git repositories, these files are tarballs that
  843. represent snapshots in time of a given component.
  844. <note><title>Tip</title>
  845. The recommended method for accessing Yocto Project
  846. components is to use Git to clone the upstream repository and
  847. work from within that locally cloned repository.
  848. The procedure in this section exists should you desire a
  849. tarball snapshot of any given component.
  850. </note>
  851. Follow these steps to locate and download a particular tarball:
  852. <orderedlist>
  853. <listitem><para>
  854. <emphasis>Access the Index of Releases:</emphasis>
  855. Open a browser and go to
  856. <ulink url='&YOCTO_DL_URL;/releases'></ulink> to access the
  857. Index of Releases.
  858. The list represents released components (e.g.
  859. <filename>bitbake</filename>,
  860. <filename>sato</filename>, and so on).
  861. <note>
  862. The <filename>yocto</filename> directory contains the
  863. full array of released Poky tarballs.
  864. The <filename>poky</filename> directory in the
  865. Index of Releases was historically used for very
  866. early releases and exists now only for retroactive
  867. completeness.
  868. </note>
  869. </para></listitem>
  870. <listitem><para>
  871. <emphasis>Select a Component:</emphasis>
  872. Click on any released component in which you are interested
  873. (e.g. <filename>yocto</filename>).
  874. </para></listitem>
  875. <listitem><para>
  876. <emphasis>Find the Tarball:</emphasis>
  877. Drill down to find the associated tarball.
  878. For example, click on <filename>yocto-&DISTRO;</filename> to
  879. view files associated with the Yocto Project &DISTRO;
  880. release (e.g. <filename>poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;.tar.bz2</filename>,
  881. which is the released Poky tarball).
  882. </para></listitem>
  883. <listitem><para>
  884. <emphasis>Download the Tarball:</emphasis>
  885. Click the tarball to download and save a snapshot of the
  886. given component.
  887. </para></listitem>
  888. </orderedlist>
  889. </para>
  890. </section>
  891. <section id='using-the-downloads-page'>
  892. <title>Using the Downloads Page</title>
  893. <para>
  894. The
  895. <ulink url='&YOCTO_HOME_URL;'>Yocto Project Website</ulink>
  896. uses a "DOWNLOADS" page from which you can locate and download
  897. tarballs of any Yocto Project release.
  898. Rather than Git repositories, these files represent snapshot
  899. tarballs similar to the tarballs located in the Index of Releases
  900. described in the
  901. "<link linkend='accessing-index-of-releases'>Accessing Index of Releases</link>"
  902. section.
  903. <note><title>Tip</title>
  904. The recommended method for accessing Yocto Project
  905. components is to use Git to clone a repository and work from
  906. within that local repository.
  907. The procedure in this section exists should you desire a
  908. tarball snapshot of any given component.
  909. </note>
  910. <orderedlist>
  911. <listitem><para>
  912. <emphasis>Go to the Yocto Project Website:</emphasis>
  913. Open The
  914. <ulink url='&YOCTO_HOME_URL;'>Yocto Project Website</ulink>
  915. in your browser.
  916. </para></listitem>
  917. <listitem><para>
  918. <emphasis>Get to the Downloads Area:</emphasis>
  919. Select the "DOWNLOADS" item from the pull-down
  920. "SOFTWARE" tab menu near the top of the page.
  921. </para></listitem>
  922. <listitem><para>
  923. <emphasis>Select a Yocto Project Release:</emphasis>
  924. Use the menu next to "RELEASE" to display and choose
  925. a recent or past supported Yocto Project release
  926. (e.g. &DISTRO_NAME_NO_CAP;,
  927. &DISTRO_NAME_NO_CAP_MINUS_ONE;, and so forth).
  928. <note><title>Tip</title>
  929. For a "map" of Yocto Project releases to version
  930. numbers, see the
  931. <ulink url='https://wiki.yoctoproject.org/wiki/Releases'>Releases</ulink>
  932. wiki page.
  933. </note>
  934. You can use the "RELEASE ARCHIVE" link to reveal a menu of
  935. all Yocto Project releases.
  936. </para></listitem>
  937. <listitem><para>
  938. <emphasis>Download Tools or Board Support Packages (BSPs):</emphasis>
  939. From the "DOWNLOADS" page, you can download tools or
  940. BSPs as well.
  941. Just scroll down the page and look for what you need.
  942. </para></listitem>
  943. </orderedlist>
  944. </para>
  945. </section>
  946. <section id='accessing-nightly-builds'>
  947. <title>Accessing Nightly Builds</title>
  948. <para>
  949. Yocto Project maintains an area for nightly builds that contains
  950. tarball releases at <ulink url='&YOCTO_AB_NIGHTLY_URL;'/>.
  951. These builds include Yocto Project releases ("poky"),
  952. toolchains, and builds for supported machines.
  953. </para>
  954. <para>
  955. Should you ever want to access a nightly build of a particular
  956. Yocto Project component, use the following procedure:
  957. <orderedlist>
  958. <listitem><para>
  959. <emphasis>Locate the Index of Nightly Builds:</emphasis>
  960. Open a browser and go to
  961. <ulink url='&YOCTO_AB_NIGHTLY_URL;'/> to access the
  962. Nightly Builds.
  963. </para></listitem>
  964. <listitem><para>
  965. <emphasis>Select a Date:</emphasis>
  966. Click on the date in which you are interested.
  967. If you want the latest builds, use "CURRENT".
  968. </para></listitem>
  969. <listitem><para>
  970. <emphasis>Select a Build:</emphasis>
  971. Choose the area in which you are interested.
  972. For example, if you are looking for the most recent
  973. toolchains, select the "toolchain" link.
  974. </para></listitem>
  975. <listitem><para>
  976. <emphasis>Find the Tarball:</emphasis>
  977. Drill down to find the associated tarball.
  978. </para></listitem>
  979. <listitem><para>
  980. <emphasis>Download the Tarball:</emphasis>
  981. Click the tarball to download and save a snapshot of the
  982. given component.
  983. </para></listitem>
  984. </orderedlist>
  985. </para>
  986. </section>
  987. </section>
  988. <section id='cloning-and-checking-out-branches'>
  989. <title>Cloning and Checking Out Branches</title>
  990. <para>
  991. To use the Yocto Project for development, you need a release locally
  992. installed on your development system.
  993. This locally installed set of files is referred to as the
  994. <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
  995. in the Yocto Project documentation.
  996. </para>
  997. <para>
  998. The preferred method of creating your Source Directory is by using
  999. <ulink url='&YOCTO_DOCS_OM_URL;#git'>Git</ulink> to clone a local
  1000. copy of the upstream <filename>poky</filename> repository.
  1001. Working from a cloned copy of the upstream repository allows you
  1002. to contribute back into the Yocto Project or to simply work with
  1003. the latest software on a development branch.
  1004. Because Git maintains and creates an upstream repository with
  1005. a complete history of changes and you are working with a local
  1006. clone of that repository, you have access to all the Yocto
  1007. Project development branches and tag names used in the upstream
  1008. repository.
  1009. </para>
  1010. <section id='cloning-the-poky-repository'>
  1011. <title>Cloning the <filename>poky</filename> Repository</title>
  1012. <para>
  1013. Follow these steps to create a local version of the
  1014. upstream
  1015. <ulink url='&YOCTO_DOCS_REF_URL;#poky'><filename>poky</filename></ulink>
  1016. Git repository.
  1017. <orderedlist>
  1018. <listitem><para>
  1019. <emphasis>Set Your Directory:</emphasis>
  1020. Change your working directory to where you want to
  1021. create your local copy of
  1022. <filename>poky</filename>.
  1023. </para></listitem>
  1024. <listitem><para>
  1025. <emphasis>Clone the Repository:</emphasis>
  1026. The following example command clones the
  1027. <filename>poky</filename> repository and uses
  1028. the default name "poky" for your local repository:
  1029. <literallayout class='monospaced'>
  1030. $ git clone git://git.yoctoproject.org/poky
  1031. Cloning into 'poky'...
  1032. remote: Counting objects: 432160, done.
  1033. remote: Compressing objects: 100% (102056/102056), done.
  1034. remote: Total 432160 (delta 323116), reused 432037 (delta 323000)
  1035. Receiving objects: 100% (432160/432160), 153.81 MiB | 8.54 MiB/s, done.
  1036. Resolving deltas: 100% (323116/323116), done.
  1037. Checking connectivity... done.
  1038. </literallayout>
  1039. Unless you specify a specific development branch or
  1040. tag name, Git clones the "master" branch, which results
  1041. in a snapshot of the latest development changes for
  1042. "master".
  1043. For information on how to check out a specific
  1044. development branch or on how to check out a local
  1045. branch based on a tag name, see the
  1046. "<link linkend='checking-out-by-branch-in-poky'>Checking Out By Branch in Poky</link>"
  1047. and
  1048. <link linkend='checkout-out-by-tag-in-poky'>Checking Out By Tag in Poky</link>"
  1049. sections, respectively.</para>
  1050. <para>Once the local repository is created, you can
  1051. change to that directory and check its status.
  1052. Here, the single "master" branch exists on your system
  1053. and by default, it is checked out:
  1054. <literallayout class='monospaced'>
  1055. $ cd ~/poky
  1056. $ git status
  1057. On branch master
  1058. Your branch is up-to-date with 'origin/master'.
  1059. nothing to commit, working directory clean
  1060. $ git branch
  1061. * master
  1062. </literallayout>
  1063. Your local repository of poky is identical to the
  1064. upstream poky repository at the time from which it was
  1065. cloned.
  1066. As you work with the local branch, you can periodically
  1067. use the <filename>git pull &dash;&dash;rebase</filename>
  1068. command to be sure you are up-to-date with the upstream
  1069. branch.
  1070. </para></listitem>
  1071. </orderedlist>
  1072. </para>
  1073. </section>
  1074. <section id='checking-out-by-branch-in-poky'>
  1075. <title>Checking Out by Branch in Poky</title>
  1076. <para>
  1077. When you clone the upstream poky repository, you have access to
  1078. all its development branches.
  1079. Each development branch in a repository is unique as it forks
  1080. off the "master" branch.
  1081. To see and use the files of a particular development branch
  1082. locally, you need to know the branch name and then specifically
  1083. check out that development branch.
  1084. <note>
  1085. Checking out an active development branch by branch name
  1086. gives you a snapshot of that particular branch at the time
  1087. you check it out.
  1088. Further development on top of the branch that occurs after
  1089. check it out can occur.
  1090. </note>
  1091. <orderedlist>
  1092. <listitem><para>
  1093. <emphasis>Switch to the Poky Directory:</emphasis>
  1094. If you have a local poky Git repository, switch to that
  1095. directory.
  1096. If you do not have the local copy of poky, see the
  1097. "<link linkend='cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</link>"
  1098. section.
  1099. </para></listitem>
  1100. <listitem><para>
  1101. <emphasis>Determine Existing Branch Names:</emphasis>
  1102. <literallayout class='monospaced'>
  1103. $ git branch -a
  1104. * master
  1105. remotes/origin/1.1_M1
  1106. remotes/origin/1.1_M2
  1107. remotes/origin/1.1_M3
  1108. remotes/origin/1.1_M4
  1109. remotes/origin/1.2_M1
  1110. remotes/origin/1.2_M2
  1111. remotes/origin/1.2_M3
  1112. .
  1113. .
  1114. .
  1115. remotes/origin/thud
  1116. remotes/origin/thud-next
  1117. remotes/origin/warrior
  1118. remotes/origin/warrior-next
  1119. remotes/origin/zeus
  1120. remotes/origin/zeus-next
  1121. ... and so on ...
  1122. </literallayout>
  1123. </para></listitem>
  1124. <listitem><para>
  1125. <emphasis>Check out the Branch:</emphasis>
  1126. Check out the development branch in which you want to work.
  1127. For example, to access the files for the Yocto Project
  1128. &DISTRO; Release (&DISTRO_NAME;), use the following command:
  1129. <literallayout class='monospaced'>
  1130. $ git checkout -b &DISTRO_NAME_NO_CAP; origin/&DISTRO_NAME_NO_CAP;
  1131. Branch &DISTRO_NAME_NO_CAP; set up to track remote branch &DISTRO_NAME_NO_CAP; from origin.
  1132. Switched to a new branch '&DISTRO_NAME_NO_CAP;'
  1133. </literallayout>
  1134. The previous command checks out the "&DISTRO_NAME_NO_CAP;"
  1135. development branch and reports that the branch is tracking
  1136. the upstream "origin/&DISTRO_NAME_NO_CAP;" branch.</para>
  1137. <para>The following command displays the branches
  1138. that are now part of your local poky repository.
  1139. The asterisk character indicates the branch that is
  1140. currently checked out for work:
  1141. <literallayout class='monospaced'>
  1142. $ git branch
  1143. master
  1144. * &DISTRO_NAME_NO_CAP;
  1145. </literallayout>
  1146. </para></listitem>
  1147. </orderedlist>
  1148. </para>
  1149. </section>
  1150. <section id='checkout-out-by-tag-in-poky'>
  1151. <title>Checking Out by Tag in Poky</title>
  1152. <para>
  1153. Similar to branches, the upstream repository uses tags
  1154. to mark specific commits associated with significant points in
  1155. a development branch (i.e. a release point or stage of a
  1156. release).
  1157. You might want to set up a local branch based on one of those
  1158. points in the repository.
  1159. The process is similar to checking out by branch name except you
  1160. use tag names.
  1161. <note>
  1162. Checking out a branch based on a tag gives you a
  1163. stable set of files not affected by development on the
  1164. branch above the tag.
  1165. </note>
  1166. <orderedlist>
  1167. <listitem><para>
  1168. <emphasis>Switch to the Poky Directory:</emphasis>
  1169. If you have a local poky Git repository, switch to that
  1170. directory.
  1171. If you do not have the local copy of poky, see the
  1172. "<link linkend='cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</link>"
  1173. section.
  1174. </para></listitem>
  1175. <listitem><para>
  1176. <emphasis>Fetch the Tag Names:</emphasis>
  1177. To checkout the branch based on a tag name, you need to
  1178. fetch the upstream tags into your local repository:
  1179. <literallayout class='monospaced'>
  1180. $ git fetch --tags
  1181. $
  1182. </literallayout>
  1183. </para></listitem>
  1184. <listitem><para>
  1185. <emphasis>List the Tag Names:</emphasis>
  1186. You can list the tag names now:
  1187. <literallayout class='monospaced'>
  1188. $ git tag
  1189. 1.1_M1.final
  1190. 1.1_M1.rc1
  1191. 1.1_M1.rc2
  1192. 1.1_M2.final
  1193. 1.1_M2.rc1
  1194. .
  1195. .
  1196. .
  1197. yocto-2.5
  1198. yocto-2.5.1
  1199. yocto-2.5.2
  1200. yocto-2.5.3
  1201. yocto-2.6
  1202. yocto-2.6.1
  1203. yocto-2.6.2
  1204. yocto-2.7
  1205. yocto_1.5_M5.rc8
  1206. </literallayout>
  1207. </para></listitem>
  1208. <listitem><para>
  1209. <emphasis>Check out the Branch:</emphasis>
  1210. <literallayout class='monospaced'>
  1211. $ git checkout tags/&DISTRO_REL_TAG; -b my_yocto_&DISTRO;
  1212. Switched to a new branch 'my_yocto_&DISTRO;'
  1213. $ git branch
  1214. master
  1215. * my_yocto_&DISTRO;
  1216. </literallayout>
  1217. The previous command creates and checks out a local
  1218. branch named "my_yocto_&DISTRO;", which is based on
  1219. the commit in the upstream poky repository that has
  1220. the same tag.
  1221. In this example, the files you have available locally
  1222. as a result of the <filename>checkout</filename>
  1223. command are a snapshot of the
  1224. "&DISTRO_NAME_NO_CAP;" development branch at the point
  1225. where Yocto Project &DISTRO; was released.
  1226. </para></listitem>
  1227. </orderedlist>
  1228. </para>
  1229. </section>
  1230. </section>
  1231. </chapter>
  1232. <!--
  1233. vim: expandtab tw=80 ts=4
  1234. -->