dev-manual-newbie.xml 81 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526
  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-newbie'>
  5. <title>The Yocto Project Open Source Development Environment</title>
  6. <para>
  7. This chapter helps you understand the Yocto Project as an open source development project.
  8. In general, working in an open source environment is very different from working in a
  9. closed, proprietary environment.
  10. Additionally, the Yocto Project uses specific tools and constructs as part of its development
  11. environment.
  12. This chapter specifically addresses open source philosophy, using the
  13. Yocto Project in a team environment, source repositories, Yocto Project
  14. terms, licensing, the open source distributed version control system Git,
  15. workflows, bug tracking, and how to submit changes.
  16. </para>
  17. <section id='open-source-philosophy'>
  18. <title>Open Source Philosophy</title>
  19. <para>
  20. Open source philosophy is characterized by software development directed by peer production
  21. and collaboration through an active community of developers.
  22. Contrast this to the more standard centralized development models used by commercial software
  23. companies where a finite set of developers produces a product for sale using a defined set
  24. of procedures that ultimately result in an end product whose architecture and source material
  25. are closed to the public.
  26. </para>
  27. <para>
  28. Open source projects conceptually have differing concurrent agendas, approaches, and production.
  29. These facets of the development process can come from anyone in the public (community) that has a
  30. stake in the software project.
  31. The open source environment contains new copyright, licensing, domain, and consumer issues
  32. that differ from the more traditional development environment.
  33. In an open source environment, the end product, source material, and documentation are
  34. all available to the public at no cost.
  35. </para>
  36. <para>
  37. A benchmark example of an open source project is the Linux kernel, which was initially conceived
  38. and created by Finnish computer science student Linus Torvalds in 1991.
  39. Conversely, a good example of a non-open source project is the
  40. <trademark class='registered'>Windows</trademark> family of operating
  41. systems developed by <trademark class='registered'>Microsoft</trademark> Corporation.
  42. </para>
  43. <para>
  44. Wikipedia has a good historical description of the Open Source Philosophy
  45. <ulink url='http://en.wikipedia.org/wiki/Open_source'>here</ulink>.
  46. You can also find helpful information on how to participate in the Linux Community
  47. <ulink url='http://ldn.linuxfoundation.org/book/how-participate-linux-community'>here</ulink>.
  48. </para>
  49. </section>
  50. <section id="usingpoky-changes-collaborate">
  51. <title>Using the Yocto Project in a Team Environment</title>
  52. <para>
  53. It might not be immediately clear how you can use the Yocto
  54. Project in a team environment, or scale it for a large team of
  55. developers.
  56. One of the strengths of the Yocto Project is that it is extremely
  57. flexible.
  58. Thus, you can adapt it to many different use cases and scenarios.
  59. However, these characteristics can cause a struggle if you are trying
  60. to create a working setup that scales across a large team.
  61. </para>
  62. <para>
  63. To help with these types of situations, this section presents
  64. some of the project's most successful experiences,
  65. practices, solutions, and available technologies that work well.
  66. Keep in mind, the information here is a starting point.
  67. You can build off it and customize it to fit any
  68. particular working environment and set of practices.
  69. </para>
  70. <section id='best-practices-system-configurations'>
  71. <title>System Configurations</title>
  72. <para>
  73. Systems across a large team should meet the needs of
  74. two types of developers: those working on the contents of the
  75. operating system image itself and those developing applications.
  76. Regardless of the type of developer, their workstations must
  77. be both reasonably powerful and run Linux.
  78. </para>
  79. <section id='best-practices-application-development'>
  80. <title>Application Development</title>
  81. <para>
  82. For developers who mainly do application level work
  83. on top of an existing software stack,
  84. the following list shows practices that work best.
  85. For information on using a Software Development Kit (SDK), see
  86. the
  87. <ulink url='&YOCTO_DOCS_SDK_URL;#sdk-intro'>Yocto Project Software Development Kit (SDK) Developer's Guide</ulink>:
  88. <itemizedlist>
  89. <listitem><para>Use a pre-built toolchain that
  90. contains the software stack itself.
  91. Then, develop the application code on top of the
  92. stack.
  93. This method works well for small numbers of relatively
  94. isolated applications.</para></listitem>
  95. <listitem><para>When possible, use the Yocto Project
  96. plug-in for the <trademark class='trade'>Eclipse</trademark> IDE
  97. and SDK development practices.
  98. For more information, see the
  99. "<ulink url='&YOCTO_DOCS_SDK_URL;'>Yocto Project Software Development Kit (SDK) Developer's Guide</ulink>".
  100. </para></listitem>
  101. <listitem><para>Keep your cross-development toolchains
  102. updated.
  103. You can do this through provisioning either as new
  104. toolchain downloads or as updates through a package
  105. update mechanism using <filename>opkg</filename>
  106. to provide updates to an existing toolchain.
  107. The exact mechanics of how and when to do this are a
  108. question for local policy.</para></listitem>
  109. <listitem><para>Use multiple toolchains installed locally
  110. into different locations to allow development across
  111. versions.</para></listitem>
  112. </itemizedlist>
  113. </para>
  114. </section>
  115. <section id='best-practices-core-system-development'>
  116. <title>Core System Development</title>
  117. <para>
  118. For core system development, it is often best to have the
  119. build system itself available on the developer workstations
  120. so developers can run their own builds and directly
  121. rebuild the software stack.
  122. You should keep the core system unchanged as much as
  123. possible and do your work in layers on top of the core system.
  124. Doing so gives you a greater level of portability when
  125. upgrading to new versions of the core system or Board
  126. Support Packages (BSPs).
  127. You can share layers amongst the developers of a particular
  128. project and contain the policy configuration that defines
  129. the project.
  130. </para>
  131. <para>
  132. Aside from the previous best practices, there exists a number
  133. of tips and tricks that can help speed up core development
  134. projects:
  135. <itemizedlist>
  136. <listitem><para>Use a
  137. <ulink url='&YOCTO_DOCS_REF_URL;#shared-state-cache'>Shared State Cache</ulink>
  138. (sstate) among groups of developers who are on a
  139. fast network.
  140. The best way to share sstate is through a
  141. Network File System (NFS) share.
  142. The first user to build a given component for the
  143. first time contributes that object to the sstate,
  144. while subsequent builds from other developers then
  145. reuse the object rather than rebuild it themselves.
  146. </para>
  147. <para>Although it is possible to use other protocols for the
  148. sstate such as HTTP and FTP, you should avoid these.
  149. Using HTTP limits the sstate to read-only and
  150. FTP provides poor performance.
  151. </para></listitem>
  152. <listitem><para>Have autobuilders contribute to the sstate
  153. pool similarly to how the developer workstations
  154. contribute.
  155. For information, see the
  156. "<link linkend='best-practices-autobuilders'>Autobuilders</link>"
  157. section.</para></listitem>
  158. <listitem><para>Build stand-alone tarballs that contain
  159. "missing" system requirements if for some reason
  160. developer workstations do not meet minimum system
  161. requirements such as latest Python versions,
  162. <filename>chrpath</filename>, or other tools.
  163. You can install and relocate the tarball exactly as you
  164. would the usual cross-development toolchain so that
  165. all developers can meet minimum version requirements
  166. on most distributions.</para></listitem>
  167. <listitem><para>Use a small number of shared,
  168. high performance systems for testing purposes
  169. (e.g. dual, six-core Xeons with 24 Gbytes of RAM
  170. and plenty of disk space).
  171. Developers can use these systems for wider, more
  172. extensive testing while they continue to develop
  173. locally using their primary development system.
  174. </para></listitem>
  175. <listitem><para>Enable the PR Service when package feeds
  176. need to be incremental with continually increasing
  177. <ulink url='&YOCTO_DOCS_REF_URL;#var-PR'>PR</ulink>
  178. values.
  179. Typically, this situation occurs when you use or
  180. publish package feeds and use a shared state.
  181. You should enable the PR Service for all users who
  182. use the shared state pool.
  183. For more information on the PR Service, see the
  184. "<link linkend='working-with-a-pr-service'>Working With a PR Service</link>".
  185. </para></listitem>
  186. </itemizedlist>
  187. </para>
  188. </section>
  189. </section>
  190. <section id='best-practices-source-control-management'>
  191. <title>Source Control Management (SCM)</title>
  192. <para>
  193. Keeping your
  194. <ulink url='&YOCTO_DOCS_DEV_URL;#metadata'>Metadata</ulink>
  195. and any software you are developing under the
  196. control of an SCM system that is compatible
  197. with the OpenEmbedded build system is advisable.
  198. Of the SCMs BitBake supports, the
  199. Yocto Project team strongly recommends using
  200. <link linkend='git'>Git</link>.
  201. Git is a distributed system that is easy to backup,
  202. allows you to work remotely, and then connects back to the
  203. infrastructure.
  204. <note>
  205. For information about BitBake, see the
  206. <ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
  207. </note>
  208. </para>
  209. <para>
  210. It is relatively easy to set up Git services and create
  211. infrastructure like
  212. <ulink url='&YOCTO_GIT_URL;'>http://git.yoctoproject.org</ulink>,
  213. which is based on server software called
  214. <filename>gitolite</filename> with <filename>cgit</filename>
  215. being used to generate the web interface that lets you view the
  216. repositories.
  217. The <filename>gitolite</filename> software identifies users
  218. using SSH keys and allows branch-based
  219. access controls to repositories that you can control as little
  220. or as much as necessary.
  221. </para>
  222. <note>
  223. The setup of these services is beyond the scope of this manual.
  224. However, sites such as these exist that describe how to perform
  225. setup:
  226. <itemizedlist>
  227. <listitem><para><ulink url='http://git-scm.com/book/ch4-8.html'>Git documentation</ulink>:
  228. Describes how to install <filename>gitolite</filename>
  229. on the server.</para></listitem>
  230. <listitem><para><ulink url='http://sitaramc.github.com/gitolite/master-toc.html'>The <filename>gitolite</filename> master index</ulink>:
  231. All topics for <filename>gitolite</filename>.
  232. </para></listitem>
  233. <listitem><para><ulink url='https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools'>Interfaces, frontends, and tools</ulink>:
  234. Documentation on how to create interfaces and frontends
  235. for Git.</para></listitem>
  236. </itemizedlist>
  237. </note>
  238. </section>
  239. <section id='best-practices-autobuilders'>
  240. <title>Autobuilders</title>
  241. <para>
  242. Autobuilders are often the core of a development project.
  243. It is here that changes from individual developers are brought
  244. together and centrally tested and subsequent decisions about
  245. releases can be made.
  246. Autobuilders also allow for "continuous integration" style
  247. testing of software components and regression identification
  248. and tracking.
  249. </para>
  250. <para>
  251. See "<ulink url='http://autobuilder.yoctoproject.org'>Yocto Project Autobuilder</ulink>"
  252. for more information and links to buildbot.
  253. The Yocto Project team has found this implementation
  254. works well in this role.
  255. A public example of this is the Yocto Project
  256. Autobuilders, which we use to test the overall health of the
  257. project.
  258. </para>
  259. <para>
  260. The features of this system are:
  261. <itemizedlist>
  262. <listitem><para>Highlights when commits break the build.
  263. </para></listitem>
  264. <listitem><para>Populates an sstate cache from which
  265. developers can pull rather than requiring local
  266. builds.</para></listitem>
  267. <listitem><para>Allows commit hook triggers,
  268. which trigger builds when commits are made.
  269. </para></listitem>
  270. <listitem><para>Allows triggering of automated image booting
  271. and testing under the QuickEMUlator (QEMU).
  272. </para></listitem>
  273. <listitem><para>Supports incremental build testing and
  274. from-scratch builds.</para></listitem>
  275. <listitem><para>Shares output that allows developer
  276. testing and historical regression investigation.
  277. </para></listitem>
  278. <listitem><para>Creates output that can be used for releases.
  279. </para></listitem>
  280. <listitem><para>Allows scheduling of builds so that resources
  281. can be used efficiently.</para></listitem>
  282. </itemizedlist>
  283. </para>
  284. </section>
  285. <section id='best-practices-policies-and-change-flow'>
  286. <title>Policies and Change Flow</title>
  287. <para>
  288. The Yocto Project itself uses a hierarchical structure and a
  289. pull model.
  290. Scripts exist to create and send pull requests
  291. (i.e. <filename>create-pull-request</filename> and
  292. <filename>send-pull-request</filename>).
  293. This model is in line with other open source projects where
  294. maintainers are responsible for specific areas of the project
  295. and a single maintainer handles the final "top-of-tree" merges.
  296. </para>
  297. <note>
  298. You can also use a more collective push model.
  299. The <filename>gitolite</filename> software supports both the
  300. push and pull models quite easily.
  301. </note>
  302. <para>
  303. As with any development environment, it is important
  304. to document the policy used as well as any main project
  305. guidelines so they are understood by everyone.
  306. It is also a good idea to have well structured
  307. commit messages, which are usually a part of a project's
  308. guidelines.
  309. Good commit messages are essential when looking back in time and
  310. trying to understand why changes were made.
  311. </para>
  312. <para>
  313. If you discover that changes are needed to the core layer of the
  314. project, it is worth sharing those with the community as soon
  315. as possible.
  316. Chances are if you have discovered the need for changes, someone
  317. else in the community needs them also.
  318. </para>
  319. </section>
  320. <section id='best-practices-summary'>
  321. <title>Summary</title>
  322. <para>
  323. This section summarizes the key recommendations described in the
  324. previous sections:
  325. <itemizedlist>
  326. <listitem><para>Use <link linkend='git'>Git</link>
  327. as the source control system.</para></listitem>
  328. <listitem><para>Maintain your Metadata in layers that make sense
  329. for your situation.
  330. See the "<link linkend='understanding-and-creating-layers'>Understanding
  331. and Creating Layers</link>" section for more information on
  332. layers.</para></listitem>
  333. <listitem><para>
  334. Separate the project's Metadata and code by using
  335. separate Git repositories.
  336. See the
  337. "<link linkend='yocto-project-repositories'>Yocto Project Source Repositories</link>"
  338. section for information on these repositories.
  339. See the
  340. "<link linkend='getting-setup'>Getting Set Up</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>Set up the directory for the shared state cache
  346. (<ulink url='&YOCTO_DOCS_REF_URL;#var-SSTATE_DIR'><filename>SSTATE_DIR</filename></ulink>)
  347. where it makes sense.
  348. For example, set up the sstate cache on a system used
  349. by developers in the same organization and share the
  350. same source directories on their machines.
  351. </para></listitem>
  352. <listitem><para>Set up an Autobuilder and have it populate the
  353. sstate cache and source directories.</para></listitem>
  354. <listitem><para>The Yocto Project community encourages you
  355. to send patches to the project to fix bugs or add features.
  356. If you do submit patches, follow the project commit
  357. guidelines for writing good commit messages.
  358. See the "<link linkend='how-to-submit-a-change'>How to Submit a Change</link>"
  359. section.</para></listitem>
  360. <listitem><para>Send changes to the core sooner than later
  361. as others are likely to run into the same issues.
  362. For some guidance on mailing lists to use, see the list in the
  363. "<link linkend='how-to-submit-a-change'>How to Submit a Change</link>"
  364. section.
  365. For a description of the available mailing lists, see the
  366. "<ulink url='&YOCTO_DOCS_REF_URL;#resources-mailinglist'>Mailing Lists</ulink>"
  367. section in the Yocto Project Reference Manual.
  368. </para></listitem>
  369. </itemizedlist>
  370. </para>
  371. </section>
  372. </section>
  373. <section id='yocto-project-repositories'>
  374. <title>Yocto Project Source Repositories</title>
  375. <para>
  376. The Yocto Project team maintains complete source repositories for all
  377. Yocto Project files at
  378. <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi'></ulink>.
  379. This web-based source code browser is organized into categories by
  380. function such as IDE Plugins, Matchbox, Poky, Yocto Linux Kernel, and
  381. so forth.
  382. From the interface, you can click on any particular item in the "Name"
  383. column and see the URL at the bottom of the page that you need to clone
  384. a Git repository for that particular item.
  385. Having a local Git repository of the
  386. <link linkend='source-directory'>Source Directory</link>, which is
  387. usually named "poky", allows
  388. you to make changes, contribute to the history, and ultimately enhance
  389. the Yocto Project's tools, Board Support Packages, and so forth.
  390. </para>
  391. <para>
  392. For any supported release of Yocto Project, you can also go to the
  393. <ulink url='&YOCTO_HOME_URL;'>Yocto Project Website</ulink> and
  394. select the "Downloads" tab and get a released tarball of the
  395. <filename>poky</filename> repository or any supported BSP tarballs.
  396. Unpacking these tarballs gives you a snapshot of the released
  397. files.
  398. <note><title>Notes</title>
  399. <itemizedlist>
  400. <listitem><para>
  401. The recommended method for setting up the Yocto Project
  402. <link linkend='source-directory'>Source Directory</link>
  403. and the files for supported BSPs
  404. (e.g., <filename>meta-intel</filename>) is to use
  405. <link linkend='git'>Git</link> to create a local copy of
  406. the upstream repositories.
  407. </para></listitem>
  408. <listitem><para>
  409. Be sure to always work in matching branches for both
  410. the selected BSP repository and the
  411. <link linkend='source-directory'>Source Directory</link>
  412. (i.e. <filename>poky</filename>) repository.
  413. For example, if you have checked out the "master" branch
  414. of <filename>poky</filename> and you are going to use
  415. <filename>meta-intel</filename>, be sure to checkout the
  416. "master" branch of <filename>meta-intel</filename>.
  417. </para></listitem>
  418. </itemizedlist>
  419. </note>
  420. </para>
  421. <para>
  422. In summary, here is where you can get the project files needed for development:
  423. <itemizedlist>
  424. <listitem><para id='source-repositories'><emphasis><ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi'>Source Repositories:</ulink></emphasis>
  425. This area contains IDE Plugins, Matchbox, Poky, Poky Support, Tools, Yocto Linux Kernel, and Yocto
  426. Metadata Layers.
  427. You can create local copies of Git repositories for each of these areas.</para>
  428. <para>
  429. <imagedata fileref="figures/source-repos.png" align="center" width="6in" depth="4in" />
  430. </para></listitem>
  431. <listitem><para><anchor id='index-downloads' /><emphasis><ulink url='&YOCTO_DL_URL;/releases/'>Index of /releases:</ulink></emphasis>
  432. This is an index of releases such as
  433. the <trademark class='trade'>Eclipse</trademark>
  434. Yocto Plug-in, miscellaneous support, Poky, Pseudo, installers for cross-development toolchains,
  435. and all released versions of Yocto Project in the form of images or tarballs.
  436. Downloading and extracting these files does not produce a local copy of the
  437. Git repository but rather a snapshot of a particular release or image.</para>
  438. <para>
  439. <imagedata fileref="figures/index-downloads.png" align="center" width="6in" depth="3.5in" />
  440. </para></listitem>
  441. <listitem><para><emphasis>"Downloads" page for the
  442. <ulink url='&YOCTO_HOME_URL;'>Yocto Project Website</ulink>:</emphasis>
  443. Access this page by going to the website and then selecting
  444. the "Downloads" tab.
  445. This page allows you to download any Yocto Project
  446. release or Board Support Package (BSP) in tarball form.
  447. The tarballs are similar to those found in the
  448. <ulink url='&YOCTO_DL_URL;/releases/'>Index of /releases:</ulink> area.</para>
  449. <para>
  450. <imagedata fileref="figures/yp-download.png" align="center" width="6in" depth="4in" />
  451. </para></listitem>
  452. </itemizedlist>
  453. </para>
  454. </section>
  455. <section id='licensing'>
  456. <title>Licensing</title>
  457. <para>
  458. Because open source projects are open to the public, they have different licensing structures in place.
  459. License evolution for both Open Source and Free Software has an interesting history.
  460. If you are interested in this history, you can find basic information here:
  461. <itemizedlist>
  462. <listitem><para><ulink url='http://en.wikipedia.org/wiki/Open-source_license'>Open source license history</ulink>
  463. </para></listitem>
  464. <listitem><para><ulink url='http://en.wikipedia.org/wiki/Free_software_license'>Free software license
  465. history</ulink></para></listitem>
  466. </itemizedlist>
  467. </para>
  468. <para>
  469. In general, the Yocto Project is broadly licensed under the Massachusetts Institute of Technology
  470. (MIT) License.
  471. MIT licensing permits the reuse of software within proprietary software as long as the
  472. license is distributed with that software.
  473. MIT is also compatible with the GNU General Public License (GPL).
  474. Patches to the Yocto Project follow the upstream licensing scheme.
  475. You can find information on the MIT license
  476. <ulink url='http://www.opensource.org/licenses/mit-license.php'>here</ulink>.
  477. You can find information on the GNU GPL <ulink url='http://www.opensource.org/licenses/LGPL-3.0'>
  478. here</ulink>.
  479. </para>
  480. <para>
  481. When you build an image using the Yocto Project, the build process uses a
  482. known list of licenses to ensure compliance.
  483. You can find this list in the
  484. <link linkend='source-directory'>Source Directory</link> at
  485. <filename>meta/files/common-licenses</filename>.
  486. Once the build completes, the list of all licenses found and used during that build are
  487. kept in the
  488. <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>
  489. at <filename>tmp/deploy/licenses</filename>.
  490. </para>
  491. <para>
  492. If a module requires a license that is not in the base list, the build process
  493. generates a warning during the build.
  494. These tools make it easier for a developer to be certain of the licenses with which
  495. their shipped products must comply.
  496. However, even with these tools it is still up to the developer to resolve potential licensing issues.
  497. </para>
  498. <para>
  499. The base list of licenses used by the build process is a combination of the Software Package
  500. Data Exchange (SPDX) list and the Open Source Initiative (OSI) projects.
  501. <ulink url='http://spdx.org'>SPDX Group</ulink> is a working group of the Linux Foundation
  502. that maintains a specification
  503. for a standard format for communicating the components, licenses, and copyrights
  504. associated with a software package.
  505. <ulink url='http://opensource.org'>OSI</ulink> is a corporation dedicated to the Open Source
  506. Definition and the effort for reviewing and approving licenses that
  507. conform to the Open Source Definition (OSD).
  508. </para>
  509. <para>
  510. You can find a list of the combined SPDX and OSI licenses that the
  511. Yocto Project uses in the
  512. <filename>meta/files/common-licenses</filename> directory in your
  513. <link linkend='source-directory'>Source Directory</link>.
  514. </para>
  515. <para>
  516. For information that can help you maintain compliance with various
  517. open source licensing during the lifecycle of a product created using
  518. the Yocto Project, see the
  519. "<link linkend='maintaining-open-source-license-compliance-during-your-products-lifecycle'>Maintaining Open Source License Compliance During Your Product's Lifecycle</link>"
  520. section.
  521. </para>
  522. </section>
  523. <section id='git'>
  524. <title>Git</title>
  525. <para>
  526. The Yocto Project makes extensive use of Git,
  527. which is a free, open source distributed version control system.
  528. Git supports distributed development, non-linear development, and can handle large projects.
  529. It is best that you have some fundamental understanding of how Git tracks projects and
  530. how to work with Git if you are going to use the Yocto Project for development.
  531. This section provides a quick overview of how Git works and provides you with a summary
  532. of some essential Git commands.
  533. </para>
  534. <para>
  535. For more information on Git, see
  536. <ulink url='http://git-scm.com/documentation'></ulink>.
  537. If you need to download Git, go to <ulink url='http://git-scm.com/download'></ulink>.
  538. </para>
  539. <section id='repositories-tags-and-branches'>
  540. <title>Repositories, Tags, and Branches</title>
  541. <para>
  542. As mentioned earlier in the section
  543. "<link linkend='yocto-project-repositories'>Yocto Project Source Repositories</link>",
  544. the Yocto Project maintains source repositories at
  545. <ulink url='&YOCTO_GIT_URL;/cgit.cgi'></ulink>.
  546. If you look at this web-interface of the repositories, each item is a separate
  547. Git repository.
  548. </para>
  549. <para>
  550. Git repositories use branching techniques that track content change (not files)
  551. within a project (e.g. a new feature or updated documentation).
  552. Creating a tree-like structure based on project divergence allows for excellent historical
  553. information over the life of a project.
  554. This methodology also allows for an environment from which you can do lots of
  555. local experimentation on projects as you develop changes or new features.
  556. </para>
  557. <para>
  558. A Git repository represents all development efforts for a given project.
  559. For example, the Git repository <filename>poky</filename> contains all changes
  560. and developments for Poky over the course of its entire life.
  561. That means that all changes that make up all releases are captured.
  562. The repository maintains a complete history of changes.
  563. </para>
  564. <para>
  565. You can create a local copy of any repository by "cloning" it with the Git
  566. <filename>clone</filename> command.
  567. When you clone a Git repository, you end up with an identical copy of the
  568. repository on your development system.
  569. Once you have a local copy of a repository, you can take steps to develop locally.
  570. For examples on how to clone Git repositories, see the
  571. "<link linkend='getting-setup'>Getting Set Up</link>" section.
  572. </para>
  573. <para>
  574. It is important to understand that Git tracks content change and
  575. not files.
  576. Git uses "branches" to organize different development efforts.
  577. For example, the <filename>poky</filename> repository has
  578. several branches that include the current
  579. <filename>&DISTRO_NAME_NO_CAP;</filename> branch, the
  580. <filename>master</filename> branch, and many branches for past
  581. Yocto Project releases.
  582. You can see all the branches by going to
  583. <ulink url='&YOCTO_GIT_URL;/cgit.cgi/poky/'></ulink> and
  584. clicking on the
  585. <filename><ulink url='&YOCTO_GIT_URL;/cgit.cgi/poky/refs/heads'>[...]</ulink></filename>
  586. link beneath the "Branch" heading.
  587. </para>
  588. <para>
  589. Each of these branches represents a specific area of development.
  590. The <filename>master</filename> branch represents the current or most recent
  591. development.
  592. All other branches represent offshoots of the <filename>master</filename>
  593. branch.
  594. </para>
  595. <para>
  596. When you create a local copy of a Git repository, the copy has the same set
  597. of branches as the original.
  598. This means you can use Git to create a local working area (also called a branch)
  599. that tracks a specific development branch from the source Git repository.
  600. in other words, you can define your local Git environment to work on any development
  601. branch in the repository.
  602. To help illustrate, here is a set of commands that creates a local copy of the
  603. <filename>poky</filename> Git repository and then creates and checks out a local
  604. Git branch that tracks the Yocto Project &DISTRO; Release (&DISTRO_NAME;) development:
  605. <literallayout class='monospaced'>
  606. $ cd ~
  607. $ git clone git://git.yoctoproject.org/poky
  608. $ cd poky
  609. $ git checkout -b &DISTRO_NAME_NO_CAP; origin/&DISTRO_NAME_NO_CAP;
  610. </literallayout>
  611. In this example, the name of the top-level directory of your local
  612. <link linkend='source-directory'>Source Directory</link>
  613. is "poky" and the name of that local working area (local branch)
  614. you just created and checked out is "&DISTRO_NAME_NO_CAP;".
  615. The files in your local repository now reflect the same files that
  616. are in the "&DISTRO_NAME_NO_CAP;" development branch of the
  617. Yocto Project's "poky" upstream repository.
  618. It is important to understand that when you create and checkout a
  619. local working branch based on a branch name,
  620. your local environment matches the "tip" of that development branch
  621. at the time you created your local branch, which could be
  622. different from the files at the time of a similarly named release.
  623. In other words, creating and checking out a local branch based on
  624. the "&DISTRO_NAME_NO_CAP;" branch name is not the same as
  625. cloning and checking out the "master" branch.
  626. Keep reading to see how you create a local snapshot of a Yocto
  627. Project Release.
  628. </para>
  629. <para>
  630. Git uses "tags" to mark specific changes in a repository.
  631. Typically, a tag is used to mark a special point such as the final
  632. change before a project is released.
  633. You can see the tags used with the <filename>poky</filename> Git
  634. repository by going to
  635. <ulink url='&YOCTO_GIT_URL;/cgit.cgi/poky/'></ulink> and
  636. clicking on the
  637. <filename><ulink url='&YOCTO_GIT_URL;/cgit.cgi/poky/refs/tags'>[...]</ulink></filename>
  638. link beneath the "Tag" heading.
  639. </para>
  640. <para>
  641. Some key tags are
  642. <filename>dizzy-12.0.0</filename>,
  643. <filename>fido-13.0.0</filename>,
  644. <filename>jethro-14.0.0</filename>, and
  645. <filename>&DISTRO_NAME_NO_CAP;-&POKYVERSION;</filename>.
  646. These tags represent Yocto Project releases.
  647. </para>
  648. <para>
  649. When you create a local copy of the Git repository, you also have access to all the
  650. tags.
  651. Similar to branches, you can create and checkout a local working Git branch based
  652. on a tag name.
  653. When you do this, you get a snapshot of the Git repository that reflects
  654. the state of the files when the change was made associated with that tag.
  655. The most common use is to checkout a working branch that matches a specific
  656. Yocto Project release.
  657. Here is an example:
  658. <literallayout class='monospaced'>
  659. $ cd ~
  660. $ git clone git://git.yoctoproject.org/poky
  661. $ cd poky
  662. $ git checkout -b my-&DISTRO_NAME_NO_CAP;-&POKYVERSION; &DISTRO_NAME_NO_CAP;-&POKYVERSION;
  663. </literallayout>
  664. In this example, the name of the top-level directory of your local Yocto Project
  665. Files Git repository is <filename>poky</filename>.
  666. And, the name of the local branch you have created and checked out is
  667. <filename>my-&DISTRO_NAME_NO_CAP;-&POKYVERSION;</filename>.
  668. The files in your repository now exactly match the Yocto Project &DISTRO;
  669. Release tag (<filename>&DISTRO_NAME_NO_CAP;-&POKYVERSION;</filename>).
  670. It is important to understand that when you create and checkout a local
  671. working branch based on a tag, your environment matches a specific point
  672. in time and not the entire development branch.
  673. </para>
  674. </section>
  675. <section id='basic-commands'>
  676. <title>Basic Commands</title>
  677. <para>
  678. Git has an extensive set of commands that lets you manage changes and perform
  679. collaboration over the life of a project.
  680. Conveniently though, you can manage with a small set of basic operations and workflows
  681. once you understand the basic philosophy behind Git.
  682. You do not have to be an expert in Git to be functional.
  683. A good place to look for instruction on a minimal set of Git commands is
  684. <ulink url='http://git-scm.com/documentation'>here</ulink>.
  685. If you need to download Git, you can do so
  686. <ulink url='http://git-scm.com/download'>here</ulink>, although
  687. any reasonably current Linux distribution should already have an
  688. installable package for Git.
  689. </para>
  690. <para>
  691. If you do not know much about Git, you should educate
  692. yourself by visiting the links previously mentioned.
  693. </para>
  694. <para>
  695. The following list briefly describes some basic Git operations as a way to get started.
  696. As with any set of commands, this list (in most cases) simply shows the base command and
  697. omits the many arguments they support.
  698. See the Git documentation for complete descriptions and strategies on how to use these commands:
  699. <itemizedlist>
  700. <listitem><para><emphasis><filename>git init</filename>:</emphasis> Initializes an empty Git repository.
  701. You cannot use Git commands unless you have a <filename>.git</filename> repository.</para></listitem>
  702. <listitem><para><emphasis><filename>git clone</filename>:</emphasis>
  703. Creates a local clone of a Git repository.
  704. During collaboration, this command allows you to create a
  705. local Git repository that is on equal footing with a fellow
  706. developer’s Git repository.
  707. </para></listitem>
  708. <listitem><para><emphasis><filename>git add</filename>:</emphasis> Stages updated file contents
  709. to the index that
  710. Git uses to track changes.
  711. You must stage all files that have changed before you can commit them.</para></listitem>
  712. <listitem><para><emphasis><filename>git commit</filename>:</emphasis> Creates a "commit" that documents
  713. the changes you made.
  714. Commits are used for historical purposes, for determining if a maintainer of a project
  715. will allow the change, and for ultimately pushing the change from your local Git repository
  716. into the project’s upstream (or master) repository.</para></listitem>
  717. <listitem><para><emphasis><filename>git status</filename>:</emphasis> Reports any modified files that
  718. possibly need to be staged and committed.</para></listitem>
  719. <listitem><para><emphasis><filename>git checkout</filename> <replaceable>branch-name</replaceable>:</emphasis> Changes
  720. your working branch.
  721. This command is analogous to "cd".</para></listitem>
  722. <listitem><para><emphasis><filename>git checkout –b</filename> <replaceable>working-branch</replaceable>:</emphasis> Creates
  723. a working branch on your local machine where you can isolate work.
  724. It is a good idea to use local branches when adding specific features or changes.
  725. This way if you do not like what you have done you can easily get rid of the work.</para></listitem>
  726. <listitem><para><emphasis><filename>git branch</filename>:</emphasis> Reports
  727. existing local branches and
  728. tells you the branch in which you are currently working.</para></listitem>
  729. <listitem><para><emphasis><filename>git branch -D</filename> <replaceable>branch-name</replaceable>:</emphasis>
  730. Deletes an existing local branch.
  731. You need to be in a local branch other than the one you are deleting
  732. in order to delete <replaceable>branch-name</replaceable>.</para></listitem>
  733. <listitem><para><emphasis><filename>git pull</filename>:</emphasis> Retrieves information
  734. from an upstream Git
  735. repository and places it in your local Git repository.
  736. You use this command to make sure you are synchronized with the repository
  737. from which you are basing changes (.e.g. the master branch).</para></listitem>
  738. <listitem><para><emphasis><filename>git push</filename>:</emphasis>
  739. Sends all your committed local changes to an upstream Git
  740. repository (e.g. a contribution repository).
  741. The maintainer of the project draws from these repositories
  742. when adding changes to the project’s master repository or
  743. other development branch.
  744. </para></listitem>
  745. <listitem><para><emphasis><filename>git merge</filename>:</emphasis> Combines or adds changes from one
  746. local branch of your repository with another branch.
  747. When you create a local Git repository, the default branch is named "master".
  748. A typical workflow is to create a temporary branch for isolated work, make and commit your
  749. changes, switch to your local master branch, merge the changes from the temporary branch into the
  750. local master branch, and then delete the temporary branch.</para></listitem>
  751. <listitem><para><emphasis><filename>git cherry-pick</filename>:</emphasis> Choose and apply specific
  752. commits from one branch into another branch.
  753. There are times when you might not be able to merge all the changes in one branch with
  754. another but need to pick out certain ones.</para></listitem>
  755. <listitem><para><emphasis><filename>gitk</filename>:</emphasis> Provides a GUI view of the branches
  756. and changes in your local Git repository.
  757. This command is a good way to graphically see where things have diverged in your
  758. local repository.</para></listitem>
  759. <listitem><para><emphasis><filename>git log</filename>:</emphasis> Reports a history of your changes to the
  760. repository.</para></listitem>
  761. <listitem><para><emphasis><filename>git diff</filename>:</emphasis> Displays line-by-line differences
  762. between your local working files and the same files in the upstream Git repository that your
  763. branch currently tracks.</para></listitem>
  764. </itemizedlist>
  765. </para>
  766. </section>
  767. </section>
  768. <section id='workflows'>
  769. <title>Workflows</title>
  770. <para>
  771. This section provides some overview on workflows using Git.
  772. In particular, the information covers basic practices that describe roles and actions in a
  773. collaborative development environment.
  774. Again, if you are familiar with this type of development environment, you might want to just
  775. skip this section.
  776. </para>
  777. <para>
  778. The Yocto Project files are maintained using Git in a "master" branch whose Git history
  779. tracks every change and whose structure provides branches for all diverging functionality.
  780. Although there is no need to use Git, many open source projects do so.
  781. For the Yocto Project, a key individual called the "maintainer" is responsible for the "master"
  782. branch of a given Git repository.
  783. The "master" branch is the “upstream” repository where the final builds of the project occur.
  784. The maintainer is responsible for accepting changes from other developers and for
  785. organizing the underlying branch structure to reflect release strategies and so forth.
  786. <note>For information on finding out who is responsible for (maintains)
  787. a particular area of code, see the
  788. "<link linkend='how-to-submit-a-change'>How to Submit a Change</link>"
  789. section.
  790. </note>
  791. </para>
  792. <para>
  793. The project also has an upstream contribution Git repository named
  794. <filename>poky-contrib</filename>.
  795. You can see all the branches in this repository using the web interface
  796. of the
  797. <ulink url='&YOCTO_GIT_URL;'>Source Repositories</ulink> organized
  798. within the "Poky Support" area.
  799. These branches temporarily hold changes to the project that have been
  800. submitted or committed by the Yocto Project development team and by
  801. community members who contribute to the project.
  802. The maintainer determines if the changes are qualified to be moved
  803. from the "contrib" branches into the "master" branch of the Git
  804. repository.
  805. </para>
  806. <para>
  807. Developers (including contributing community members) create and maintain cloned repositories
  808. of the upstream "master" branch.
  809. These repositories are local to their development platforms and are used to develop changes.
  810. When a developer is satisfied with a particular feature or change, they "push" the changes
  811. to the appropriate "contrib" repository.
  812. </para>
  813. <para>
  814. Developers are responsible for keeping their local repository up-to-date with "master".
  815. They are also responsible for straightening out any conflicts that might arise within files
  816. that are being worked on simultaneously by more than one person.
  817. All this work is done locally on the developer’s machines before anything is pushed to a
  818. "contrib" area and examined at the maintainer’s level.
  819. </para>
  820. <para>
  821. A somewhat formal method exists by which developers commit changes and push them into the
  822. "contrib" area and subsequently request that the maintainer include them into "master"
  823. This process is called “submitting a patch” or "submitting a change."
  824. For information on submitting patches and changes, see the
  825. "<link linkend='how-to-submit-a-change'>How to Submit a Change</link>" section.
  826. </para>
  827. <para>
  828. To summarize the environment: a single point of entry exists for
  829. changes into the project’s "master" branch of the Git repository,
  830. which is controlled by the project’s maintainer.
  831. And, a set of developers exist who independently develop, test, and
  832. submit changes to "contrib" areas for the maintainer to examine.
  833. The maintainer then chooses which changes are going to become a
  834. permanent part of the project.
  835. </para>
  836. <para>
  837. <imagedata fileref="figures/git-workflow.png" width="6in" depth="3in" align="left" scalefit="1" />
  838. </para>
  839. <para>
  840. While each development environment is unique, there are some best practices or methods
  841. that help development run smoothly.
  842. The following list describes some of these practices.
  843. For more information about Git workflows, see the workflow topics in the
  844. <ulink url='http://book.git-scm.com'>Git Community Book</ulink>.
  845. <itemizedlist>
  846. <listitem><para><emphasis>Make Small Changes:</emphasis> It is best to keep the changes you commit
  847. small as compared to bundling many disparate changes into a single commit.
  848. This practice not only keeps things manageable but also allows the maintainer
  849. to more easily include or refuse changes.</para>
  850. <para>It is also good practice to leave the repository in a state that allows you to
  851. still successfully build your project. In other words, do not commit half of a feature,
  852. then add the other half as a separate, later commit.
  853. Each commit should take you from one buildable project state to another
  854. buildable state.</para></listitem>
  855. <listitem><para><emphasis>Use Branches Liberally:</emphasis> It is very easy to create, use, and
  856. delete local branches in your working Git repository.
  857. You can name these branches anything you like.
  858. It is helpful to give them names associated with the particular feature or change
  859. on which you are working.
  860. Once you are done with a feature or change and have merged it
  861. into your local master branch, simply discard the temporary
  862. branch.</para></listitem>
  863. <listitem><para><emphasis>Merge Changes:</emphasis> The <filename>git merge</filename>
  864. command allows you to take the
  865. changes from one branch and fold them into another branch.
  866. This process is especially helpful when more than a single developer might be working
  867. on different parts of the same feature.
  868. Merging changes also automatically identifies any collisions or "conflicts"
  869. that might happen as a result of the same lines of code being altered by two different
  870. developers.</para></listitem>
  871. <listitem><para><emphasis>Manage Branches:</emphasis> Because branches are easy to use, you should
  872. use a system where branches indicate varying levels of code readiness.
  873. For example, you can have a "work" branch to develop in, a "test" branch where the code or
  874. change is tested, a "stage" branch where changes are ready to be committed, and so forth.
  875. As your project develops, you can merge code across the branches to reflect ever-increasing
  876. stable states of the development.</para></listitem>
  877. <listitem><para><emphasis>Use Push and Pull:</emphasis> The push-pull workflow is based on the
  878. concept of developers "pushing" local commits to a remote repository, which is
  879. usually a contribution repository.
  880. This workflow is also based on developers "pulling" known states of the project down into their
  881. local development repositories.
  882. The workflow easily allows you to pull changes submitted by other developers from the
  883. upstream repository into your work area ensuring that you have the most recent software
  884. on which to develop.
  885. The Yocto Project has two scripts named <filename>create-pull-request</filename> and
  886. <filename>send-pull-request</filename> that ship with the release to facilitate this
  887. workflow.
  888. You can find these scripts in the <filename>scripts</filename>
  889. folder of the
  890. <link linkend='source-directory'>Source Directory</link>.
  891. For information on how to use these scripts, see the
  892. "<link linkend='pushing-a-change-upstream'>Using Scripts to Push a Change Upstream and Request a Pull</link>" section.
  893. </para></listitem>
  894. <listitem><para><emphasis>Patch Workflow:</emphasis> This workflow allows you to notify the
  895. maintainer through an email that you have a change (or patch) you would like considered
  896. for the "master" branch of the Git repository.
  897. To send this type of change, you format the patch and then send the email using the Git commands
  898. <filename>git format-patch</filename> and <filename>git send-email</filename>.
  899. For information on how to use these scripts, see the
  900. "<link linkend='how-to-submit-a-change'>How to Submit a Change</link>"
  901. section.
  902. </para></listitem>
  903. </itemizedlist>
  904. </para>
  905. </section>
  906. <section id='submitting-a-defect-against-the-yocto-project'>
  907. <title>Submitting a Defect Against the Yocto Project</title>
  908. <para>
  909. Use the Yocto Project implementation of
  910. <ulink url='http://www.bugzilla.org/about/'>Bugzilla</ulink>
  911. to submit a defect (bug) against the Yocto Project.
  912. For additional information on this implementation of Bugzilla see the
  913. "<ulink url='&YOCTO_DOCS_REF_URL;#resources-bugtracker'>Yocto Project Bugzilla</ulink>"
  914. section in the Yocto Project Reference Manual.
  915. For more detail on any of the following steps, see the Yocto Project
  916. <ulink url='&YOCTO_WIKI_URL;/wiki/Bugzilla_Configuration_and_Bug_Tracking'>Bugzilla wiki page</ulink>.
  917. </para>
  918. <para>
  919. Use the following general steps to submit a bug"
  920. <orderedlist>
  921. <listitem><para>
  922. Open the Yocto Project implementation of
  923. <ulink url='&YOCTO_BUGZILLA_URL;'>Bugzilla</ulink>.
  924. </para></listitem>
  925. <listitem><para>
  926. Click "File a Bug" to enter a new bug.
  927. </para></listitem>
  928. <listitem><para>
  929. Choose the appropriate "Classification", "Product", and
  930. "Component" for which the bug was found.
  931. Bugs for the Yocto Project fall into one of several
  932. classifications, which in turn break down into several
  933. products and components.
  934. For example, for a bug against the
  935. <filename>meta-intel</filename> layer, you would choose
  936. "Build System, Metadata &amp; Runtime", "BSPs", and
  937. "bsps-meta-intel", respectively.
  938. </para></listitem>
  939. <listitem><para>
  940. Choose the "Version" of the Yocto Project for which you found
  941. the bug (e.g. &DISTRO;).
  942. </para></listitem>
  943. <listitem><para>
  944. Determine and select the "Severity" of the bug.
  945. The severity indicates how the bug impacted your work.
  946. </para></listitem>
  947. <listitem><para>
  948. Choose the "Hardware" that the bug impacts.
  949. </para></listitem>
  950. <listitem><para>
  951. Choose the "Architecture" that the bug impacts.
  952. </para></listitem>
  953. <listitem><para>
  954. Choose a "Documentation change" item for the bug.
  955. Fixing a bug might or might not affect the Yocto Project
  956. documentation.
  957. If you are unsure of the impact to the documentation, select
  958. "Don't Know".
  959. </para></listitem>
  960. <listitem><para>
  961. Provide a brief "Summary" of the bug.
  962. Try to limit your summary to just a line or two and be sure
  963. to capture the essence of the bug.
  964. </para></listitem>
  965. <listitem><para>
  966. Provide a detailed "Description" of the bug.
  967. You should provide as much detail as you can about the context,
  968. behavior, output, and so forth that surrounds the bug.
  969. You can even attach supporting files for output from logs by
  970. using the "Add an attachment" button.
  971. </para></listitem>
  972. <listitem><para>
  973. Click the "Submit Bug" button submit the bug.
  974. A new Bugzilla number is assigned to the bug and the defect
  975. is logged in the bug tracking system.
  976. </para></listitem>
  977. </orderedlist>
  978. Once you file a bug, the bug is processed by the Yocto Project Bug
  979. Triage Team and further details concerning the bug are assigned
  980. (e.g. priority and owner).
  981. You are the "Submitter" of the bug and any further categorization,
  982. progress, or comments on the bug result in Bugzilla sending you an
  983. automated email concerning the particular change or progress to the
  984. bug.
  985. </para>
  986. </section>
  987. <section id='how-to-submit-a-change'>
  988. <title>How to Submit a Change</title>
  989. <para>
  990. Contributions to the Yocto Project and OpenEmbedded are very welcome.
  991. Because the system is extremely configurable and flexible, we recognize that developers
  992. will want to extend, configure or optimize it for their specific uses.
  993. You should send patches to the appropriate mailing list so that they
  994. can be reviewed and merged by the appropriate maintainer.
  995. </para>
  996. <section id='submit-change-overview'>
  997. <title>Overview</title>
  998. <para>
  999. The Yocto Project uses a mailing list and patch-based workflow
  1000. that is similar to the Linux kernel but contains important
  1001. differences.
  1002. In general, a mailing list exists through which you can submit
  1003. patches.
  1004. The specific mailing list you need to use depends on the
  1005. location of the code you are changing.
  1006. Each component (e.g. layer) should have a
  1007. <filename>README</filename> file that indicates where to send
  1008. the changes and which process to follow.
  1009. </para>
  1010. <para>
  1011. You can send the patch to the mailing list using whichever approach
  1012. you feel comfortable with to generate the patch.
  1013. Once sent, the patch is usually reviewed by the community at large.
  1014. If somebody has concerns with the patch, they will usually voice
  1015. their concern over the mailing list.
  1016. If a patch does not receive any negative reviews, the maintainer of
  1017. the affected layer typically takes the patch, tests it, and then
  1018. based on successful testing, merges the patch.
  1019. </para>
  1020. <para>
  1021. Specific to OpenEmbedded-Core, two commonly used testing trees
  1022. exist:
  1023. <itemizedlist>
  1024. <listitem><para>
  1025. <emphasis>"ross/mut" branch:</emphasis>
  1026. The "mut" (master-under-test) tree
  1027. exists in the <filename>poky-contrib</filename> repository
  1028. in the
  1029. <ulink url='&YOCTO_GIT_URL;'>Yocto Project source repositories</ulink>.
  1030. </para></listitem>
  1031. <listitem><para>
  1032. <emphasis>"master-next" branch:</emphasis>
  1033. This branch is part of the main
  1034. "poky" repository in the Yocto Project source repositories.
  1035. </para></listitem>
  1036. </itemizedlist>
  1037. Maintainers use these branches to test submissions prior to merging
  1038. patches.
  1039. Thus, you can get an idea of the status of a patch based on
  1040. whether the patch has been merged into one of these branches.
  1041. </para>
  1042. <para>
  1043. This system is imperfect and patches can sometimes get lost in the
  1044. flow.
  1045. Asking about the status of a patch is reasonable if the patch
  1046. has been idle for a while with no feedback.
  1047. The Yocto Project does have plans to use
  1048. <ulink url='https://en.wikipedia.org/wiki/Patchwork_(software)'>Patchwork</ulink>
  1049. to track the status of patches and also to automatically preview
  1050. patches.
  1051. </para>
  1052. <para>
  1053. The following sections provide general instructions for both
  1054. pushing changes upstream and for submitting changes as patches.
  1055. </para>
  1056. </section>
  1057. <section id='submit-change-submissions-to-poky'>
  1058. <title>Submissions to Poky</title>
  1059. <para>
  1060. The "poky" repository, which is the Yocto Project's reference build
  1061. environment, is a hybrid repository that contains several
  1062. individual pieces (e.g. BitBake, OpenEmbedded-Core, meta-yocto,
  1063. documentation, and so forth) built using the combo-layer tool.
  1064. The upstream location used for submitting changes varies by
  1065. component:
  1066. <itemizedlist>
  1067. <listitem><para>
  1068. <emphasis>Core Metadata:</emphasis>
  1069. Send your patch to the
  1070. <ulink url='http://lists.openembedded.org/mailman/listinfo/openembedded-core'>openembedded-core</ulink>
  1071. mailing list. For example, a change to anything under
  1072. the <filename>meta</filename> or
  1073. <filename>scripts</filename> directories should be sent
  1074. to this mailing list.
  1075. </para></listitem>
  1076. <listitem><para>
  1077. <emphasis>BitBake:</emphasis>
  1078. For changes to BitBake (i.e. anything under the
  1079. <filename>bitbake</filename> directory), send your patch
  1080. to the
  1081. <ulink url='http://lists.openembedded.org/mailman/listinfo/bitbake-devel'>bitbake-devel</ulink>
  1082. mailing list.
  1083. </para></listitem>
  1084. <listitem><para>
  1085. <emphasis>"meta-yocto-bsp" and "meta-poky" trees:</emphasis>
  1086. These trees are
  1087. part of the "meta-yocto" repository in the Yocto Project
  1088. source repositories.
  1089. Use the
  1090. <ulink url='https://lists.yoctoproject.org/listinfo/poky'>poky</ulink>
  1091. mailing list.
  1092. </para></listitem>
  1093. </itemizedlist>
  1094. </para>
  1095. </section>
  1096. <section id='submit-change-submissions-to-other-layers'>
  1097. <title>Submissions to Other Layers</title>
  1098. <para>
  1099. For changes to other layers hosted in the Yocto Project source
  1100. repositories (i.e. <filename>yoctoproject.org</filename>), tools,
  1101. and the Yocto Project documentation, use the
  1102. <ulink url='https://lists.yoctoproject.org/listinfo/yocto'>Yocto Project</ulink>
  1103. general mailing list.
  1104. <note>
  1105. Sometimes a layer's documentation specifies to use a
  1106. particular mailing list.
  1107. If so, use that list.
  1108. </note>
  1109. For additional recipes that do not fit into the core Metadata, you
  1110. should determine which layer the recipe should go into and submit
  1111. the change in the manner recommended by the documentation (e.g.
  1112. the <filename>README</filename> file) supplied with the layer.
  1113. If in doubt, please ask on the Yocto general mailing list or on
  1114. the openembedded-devel mailing list.
  1115. </para>
  1116. </section>
  1117. <section id='submit-change-patch-submission-details'>
  1118. <title>Patch Submission Details</title>
  1119. <para>
  1120. When submitting any change, you can check who you should be
  1121. notifying.
  1122. Use either of these methods to find out:
  1123. <itemizedlist>
  1124. <listitem><para>
  1125. <emphasis>Maintenance File:</emphasis>
  1126. Examine the <filename>maintainers.inc</filename> file, which is
  1127. located in the
  1128. <link linkend='source-directory'>Source Directory</link>
  1129. at <filename>meta-poky/conf/distro/include</filename>, to
  1130. see who is responsible for code.
  1131. </para></listitem>
  1132. <listitem><para>
  1133. <emphasis>Search by File:</emphasis>
  1134. Using <link linkend='git'>Git</link>, you can enter the
  1135. following command to bring up a short list of all commits
  1136. against a specific file:
  1137. <literallayout class='monospaced'>
  1138. git shortlog -- <replaceable>filename</replaceable>
  1139. </literallayout>
  1140. Just provide the name of the file for which you are interested.
  1141. The information returned is not ordered by history but does
  1142. include a list of everyone who has committed grouped by
  1143. name.
  1144. From the list, you can see who is responsible for the bulk of
  1145. the changes against the file.
  1146. </para></listitem>
  1147. </itemizedlist>
  1148. </para>
  1149. <para>
  1150. For a list of the Yocto Project and related mailing lists, see the
  1151. "<ulink url='&YOCTO_DOCS_REF_URL;#resources-mailinglist'>Mailing lists</ulink>"
  1152. section in the Yocto Project Reference Manual.
  1153. </para>
  1154. <para>
  1155. When you send a patch, be sure to include a "Signed-off-by:"
  1156. line in the same style as required by the Linux kernel.
  1157. Adding this line signifies that you, the submitter, have agreed
  1158. to the Developer's Certificate of Origin 1.1 as follows:
  1159. <literallayout class='monospaced'>
  1160. Developer's Certificate of Origin 1.1
  1161. By making a contribution to this project, I certify that:
  1162. (a) The contribution was created in whole or in part by me and I
  1163. have the right to submit it under the open source license
  1164. indicated in the file; or
  1165. (b) The contribution is based upon previous work that, to the best
  1166. of my knowledge, is covered under an appropriate open source
  1167. license and I have the right under that license to submit that
  1168. work with modifications, whether created in whole or in part
  1169. by me, under the same open source license (unless I am
  1170. permitted to submit under a different license), as indicated
  1171. in the file; or
  1172. (c) The contribution was provided directly to me by some other
  1173. person who certified (a), (b) or (c) and I have not modified
  1174. it.
  1175. (d) I understand and agree that this project and the contribution
  1176. are public and that a record of the contribution (including all
  1177. personal information I submit with it, including my sign-off) is
  1178. maintained indefinitely and may be redistributed consistent with
  1179. this project or the open source license(s) involved.
  1180. </literallayout>
  1181. </para>
  1182. <para>
  1183. In a collaborative environment, it is necessary to have some sort
  1184. of standard or method through which you submit changes.
  1185. Otherwise, things could get quite chaotic.
  1186. One general practice to follow is to make small, controlled changes.
  1187. Keeping changes small and isolated aids review, makes
  1188. merging/rebasing easier and keeps the change history clean should
  1189. anyone need to refer to it in future.
  1190. </para>
  1191. <para>
  1192. When you make a commit, you must follow certain standards
  1193. established by the OpenEmbedded and Yocto Project development teams.
  1194. For each commit, you must provide a single-line summary of the
  1195. change and you should almost always provide a more detailed
  1196. description of what you did (i.e. the body of the commit message).
  1197. The only exceptions for not providing a detailed description would
  1198. be if your change is a simple, self-explanatory change that needs
  1199. no further description beyond the summary.
  1200. Here are the guidelines for composing a commit message:
  1201. <itemizedlist>
  1202. <listitem><para>
  1203. Provide a single-line, short summary of the change.
  1204. This summary is typically viewable in the "shortlist" of
  1205. changes.
  1206. Thus, providing something short and descriptive that
  1207. gives the reader a summary of the change is useful when
  1208. viewing a list of many commits.
  1209. You should prefix this short description with the recipe
  1210. name (if changing a recipe), or else with the short form
  1211. path to the file being changed.
  1212. </para></listitem>
  1213. <listitem><para>
  1214. For the body of the commit message, provide detailed
  1215. information that describes what you changed, why you made
  1216. the change, and the approach you used.
  1217. It might also be helpful if you mention how you tested
  1218. the change.
  1219. Provide as much detail as you can in the body of the
  1220. commit message.
  1221. </para></listitem>
  1222. <listitem><para>
  1223. If the change addresses a specific bug or issue that is
  1224. associated with a bug-tracking ID, include a reference
  1225. to that ID in your detailed description.
  1226. For example, the Yocto Project uses a specific convention
  1227. for bug references - any commit that addresses a specific
  1228. bug should use the following form for the detailed
  1229. description:
  1230. <literallayout class='monospaced'>
  1231. Fixes [YOCTO #<replaceable>bug-id</replaceable>]
  1232. <replaceable>detailed description of change</replaceable>
  1233. </literallayout>
  1234. </para></listitem>
  1235. Where <replaceable>bug-id</replaceable> is replaced with the
  1236. specific bug ID from the Yocto Project Bugzilla instance.
  1237. </itemizedlist>
  1238. </para>
  1239. <para>
  1240. You can find more guidance on creating well-formed commit messages
  1241. at this OpenEmbedded wiki page:
  1242. <ulink url='&OE_HOME_URL;/wiki/Commit_Patch_Message_Guidelines'></ulink>.
  1243. </para>
  1244. </section>
  1245. <section id='pushing-a-change-upstream'>
  1246. <title>Using Scripts to Push a Change Upstream and Request a Pull</title>
  1247. <para>
  1248. The basic flow for pushing a change to an upstream "contrib" Git repository is as follows:
  1249. <itemizedlist>
  1250. <listitem><para>Make your changes in your local Git repository.</para></listitem>
  1251. <listitem><para>Stage your changes by using the <filename>git add</filename>
  1252. command on each file you changed.</para></listitem>
  1253. <listitem><para>
  1254. Commit the change by using the
  1255. <filename>git commit</filename> command.
  1256. Be sure to provide a commit message that follows the
  1257. project’s commit message standards as described earlier.
  1258. </para></listitem>
  1259. <listitem><para>
  1260. Push the change to the upstream "contrib" repository by
  1261. using the <filename>git push</filename> command.
  1262. </para></listitem>
  1263. <listitem><para>Notify the maintainer that you have pushed a change by making a pull
  1264. request.
  1265. The Yocto Project provides two scripts that conveniently let you generate and send
  1266. pull requests to the Yocto Project.
  1267. These scripts are <filename>create-pull-request</filename> and
  1268. <filename>send-pull-request</filename>.
  1269. You can find these scripts in the <filename>scripts</filename> directory
  1270. within the <link linkend='source-directory'>Source Directory</link>.</para>
  1271. <para>Using these scripts correctly formats the requests without introducing any
  1272. whitespace or HTML formatting.
  1273. The maintainer that receives your patches needs to be able to save and apply them
  1274. directly from your emails.
  1275. Using these scripts is the preferred method for sending patches.</para>
  1276. <para>For help on using these scripts, simply provide the
  1277. <filename>-h</filename> argument as follows:
  1278. <literallayout class='monospaced'>
  1279. $ poky/scripts/create-pull-request -h
  1280. $ poky/scripts/send-pull-request -h
  1281. </literallayout></para></listitem>
  1282. </itemizedlist>
  1283. </para>
  1284. <para>
  1285. You can find general Git information on how to push a change upstream in the
  1286. <ulink url='http://git-scm.com/book/en/v2/Distributed-Git-Distributed-Workflows'>Git Community Book</ulink>.
  1287. </para>
  1288. </section>
  1289. <section id='submitting-a-patch'>
  1290. <title>Using Email to Submit a Patch</title>
  1291. <para>
  1292. You can submit patches without using the <filename>create-pull-request</filename> and
  1293. <filename>send-pull-request</filename> scripts described in the previous section.
  1294. However, keep in mind, the preferred method is to use the scripts.
  1295. </para>
  1296. <para>
  1297. Depending on the components changed, you need to submit the email
  1298. to a specific mailing list.
  1299. For some guidance on which mailing list to use, see the list in the
  1300. "<link linkend='how-to-submit-a-change'>How to Submit a Change</link>"
  1301. section.
  1302. For a description of the available mailing lists, see the
  1303. "<ulink url='&YOCTO_DOCS_REF_URL;#resources-mailinglist'>Mailing Lists</ulink>"
  1304. section in the Yocto Project Reference Manual.
  1305. </para>
  1306. <para>
  1307. Here is the general procedure on how to submit a patch through email without using the
  1308. scripts:
  1309. <orderedlist>
  1310. <listitem><para>
  1311. Make your changes in your local Git repository.
  1312. </para></listitem>
  1313. <listitem><para>
  1314. Stage your changes by using the
  1315. <filename>git add</filename> command on each file you
  1316. changed.
  1317. </para></listitem>
  1318. <listitem><para>
  1319. Commit the change by using the
  1320. <filename>git commit --signoff</filename> command.
  1321. Using the <filename>--signoff</filename> option identifies
  1322. you as the person making the change and also satisfies
  1323. the Developer's Certificate of Origin (DCO) shown earlier.
  1324. </para>
  1325. <para>When you form a commit, you must follow certain
  1326. standards established by the Yocto Project development
  1327. team.
  1328. See the earlier section
  1329. "<link linkend='how-to-submit-a-change'>How to Submit a Change</link>"
  1330. for Yocto Project commit message standards.
  1331. </para></listitem>
  1332. <listitem><para>Format the commit into an email message.
  1333. To format commits, use the
  1334. <filename>git format-patch</filename> command.
  1335. When you provide the command, you must include a revision
  1336. list or a number of patches as part of the command.
  1337. For example, either of these two commands takes your most
  1338. recent single commit and formats it as an email message in
  1339. the current directory:
  1340. <literallayout class='monospaced'>
  1341. $ git format-patch -1
  1342. </literallayout>
  1343. or
  1344. <literallayout class='monospaced'>
  1345. $ git format-patch HEAD~
  1346. </literallayout></para>
  1347. <para>After the command is run, the current directory
  1348. contains a numbered <filename>.patch</filename> file for
  1349. the commit.</para>
  1350. <para>If you provide several commits as part of the
  1351. command, the <filename>git format-patch</filename> command
  1352. produces a series of numbered files in the current
  1353. directory – one for each commit.
  1354. If you have more than one patch, you should also use the
  1355. <filename>--cover</filename> option with the command,
  1356. which generates a cover letter as the first "patch" in
  1357. the series.
  1358. You can then edit the cover letter to provide a
  1359. description for the series of patches.
  1360. For information on the
  1361. <filename>git format-patch</filename> command,
  1362. see <filename>GIT_FORMAT_PATCH(1)</filename> displayed
  1363. using the <filename>man git-format-patch</filename>
  1364. command.
  1365. <note>
  1366. If you are or will be a frequent contributor to the
  1367. Yocto Project or to OpenEmbedded, you might consider
  1368. requesting a contrib area and the necessary associated
  1369. rights.
  1370. </note>
  1371. </para></listitem>
  1372. <listitem><para>
  1373. Import the files into your mail client by using the
  1374. <filename>git send-email</filename> command.
  1375. <note>
  1376. In order to use <filename>git send-email</filename>,
  1377. you must have the proper Git packages installed on
  1378. your host.
  1379. For Ubuntu, Debian, and Fedora the package is
  1380. <filename>git-email</filename>.
  1381. </note></para>
  1382. <para>The <filename>git send-email</filename> command
  1383. sends email by using a local or remote Mail Transport Agent
  1384. (MTA) such as <filename>msmtp</filename>,
  1385. <filename>sendmail</filename>, or through a direct
  1386. <filename>smtp</filename> configuration in your Git
  1387. <filename>~/.gitconfig</filename> file.
  1388. If you are submitting patches through email only, it is
  1389. very important that you submit them without any whitespace
  1390. or HTML formatting that either you or your mailer
  1391. introduces.
  1392. The maintainer that receives your patches needs to be able
  1393. to save and apply them directly from your emails.
  1394. A good way to verify that what you are sending will be
  1395. applicable by the maintainer is to do a dry run and send
  1396. them to yourself and then save and apply them as the
  1397. maintainer would.</para>
  1398. <para>The <filename>git send-email</filename> command is
  1399. the preferred method for sending your patches since there
  1400. is no risk of compromising whitespace in the body of the
  1401. message, which can occur when you use your own mail client.
  1402. The command also has several options that let you
  1403. specify recipients and perform further editing of the
  1404. email message.
  1405. For information on how to use the
  1406. <filename>git send-email</filename> command,
  1407. see <filename>GIT-SEND-EMAIL(1)</filename> displayed using
  1408. the <filename>man git-send-email</filename> command.
  1409. </para></listitem>
  1410. </orderedlist>
  1411. </para>
  1412. </section>
  1413. </section>
  1414. </chapter>
  1415. <!--
  1416. vim: expandtab tw=80 ts=4
  1417. -->