dev-manual-start.xml 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  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. <chapter id='dev-manual-start'>
  5. <title>Setting Up to Use the Yocto Project</title>
  6. <para>
  7. This chapter provides procedures related to getting set up to use the
  8. Yocto Project.
  9. You can learn about creating a team environment that develops using the
  10. Yocto Project, how to set up a
  11. <ulink url='&YOCTO_DOCS_REF_URL;#hardware-build-system-term'>build host</ulink>,
  12. how to locate Yocto Project source repositories, and how to create local
  13. Git repositories.
  14. </para>
  15. <section id="usingpoky-changes-collaborate">
  16. <title>Creating a Team Development Environment</title>
  17. <para>
  18. It might not be immediately clear how you can use the Yocto
  19. Project in a team development environment, or how to scale it for a
  20. large team of developers.
  21. One of the strengths of the Yocto Project is that it is extremely
  22. flexible.
  23. Thus, you can adapt it to many different use cases and scenarios.
  24. However, this flexibility could cause difficulties if you are trying
  25. to create a working setup that scales across a large team.
  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. Keep in mind, the procedure here is 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 need to understand who is going to be doing anything
  41. related to the Yocto Project and what their roles would be.
  42. Making this determination is essential to completing
  43. steps two and three, 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.
  62. Not all environments 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. </para></listitem>
  86. <listitem><para>
  87. <emphasis>Understand the Hardware Topology of the Environment:</emphasis>
  88. Once you understand the hardware involved and the make-up
  89. of the team, you can understand the hardware topology of the
  90. development environment.
  91. You can get a visual idea of the machines and their roles
  92. across the development environment.
  93. <!--
  94. The following figure shows a moderately sized Yocto Project
  95. development environment.
  96. <para role="writernotes">
  97. Need figure.</para>
  98. -->
  99. </para></listitem>
  100. <listitem><para>
  101. <emphasis>Use Git as Your Source Control Manager (SCM):</emphasis>
  102. Keeping your
  103. <ulink url='&YOCTO_DOCS_REF_URL;#metadata'>Metadata</ulink>
  104. (i.e. recipes, configuration files, classes, and so forth)
  105. and any software you are developing under the control of an SCM
  106. system that is compatible with the OpenEmbedded build system
  107. is advisable.
  108. Of the SCMs BitBake supports, the Yocto Project team strongly
  109. recommends using
  110. <ulink url='&YOCTO_DOCS_OM_URL;#git'>Git</ulink>.
  111. Git is a distributed system that is easy to backup,
  112. allows you to work remotely, and then connects back to the
  113. infrastructure.
  114. <note>
  115. For information about BitBake, see the
  116. <ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
  117. </note></para>
  118. <para>It is relatively easy to set up Git services and create
  119. infrastructure like
  120. <ulink url='&YOCTO_GIT_URL;'>http://git.yoctoproject.org</ulink>,
  121. which is based on server software called
  122. <filename>gitolite</filename> with <filename>cgit</filename>
  123. being used to generate the web interface that lets you view the
  124. repositories.
  125. The <filename>gitolite</filename> software identifies users
  126. using SSH keys and allows branch-based access controls to
  127. repositories that you can control as little or as much as
  128. necessary.
  129. <note>
  130. The setup of these services is beyond the scope of this
  131. manual.
  132. However, sites such as the following exist that describe
  133. how to perform setup:
  134. <itemizedlist>
  135. <listitem><para>
  136. <ulink url='http://git-scm.com/book/ch4-8.html'>Git documentation</ulink>:
  137. Describes how to install
  138. <filename>gitolite</filename> on the server.
  139. </para></listitem>
  140. <listitem><para>
  141. <ulink url='http://gitolite.com'>Gitolite</ulink>:
  142. Information for <filename>gitolite</filename>.
  143. </para></listitem>
  144. <listitem><para>
  145. <ulink url='https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools'>Interfaces, frontends, and tools</ulink>:
  146. Documentation on how to create interfaces and
  147. frontends for Git.
  148. </para></listitem>
  149. </itemizedlist>
  150. </note>
  151. </para></listitem>
  152. <listitem><para>
  153. <emphasis>Set up the Application Development Machines:</emphasis>
  154. As mentioned earlier, application developers are creating
  155. applications on top of existing software stacks.
  156. Following are some best practices for setting up machines
  157. used for application development:
  158. <itemizedlist>
  159. <listitem><para>
  160. Use a pre-built toolchain that contains the software
  161. stack itself.
  162. Then, develop the application code on top of the
  163. stack.
  164. This method works well for small numbers of relatively
  165. isolated applications.
  166. </para></listitem>
  167. <listitem><para>
  168. When possible, use the Yocto Project plug-in for the
  169. <trademark class='trade'>Eclipse</trademark> IDE
  170. and SDK development practices.
  171. For more information, see the
  172. <ulink url='&YOCTO_DOCS_SDK_URL;'>Yocto Project Application Development and the Extensible Software Development Kit (eSDK)</ulink>
  173. manual.
  174. </para></listitem>
  175. <listitem><para>
  176. Keep your cross-development toolchains updated.
  177. You can do this through provisioning either as new
  178. toolchain downloads or as updates through a package
  179. update mechanism using <filename>opkg</filename>
  180. to provide updates to an existing toolchain.
  181. The exact mechanics of how and when to do this depend
  182. on local policy.
  183. </para></listitem>
  184. <listitem><para>
  185. Use multiple toolchains installed locally into
  186. different locations to allow development across
  187. versions.
  188. </para></listitem>
  189. </itemizedlist>
  190. </para></listitem>
  191. <listitem><para>
  192. <emphasis>Set up the Core Development Machines:</emphasis>
  193. As mentioned earlier, core developers work on the contents of
  194. the operating system itself.
  195. Following are some best practices for setting up machines
  196. used for developing images:
  197. <itemizedlist>
  198. <listitem><para>
  199. Have the
  200. <ulink url='&YOCTO_DOCS_REF_URL;#build-system-term'>OpenEmbedded build system</ulink>
  201. available on the developer workstations so developers
  202. can run their own builds and directly rebuild the
  203. software stack.
  204. </para></listitem>
  205. <listitem><para>
  206. Keep the core system unchanged as much as
  207. possible and do your work in layers on top of the
  208. core system.
  209. Doing so gives you a greater level of portability when
  210. upgrading to new versions of the core system or Board
  211. Support Packages (BSPs).
  212. </para></listitem>
  213. <listitem><para>
  214. Share layers amongst the developers of a
  215. particular project and contain the policy configuration
  216. that defines the project.
  217. </para></listitem>
  218. </itemizedlist>
  219. </para></listitem>
  220. <listitem><para>
  221. <emphasis>Set up an Autobuilder:</emphasis>
  222. Autobuilders are often the core of the development
  223. environment.
  224. It is here that changes from individual developers are brought
  225. together and centrally tested.
  226. Based on this automated build and test environment, subsequent
  227. decisions about releases can be made.
  228. Autobuilders also allow for "continuous integration" style
  229. testing of software components and regression identification
  230. and tracking.</para>
  231. <para>See "<ulink url='http://autobuilder.yoctoproject.org'>Yocto Project Autobuilder</ulink>"
  232. for more information and links to buildbot.
  233. The Yocto Project team has found this implementation
  234. works well in this role.
  235. A public example of this is the Yocto Project
  236. Autobuilders, which the Yocto Project team uses to test the
  237. overall health of the project.</para>
  238. <para>The features of this system are:
  239. <itemizedlist>
  240. <listitem><para>
  241. Highlights when commits break the build.
  242. </para></listitem>
  243. <listitem><para>
  244. Populates an
  245. <ulink url='&YOCTO_DOCS_OM_URL;#shared-state-cache'>sstate cache</ulink>
  246. from which developers can pull rather than requiring
  247. local builds.
  248. </para></listitem>
  249. <listitem><para>
  250. Allows commit hook triggers, which trigger builds when
  251. commits are made.
  252. </para></listitem>
  253. <listitem><para>
  254. Allows triggering of automated image booting
  255. and testing under the QuickEMUlator (QEMU).
  256. </para></listitem>
  257. <listitem><para>
  258. Supports incremental build testing and
  259. from-scratch builds.
  260. </para></listitem>
  261. <listitem><para>
  262. Shares output that allows developer
  263. testing and historical regression investigation.
  264. </para></listitem>
  265. <listitem><para>
  266. Creates output that can be used for releases.
  267. </para></listitem>
  268. <listitem><para>
  269. Allows scheduling of builds so that resources
  270. can be used efficiently.
  271. </para></listitem>
  272. </itemizedlist>
  273. </para></listitem>
  274. <listitem><para>
  275. <emphasis>Set up Test Machines:</emphasis>
  276. Use a small number of shared, high performance systems
  277. for testing purposes.
  278. Developers can use these systems for wider, more
  279. extensive testing while they continue to develop
  280. locally using their primary development system.
  281. </para></listitem>
  282. <listitem><para>
  283. <emphasis>Document Policies and Change Flow:</emphasis>
  284. The Yocto Project uses a hierarchical structure and a
  285. pull model.
  286. Scripts exist to create and send pull requests
  287. (i.e. <filename>create-pull-request</filename> and
  288. <filename>send-pull-request</filename>).
  289. This model is in line with other open source projects where
  290. maintainers are responsible for specific areas of the project
  291. and a single maintainer handles the final "top-of-tree" merges.
  292. <note>
  293. You can also use a more collective push model.
  294. The <filename>gitolite</filename> software supports both the
  295. push and pull models quite easily.
  296. </note></para>
  297. <para>As with any development environment, it is important
  298. to document the policy used as well as any main project
  299. guidelines so they are understood by everyone.
  300. It is also a good idea to have well structured
  301. commit messages, which are usually a part of a project's
  302. guidelines.
  303. Good commit messages are essential when looking back in time and
  304. trying to understand why changes were made.</para>
  305. <para>If you discover that changes are needed to the core
  306. layer of the project, it is worth sharing those with the
  307. community as soon as possible.
  308. Chances are if you have discovered the need for changes,
  309. someone else in the community needs them also.
  310. </para></listitem>
  311. <listitem><para>
  312. <emphasis>Development Environment Summary:</emphasis>
  313. Aside from the previous steps, some best practices exist
  314. within the Yocto Project development environment.
  315. Consider the following:
  316. <itemizedlist>
  317. <listitem><para>
  318. Use
  319. <ulink url='&YOCTO_DOCS_OM_URL;#git'>Git</ulink>
  320. as the source control system.
  321. </para></listitem>
  322. <listitem><para>
  323. Maintain your Metadata in layers that make sense
  324. for your situation.
  325. See the
  326. "<ulink url='&YOCTO_DOCS_OM_URL;#the-yocto-project-layer-model'>The Yocto Project Layer Model</ulink>"
  327. section in the Yocto Project Overview and Concepts
  328. Manual and the
  329. "<link linkend='understanding-and-creating-layers'>Understanding and Creating Layers</link>"
  330. section for more information on layers.
  331. </para></listitem>
  332. <listitem><para>
  333. Separate the project's Metadata and code by using
  334. separate Git repositories.
  335. See the
  336. "<ulink url='&YOCTO_DOCS_OM_URL;#yocto-project-repositories'>Yocto Project Source Repositories</ulink>"
  337. section in the Yocto Project Overview and Concepts
  338. Manual for information on these repositories.
  339. See the
  340. "<link linkend='locating-yocto-project-source-files'>Locating Yocto Project Source Files</link>"
  341. section for information on how to set up local Git
  342. repositories for related upstream Yocto Project
  343. Git repositories.
  344. </para></listitem>
  345. <listitem><para>
  346. Set up the directory for the shared state cache
  347. (<ulink url='&YOCTO_DOCS_REF_URL;#var-SSTATE_DIR'><filename>SSTATE_DIR</filename></ulink>)
  348. where it makes sense.
  349. For example, set up the sstate cache on a system used
  350. by developers in the same organization and share the
  351. same source directories on their machines.
  352. </para></listitem>
  353. <listitem><para>
  354. Set up an Autobuilder and have it populate the
  355. sstate cache and source directories.
  356. </para></listitem>
  357. <listitem><para>
  358. The Yocto Project community encourages you
  359. to send patches to the project to fix bugs or add
  360. features.
  361. If you do submit patches, follow the project commit
  362. guidelines for writing good commit messages.
  363. See the "<link linkend='how-to-submit-a-change'>Submitting a Change to the Yocto Project</link>"
  364. section.
  365. </para></listitem>
  366. <listitem><para>
  367. Send changes to the core sooner than later
  368. as others are likely to run into the same issues.
  369. For some guidance on mailing lists to use, see the list
  370. in the
  371. "<link linkend='how-to-submit-a-change'>Submitting a Change to the Yocto Project</link>"
  372. section.
  373. For a description of the available mailing lists, see
  374. the
  375. "<ulink url='&YOCTO_DOCS_REF_URL;#resources-mailinglist'>Mailing Lists</ulink>"
  376. section in the Yocto Project Reference Manual.
  377. </para></listitem>
  378. </itemizedlist>
  379. </para></listitem>
  380. </orderedlist>
  381. </para>
  382. </section>
  383. <section id='dev-preparing-the-build-host'>
  384. <title>Preparing the Build Host</title>
  385. <para>
  386. This section provides procedures to set up a system to be used as your
  387. <ulink url='&YOCTO_DOCS_REF_URL;#hardware-build-system-term'>build host</ulink>
  388. for development using the Yocto Project.
  389. Your build host can be a native Linux machine (recommended) or it can
  390. be a machine (Linux, Mac, or Windows) that uses
  391. <ulink url='https://git.yoctoproject.org/cgit/cgit.cgi/crops/about/'>CROPS</ulink>,
  392. which leverages
  393. <ulink url='https://www.docker.com/'>Docker Containers</ulink>.
  394. </para>
  395. <para>
  396. Once your build host is set up to use the Yocto Project,
  397. further steps are necessary depending on what you want to
  398. accomplish.
  399. See the following references for information on how to prepare for
  400. Board Support Package (BSP) development, kernel development, and
  401. development using the <trademark class='trade'>Eclipse</trademark> IDE:
  402. <itemizedlist>
  403. <listitem><para>
  404. <emphasis>BSP Development:</emphasis>
  405. See the
  406. "<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>"
  407. section in the Yocto Project Board Support Package (BSP)
  408. Developer's Guide.
  409. </para></listitem>
  410. <listitem><para>
  411. <emphasis>Kernel Development:</emphasis>
  412. See the
  413. "<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>"
  414. section in the Yocto Project Linux Kernel Development Manual.
  415. </para></listitem>
  416. <listitem><para>
  417. <emphasis>Eclipse Development:</emphasis>
  418. See the
  419. "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-eclipse-project'>Developing Applications Using <trademark class='trade'>Eclipse</trademark></ulink>"
  420. Chapter in the Yocto Project Application Development and the
  421. Extensible Software Development Kit (eSDK) manual.
  422. </para></listitem>
  423. </itemizedlist>
  424. </para>
  425. <section id='setting-up-a-native-linux-host'>
  426. <title>Setting Up a Native Linux Host</title>
  427. <para>
  428. Follow these steps to prepare a native Linux machine as your
  429. Yocto Project Build Host:
  430. <orderedlist>
  431. <listitem><para>
  432. <emphasis>Use a Supported Linux Distribution:</emphasis>
  433. You should have a reasonably current Linux-based host
  434. system.
  435. You will have the best results with a recent release of
  436. Fedora, openSUSE, Debian, Ubuntu, or CentOS as these
  437. releases are frequently tested against the Yocto Project
  438. and officially supported.
  439. For a list of the distributions under validation and their
  440. status, see the
  441. "<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>" section
  442. in the Yocto Project Reference Manual and the wiki page at
  443. <ulink url='&YOCTO_WIKI_URL;/wiki/Distribution_Support'>Distribution Support</ulink>.
  444. </para></listitem>
  445. <listitem><para>
  446. <emphasis>Have Enough Free Memory:</emphasis>
  447. Your system should have at least 50 Gbytes of free disk
  448. space for building images.
  449. </para></listitem>
  450. <listitem><para>
  451. <emphasis>Meet Minimal Version Requirements:</emphasis>
  452. The OpenEmbedded build system should be able to run on any
  453. modern distribution that has the following versions for
  454. Git, tar, and Python.
  455. <itemizedlist>
  456. <listitem><para>
  457. Git 1.8.3.1 or greater
  458. </para></listitem>
  459. <listitem><para>
  460. tar 1.27 or greater
  461. </para></listitem>
  462. <listitem><para>
  463. Python 3.4.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-and-python-versions'>Required Git, tar, and Python 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-host-development-system'>Required Packages for the Host Development System</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://git.yoctoproject.org/cgit/cgit.cgi/crops/about/'>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 development host:
  519. <orderedlist>
  520. <listitem><para>
  521. <emphasis>Go to the Docker Installation Site:</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 host development machine.
  525. To start the installation process, see the
  526. <ulink url='https://docs.docker.com/engine/installation/'>Docker Installation</ulink>
  527. site.
  528. </para></listitem>
  529. <listitem><para>
  530. <emphasis>Choose Your Docker Edition:</emphasis>
  531. Docker comes in several editions.
  532. For the Yocto Project, the stable community edition
  533. (i.e. "Docker CE Stable") is adequate.
  534. You can learn more about the Docker editions from the
  535. site.
  536. </para></listitem>
  537. <listitem><para>
  538. <emphasis>Go to the Install Site for Your Platform:</emphasis>
  539. Click the link for the Docker edition associated with
  540. your development host machine's native software.
  541. For example, if your machine is running Microsoft
  542. Windows Version 10 and you want the Docker CE Stable
  543. edition, click that link under "Supported Platforms".
  544. </para></listitem>
  545. <listitem><para>
  546. <emphasis>Understand What You Need:</emphasis>
  547. The install page has pre-requisites your machine must
  548. meet.
  549. Be sure you read through this page and make sure your
  550. machine meets the requirements to run Docker.
  551. If your machine does not meet the requirements, the page
  552. has instructions to handle exceptions.
  553. For example, to run Docker on Windows 10, you must have
  554. the pro version of the operating system.
  555. If you have the home version, you need to install the
  556. <ulink url='https://docs.docker.com/toolbox/overview/#ready-to-get-started'>Docker Toolbox</ulink>.
  557. </para>
  558. <para>Another example is that a Windows machine needs to
  559. have Microsoft Hyper-V.
  560. If you have a legacy version of the the Microsoft
  561. operating system or for any other reason you do not have
  562. Microsoft Hyper-V, you would have to enter the BIOS and
  563. enable virtualization.
  564. </para></listitem>
  565. <listitem><para>
  566. <emphasis>Install the Software:</emphasis>
  567. Once you have understood all the pre-requisites, you can
  568. download and install the appropriate software.
  569. Follow the instructions for your specific machine and
  570. the type of the software you need to install.
  571. </para></listitem>
  572. <listitem><para>
  573. <emphasis>Optionally Orient Yourself With Docker:</emphasis>
  574. If you are unfamiliar with Docker and the container
  575. concept, you can learn more here -
  576. <ulink url='https://docs.docker.com/get-started/'></ulink>.
  577. You should be able to launch Docker or the Docker Toolbox
  578. and have a terminal shell on your development host.
  579. </para></listitem>
  580. <listitem><para>
  581. <emphasis>Set Up the Containers to Use the Yocto Project:</emphasis>
  582. Go to
  583. <ulink url='https://github.com/crops/docker-win-mac-docs/wiki'></ulink>
  584. and follow the directions for your particular
  585. development host (i.e. Linux, Mac, or Windows).</para>
  586. <para>Once you complete the setup instructions for your
  587. machine, you have the Poky, Extensible SDK, and Toaster
  588. containers available.
  589. You can click those links from the page and learn more
  590. about using each of those containers.
  591. </para></listitem>
  592. </orderedlist>
  593. Once you have a container set up, everything is in place to
  594. develop just as if you were running on a native Linux machine.
  595. If you are going to use the Poky container, see the
  596. "<link linkend='cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</link>"
  597. section.
  598. If you are going to use the Extensible SDK container, see the
  599. "<ulink url='&YOCTO_DOCS_SDK_URL;#sdk-extensible'>Using the Extensible SDK</ulink>"
  600. Chapter in the Yocto Project Application Development and the
  601. Extensible Software Development Kit (eSDK) manual.
  602. If you are going to use the Toaster container, see the
  603. "<ulink url='&YOCTO_DOCS_TOAST_URL;#toaster-manual-setup-and-use'>Setting Up and Using Toaster</ulink>"
  604. section in the Toaster User Manual.
  605. </para>
  606. </section>
  607. </section>
  608. <section id='locating-yocto-project-source-files'>
  609. <title>Locating Yocto Project Source Files</title>
  610. <para>
  611. This section contains procedures related to locating Yocto Project
  612. files.
  613. You establish and use these local files to work on projects.
  614. <note><title>Notes</title>
  615. <itemizedlist>
  616. <listitem><para>
  617. For concepts and introductory information about Git as it
  618. is used in the Yocto Project, see the
  619. "<ulink url='&YOCTO_DOCS_OM_URL;#git'>Git</ulink>"
  620. section in the Yocto Project Overview and Concepts Manual.
  621. </para></listitem>
  622. <listitem><para>
  623. For concepts on Yocto Project source repositories, see the
  624. "<ulink url='&YOCTO_DOCS_OM_URL;#yocto-project-repositories'>Yocto Project Source Repositories</ulink>"
  625. section in the Yocto Project Overview and Concepts Manual."
  626. </para></listitem>
  627. </itemizedlist>
  628. </note>
  629. </para>
  630. <section id='accessing-source-repositories'>
  631. <title>Accessing Source Repositories</title>
  632. <para>
  633. Working from a copy of the upstream Yocto Project
  634. <ulink url='&YOCTO_DOCS_OM_URL;#source-repositories'>Source Repositories</ulink>
  635. is the preferred method for obtaining and using a Yocto Project
  636. release.
  637. You can view the Yocto Project Source Repositories at
  638. <ulink url='&YOCTO_GIT_URL;'></ulink>.
  639. In particular, you can find the
  640. <filename>poky</filename> repository at
  641. <ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/poky/'></ulink>.
  642. </para>
  643. <para>
  644. Use the following procedure to locate the latest upstream copy of
  645. the <filename>poky</filename> Git repository:
  646. <orderedlist>
  647. <listitem><para>
  648. <emphasis>Access Repositories:</emphasis>
  649. Open a browser and go to
  650. <ulink url='&YOCTO_GIT_URL;'></ulink> to access the
  651. GUI-based interface into the Yocto Project source
  652. repositories.
  653. </para></listitem>
  654. <listitem><para>
  655. <emphasis>Select the Repository:</emphasis>
  656. Click on the repository in which you are interested (i.e.
  657. <filename>poky</filename>).
  658. </para></listitem>
  659. <listitem><para>
  660. <emphasis>Find the URL Used to Clone the Repository:</emphasis>
  661. At the bottom of the page, note the URL used to
  662. <ulink url='&YOCTO_DOCS_OM_URL;#git-commands-clone'>clone</ulink>
  663. that repository (e.g.
  664. <filename>&YOCTO_GIT_URL;/poky</filename>).
  665. <note>
  666. For information on cloning a repository, see the
  667. "<link linkend='cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</link>"
  668. section.
  669. </note>
  670. </para></listitem>
  671. </orderedlist>
  672. </para>
  673. </section>
  674. <section id='accessing-index-of-releases'>
  675. <title>Accessing Index of Releases</title>
  676. <para>
  677. Yocto Project maintains an Index of Releases area that contains
  678. related files that contribute to the Yocto Project.
  679. Rather than Git repositories, these files are tarballs that
  680. represent snapshots in time of a given component.
  681. <note><title>Tip</title>
  682. The recommended method for accessing Yocto Project
  683. components is to use Git to clone the upstream repository and
  684. work from within that locally cloned repository.
  685. The procedure in this section exists should you desire a
  686. tarball snapshot of any given component.
  687. </note>
  688. <orderedlist>
  689. <listitem><para>
  690. <emphasis>Access the Index of Releases:</emphasis>
  691. Open a browser and go to
  692. <ulink url='&YOCTO_DL_URL;/releases'></ulink> to access the
  693. Index of Releases.
  694. The list represents released components (e.g.
  695. <filename>eclipse-plugin</filename>,
  696. <filename>sato</filename>, and so on).
  697. <note>
  698. The <filename>yocto</filename> directory contains the
  699. full array of released Poky tarballs.
  700. The <filename>poky</filename> directory in the
  701. Index of Releases was historically used for very
  702. early releases and exists now only for retroactive
  703. completeness.
  704. </note>
  705. </para></listitem>
  706. <listitem><para>
  707. <emphasis>Select a Component:</emphasis>
  708. Click on any released component in which you are interested
  709. (e.g. <filename>yocto</filename>).
  710. </para></listitem>
  711. <listitem><para>
  712. <emphasis>Find the Tarball:</emphasis>
  713. Drill down to find the associated tarball.
  714. For example, click on <filename>yocto-&DISTRO;</filename> to
  715. view files associated with the Yocto Project &DISTRO;
  716. release (e.g. <filename>poky-&DISTRO_NAME_NO_CAP;-&POKYVERSION;.tar.bz2</filename>,
  717. which is the released Poky tarball).
  718. </para></listitem>
  719. <listitem><para>
  720. <emphasis>Download the Tarball:</emphasis>
  721. Click the tarball to download and save a snapshot of the
  722. given component.
  723. </para></listitem>
  724. </orderedlist>
  725. </para>
  726. </section>
  727. <section id='using-the-downloads-page'>
  728. <title>Using the Downloads Page</title>
  729. <para>
  730. The
  731. <ulink url='&YOCTO_HOME_URL;'>Yocto Project Website</ulink>
  732. uses a "DOWNLOADS" page from which you can locate and download
  733. tarballs of any Yocto Project release.
  734. Rather than Git repositories, these files represent snapshot
  735. tarballs.
  736. <note><title>Tip</title>
  737. The recommended method for accessing Yocto Project
  738. components is to use Git to clone a repository and work from
  739. within that local repository.
  740. The procedure in this section exists should you desire a
  741. tarball snapshot of any given component.
  742. </note>
  743. <orderedlist>
  744. <listitem><para>
  745. <emphasis>Go to the Yocto Project Website:</emphasis>
  746. Open The
  747. <ulink url='&YOCTO_HOME_URL;'>Yocto Project Website</ulink>
  748. in your browser.
  749. </para></listitem>
  750. <listitem><para>
  751. <emphasis>Get to the Downloads Area:</emphasis>
  752. Select the "DOWNLOADS" item from the pull-down
  753. "SOFTWARE" tab menu.
  754. </para></listitem>
  755. <listitem><para>
  756. <emphasis>Select a Yocto Project Release:</emphasis>
  757. Use the menu next to "RELEASE" to display and choose
  758. a Yocto Project release (e.g. sumo, rocko, pyro, and
  759. so forth.
  760. For a "map" of Yocto Project releases to version numbers,
  761. see the
  762. <ulink url='https://wiki.yoctoproject.org/wiki/Releases'>Releases</ulink>
  763. wiki page.
  764. </para></listitem>
  765. <listitem><para>
  766. <emphasis>Download Tools or Board Support Packages (BSPs):</emphasis>
  767. From the "DOWNLOADS" page, you can download tools or
  768. BSPs as well.
  769. Just scroll down the page and look for what you need.
  770. </para></listitem>
  771. </orderedlist>
  772. </para>
  773. </section>
  774. <section id='accessing-nightly-builds'>
  775. <title>Accessing Nightly Builds</title>
  776. <para>
  777. Yocto Project maintains an area for nightly builds that contains
  778. tarball releases at <ulink url='&YOCTO_AB_NIGHTLY_URL;'/>.
  779. These builds include Yocto Project releases, SDK installation
  780. scripts, and experimental builds.
  781. </para>
  782. <para>
  783. Should you ever want to access a nightly build of a particular
  784. Yocto Project component, use the following procedure:
  785. <orderedlist>
  786. <listitem><para>
  787. <emphasis>Access the Nightly Builds:</emphasis>
  788. Open a browser and go to
  789. <ulink url='&YOCTO_AB_NIGHTLY_URL;'/> to access the
  790. Nightly Builds.
  791. </para></listitem>
  792. <listitem><para>
  793. <emphasis>Select a Build:</emphasis>
  794. Click on any build by date in which you are interested.
  795. </para></listitem>
  796. <listitem><para>
  797. <emphasis>Find the Tarball:</emphasis>
  798. Drill down to find the associated tarball.
  799. </para></listitem>
  800. <listitem><para>
  801. <emphasis>Download the Tarball:</emphasis>
  802. Click the tarball to download and save a snapshot of the
  803. given component.
  804. </para></listitem>
  805. </orderedlist>
  806. </para>
  807. </section>
  808. </section>
  809. <section id='cloning-and-checking-out-branches'>
  810. <title>Cloning and Checking Out Branches</title>
  811. <para>
  812. To use the Yocto Project, you need a release of the Yocto Project
  813. locally installed on your development system.
  814. The locally installed set of files is referred to as the
  815. <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
  816. in the Yocto Project documentation.
  817. </para>
  818. <para>
  819. You create your Source Directory by using
  820. <ulink url='&YOCTO_DOCS_OM_URL;#git'>Git</ulink> to clone a local
  821. copy of the upstream <filename>poky</filename> repository.
  822. <note><title>Tip</title>
  823. The preferred method of getting the Yocto Project Source
  824. Directory set up is to clone the repository.
  825. </note>
  826. Working from a copy of the upstream repository allows you
  827. to contribute back into the Yocto Project or simply work with
  828. the latest software on a development branch.
  829. Because Git maintains and creates an upstream repository with
  830. a complete history of changes and you are working with a local
  831. clone of that repository, you have access to all the Yocto
  832. Project development branches and tag names used in the upstream
  833. repository.
  834. </para>
  835. <section id='cloning-the-poky-repository'>
  836. <title>Cloning the <filename>poky</filename> Repository</title>
  837. <para>
  838. Follow these steps to create a local version of the
  839. upstream
  840. <ulink url='&YOCTO_DOCS_REF_URL;#poky'><filename>poky</filename></ulink>
  841. Git repository.
  842. <orderedlist>
  843. <listitem><para>
  844. <emphasis>Set Your Directory:</emphasis>
  845. Be in the directory where you want to create your local
  846. copy of poky.
  847. </para></listitem>
  848. <listitem><para>
  849. <emphasis>Clone the Repository:</emphasis>
  850. The following command clones the repository and uses
  851. the default name "poky" for your local repository:
  852. <literallayout class='monospaced'>
  853. $ git clone git://git.yoctoproject.org/poky
  854. Cloning into 'poky'...
  855. remote: Counting objects: 367178, done.
  856. remote: Compressing objects: 100% (88161/88161), done.
  857. remote: Total 367178 (delta 272761), reused 366942 (delta 272525)
  858. Receiving objects: 100% (367178/367178), 133.26 MiB | 6.40 MiB/s, done.
  859. Resolving deltas: 100% (272761/272761), done.
  860. Checking connectivity... done.
  861. </literallayout>
  862. Unless you specify a specific development branch or
  863. tag name, Git clones the "master" branch, which results
  864. in a snapshot of the latest development changes for
  865. "master".
  866. For information on how to check out a specific
  867. development branch or on how to check out a local
  868. branch based on a tag name, see the
  869. "<link linkend='checking-out-by-branch-in-poky'>Checking Out By Branch in Poky</link>"
  870. and
  871. <link linkend='checkout-out-by-tag-in-poky'>Checking Out By Tag in Poky</link>"
  872. sections, respectively.</para>
  873. <para>Once the repository is created, you can change to
  874. that directory and check its status.
  875. Here, the single "master" branch exists on your system
  876. and by default, it is checked out:
  877. <literallayout class='monospaced'>
  878. $ cd ~/poky
  879. $ git status
  880. On branch master
  881. Your branch is up-to-date with 'origin/master'.
  882. nothing to commit, working directory clean
  883. $ git branch
  884. * master
  885. </literallayout>
  886. Your local repository of poky is identical to the
  887. upstream poky repository at the time from which it was
  888. cloned.
  889. </para></listitem>
  890. </orderedlist>
  891. </para>
  892. </section>
  893. <section id='checking-out-by-branch-in-poky'>
  894. <title>Checking Out by Branch in Poky</title>
  895. <para>
  896. When you clone the upstream poky repository, you have access to
  897. all its development branches.
  898. Each development branch in a repository is unique as it forks
  899. off the "master" branch.
  900. To see and use the files of a particular development branch
  901. locally, you need to know the branch name and then specifically
  902. check out that development branch.
  903. <note>
  904. Checking out an active development branch by branch name
  905. gives you a snapshot of that particular branch at the time
  906. you check it out.
  907. Further development on top of the branch that occurs after
  908. check it out can occur.
  909. </note>
  910. <orderedlist>
  911. <listitem><para>
  912. <emphasis>Switch to the Poky Directory:</emphasis>
  913. If you have a local poky Git repository, switch to that
  914. directory.
  915. If you do not have the local copy of poky, see the
  916. "<link linkend='cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</link>"
  917. section.
  918. </para></listitem>
  919. <listitem><para>
  920. <emphasis>Determine Existing Branch Names:</emphasis>
  921. <literallayout class='monospaced'>
  922. $ git branch -a
  923. * master
  924. remotes/origin/1.1_M1
  925. remotes/origin/1.1_M2
  926. remotes/origin/1.1_M3
  927. remotes/origin/1.1_M4
  928. remotes/origin/1.2_M1
  929. remotes/origin/1.2_M2
  930. remotes/origin/1.2_M3
  931. .
  932. .
  933. .
  934. remotes/origin/master-next
  935. remotes/origin/master-next2
  936. remotes/origin/morty
  937. remotes/origin/pinky
  938. remotes/origin/purple
  939. remotes/origin/pyro
  940. remotes/origin/rocko
  941. </literallayout>
  942. </para></listitem>
  943. <listitem><para>
  944. <emphasis>Checkout the Branch:</emphasis>
  945. Checkout the development branch in which you want to work.
  946. For example, to access the files for the Yocto Project
  947. &DISTRO; Release (&DISTRO_NAME;), use the following command:
  948. <literallayout class='monospaced'>
  949. $ git checkout -b &DISTRO_NAME_NO_CAP; origin/&DISTRO_NAME_NO_CAP;
  950. Branch &DISTRO_NAME_NO_CAP; set up to track remote branch &DISTRO_NAME_NO_CAP; from origin.
  951. Switched to a new branch '&DISTRO_NAME_NO_CAP;'
  952. </literallayout>
  953. The previous command checks out the "&DISTRO_NAME_NO_CAP;"
  954. development branch and reports that the branch is tracking
  955. the upstream "origin/&DISTRO_NAME_NO_CAP;" branch.</para>
  956. <para>The following command displays the branches
  957. that are now part of your local poky repository.
  958. The asterisk character indicates the branch that is
  959. currently checked out for work:
  960. <literallayout class='monospaced'>
  961. $ git branch
  962. master
  963. * &DISTRO_NAME_NO_CAP;
  964. </literallayout>
  965. </para></listitem>
  966. </orderedlist>
  967. </para>
  968. </section>
  969. <section id='checkout-out-by-tag-in-poky'>
  970. <title>Checking Out by Tag in Poky</title>
  971. <para>
  972. Similar to branches, the upstream repository uses tags
  973. to mark specific commits associated with significant points in
  974. a development branch (i.e. a release point or stage of a
  975. release).
  976. You might want to set up a local branch based on one of those
  977. points in the repository.
  978. The process is similar to checking out by branch name except you
  979. use tag names.
  980. <note>
  981. Checking out a branch based on a tag gives you a
  982. stable set of files not affected by development on the
  983. branch above the tag.
  984. </note>
  985. <orderedlist>
  986. <listitem><para>
  987. <emphasis>Switch to the Poky Directory:</emphasis>
  988. If you have a local poky Git repository, switch to that
  989. directory.
  990. If you do not have the local copy of poky, see the
  991. "<link linkend='cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</link>"
  992. section.
  993. </para></listitem>
  994. <listitem><para>
  995. <emphasis>Fetch the Tag Names:</emphasis>
  996. To checkout the branch based on a tag name, you need to
  997. fetch the upstream tags into your local repository:
  998. <literallayout class='monospaced'>
  999. $ git fetch --tags
  1000. $
  1001. </literallayout>
  1002. </para></listitem>
  1003. <listitem><para>
  1004. <emphasis>List the Tag Names:</emphasis>
  1005. You can list the tag names now:
  1006. <literallayout class='monospaced'>
  1007. $ git tag
  1008. 1.1_M1.final
  1009. 1.1_M1.rc1
  1010. 1.1_M1.rc2
  1011. 1.1_M2.final
  1012. 1.1_M2.rc1
  1013. .
  1014. .
  1015. .
  1016. yocto-2.2
  1017. yocto-2.2.1
  1018. yocto-2.3
  1019. yocto-2.3.1
  1020. yocto-2.4
  1021. yocto_1.5_M5.rc8
  1022. </literallayout>
  1023. </para></listitem>
  1024. <listitem><para>
  1025. <emphasis>Checkout the Branch:</emphasis>
  1026. <literallayout class='monospaced'>
  1027. $ git checkout tags/&DISTRO_REL_TAG; -b my_yocto_&DISTRO;
  1028. Switched to a new branch 'my_yocto_&DISTRO;'
  1029. $ git branch
  1030. master
  1031. * my_yocto_&DISTRO;
  1032. </literallayout>
  1033. The previous command creates and checks out a local
  1034. branch named "my_yocto_&DISTRO;", which is based on
  1035. the commit in the upstream poky repository that has
  1036. the same tag.
  1037. In this example, the files you have available locally
  1038. as a result of the <filename>checkout</filename>
  1039. command are a snapshot of the
  1040. "&DISTRO_NAME_NO_CAP;" development branch at the point
  1041. where Yocto Project &DISTRO; was released.
  1042. </para></listitem>
  1043. </orderedlist>
  1044. </para>
  1045. </section>
  1046. </section>
  1047. </chapter>
  1048. <!--
  1049. vim: expandtab tw=80 ts=4
  1050. -->