development-environment.rst 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. *****************************************
  3. The Yocto Project Development Environment
  4. *****************************************
  5. This chapter takes a look at the Yocto Project development environment.
  6. The chapter provides Yocto Project Development environment concepts that
  7. help you understand how work is accomplished in an open source
  8. environment, which is very different as compared to work accomplished in
  9. a closed, proprietary environment.
  10. Specifically, this chapter addresses open source philosophy, source
  11. repositories, workflows, Git, and licensing.
  12. Open Source Philosophy
  13. ======================
  14. Open source philosophy is characterized by software development directed
  15. by peer production and collaboration through an active community of
  16. developers. Contrast this to the more standard centralized development
  17. models used by commercial software companies where a finite set of
  18. developers produces a product for sale using a defined set of procedures
  19. that ultimately result in an end product whose architecture and source
  20. material are closed to the public.
  21. Open source projects conceptually have differing concurrent agendas,
  22. approaches, and production. These facets of the development process can
  23. come from anyone in the public (community) who has a stake in the
  24. software project. The open source environment contains new copyright,
  25. licensing, domain, and consumer issues that differ from the more
  26. traditional development environment. In an open source environment, the
  27. end product, source material, and documentation are all available to the
  28. public at no cost.
  29. A benchmark example of an open source project is the Linux kernel, which
  30. was initially conceived and created by Finnish computer science student
  31. Linus Torvalds in 1991. Conversely, a good example of a non-open source
  32. project is the Windows family of operating systems developed by
  33. Microsoft Corporation.
  34. Wikipedia has a good :wikipedia:`historical description of the Open Source
  35. Philosophy <Open_source>`. You can also find helpful information on how
  36. to participate in the Linux Community
  37. `here <https://www.kernel.org/doc/html/latest/process/index.html>`__.
  38. The Development Host
  39. ====================
  40. A development host or :term:`Build Host` is key to
  41. using the Yocto Project. Because the goal of the Yocto Project is to
  42. develop images or applications that run on embedded hardware,
  43. development of those images and applications generally takes place on a
  44. system not intended to run the software --- the development host.
  45. You need to set up a development host in order to use it with the Yocto
  46. Project. Most find that it is best to have a native Linux machine
  47. function as the development host. However, it is possible to use a
  48. system that does not run Linux as its operating system as your
  49. development host. When you have a Mac or Windows-based system, you can
  50. set it up as the development host by using
  51. `CROPS <https://github.com/crops/poky-container>`__, which leverages
  52. `Docker Containers <https://www.docker.com/>`__. Once you take the steps
  53. to set up a CROPS machine, you effectively have access to a shell
  54. environment that is similar to what you see when using a Linux-based
  55. development host. For the steps needed to set up a system using CROPS,
  56. see the
  57. ":ref:`dev-manual/start:setting up to use cross platforms (crops)`"
  58. section in
  59. the Yocto Project Development Tasks Manual.
  60. If your development host is going to be a system that runs a Linux
  61. distribution, you must still take steps to prepare the system
  62. for use with the Yocto Project. You need to be sure that the Linux
  63. distribution on the system is one that supports the Yocto Project. You
  64. also need to be sure that the correct set of host packages are installed
  65. that allow development using the Yocto Project. For the steps needed to
  66. set up a development host that runs Linux, see the
  67. ":ref:`dev-manual/start:setting up a native linux host`"
  68. section in the Yocto Project Development Tasks Manual.
  69. Once your development host is set up to use the Yocto Project, there
  70. are several ways of working in the Yocto Project environment:
  71. - *Command Lines, BitBake, and Shells:* Traditional development in the
  72. Yocto Project involves using the :term:`OpenEmbedded Build System`,
  73. which uses
  74. BitBake, in a command-line environment from a shell on your
  75. development host. You can accomplish this from a host that is a
  76. native Linux machine or from a host that has been set up with CROPS.
  77. Either way, you create, modify, and build images and applications all
  78. within a shell-based environment using components and tools available
  79. through your Linux distribution and the Yocto Project.
  80. For a general flow of the build procedures, see the
  81. ":ref:`dev-manual/building:building a simple image`"
  82. section in the Yocto Project Development Tasks Manual.
  83. - *Board Support Package (BSP) Development:* Development of BSPs
  84. involves using the Yocto Project to create and test layers that allow
  85. easy development of images and applications targeted for specific
  86. hardware. To development BSPs, you need to take some additional steps
  87. beyond what was described in setting up a development host.
  88. The :doc:`/bsp-guide/index` provides BSP-related development
  89. information. For specifics on development host preparation, see the
  90. ":ref:`bsp-guide/bsp:preparing your build host to work with bsp layers`"
  91. section in the Yocto Project Board Support Package (BSP) Developer's
  92. Guide.
  93. - *Kernel Development:* If you are going to be developing kernels using
  94. the Yocto Project you likely will be using ``devtool``. A workflow
  95. using ``devtool`` makes kernel development quicker by reducing
  96. iteration cycle times.
  97. The :doc:`/kernel-dev/index` provides kernel-related
  98. development information. For specifics on development host
  99. preparation, see the
  100. ":ref:`kernel-dev/common:preparing the build host to work on the kernel`"
  101. section in the Yocto Project Linux Kernel Development Manual.
  102. - *Using Toaster:* The other Yocto Project development method that
  103. involves an interface that effectively puts the Yocto Project into
  104. the background is Toaster. Toaster provides an interface to the
  105. OpenEmbedded build system. The interface enables you to configure and
  106. run your builds. Information about builds is collected and stored in
  107. a database. You can use Toaster to configure and start builds on
  108. multiple remote build servers.
  109. For steps that show you how to set up your development host to use
  110. Toaster and on how to use Toaster in general, see the
  111. :doc:`/toaster-manual/index`.
  112. Yocto Project Source Repositories
  113. =================================
  114. The Yocto Project team maintains complete source repositories for all
  115. Yocto Project files at :yocto_git:`/`. This web-based source
  116. code browser is organized into categories by function such as IDE
  117. Plugins, Matchbox, Poky, Yocto Linux Kernel, and so forth. From the
  118. interface, you can click on any particular item in the "Name" column and
  119. see the URL at the bottom of the page that you need to clone a Git
  120. repository for that particular item. Having a local Git repository of
  121. the :term:`Source Directory`, which
  122. is usually named "poky", allows you to make changes, contribute to the
  123. history, and ultimately enhance the Yocto Project's tools, Board Support
  124. Packages, and so forth.
  125. For any supported release of Yocto Project, you can also go to the
  126. :yocto_home:`Yocto Project Website <>` and select the "DOWNLOADS"
  127. item from the "SOFTWARE" menu and get a released tarball of the ``poky``
  128. repository, any supported BSP tarball, or Yocto Project tools. Unpacking
  129. these tarballs gives you a snapshot of the released files.
  130. .. note::
  131. - The recommended method for setting up the Yocto Project
  132. :term:`Source Directory` and the files
  133. for supported BSPs (e.g., ``meta-intel``) is to use
  134. :ref:`overview-manual/development-environment:git`
  135. to create a local copy of the upstream repositories.
  136. - Be sure to always work in matching branches for both the selected
  137. BSP repository and the Source Directory (i.e. ``poky``)
  138. repository. For example, if you have checked out the "&DISTRO_NAME_NO_CAP;"
  139. branch of ``poky`` and you are going to use ``meta-intel``, be
  140. sure to checkout the "&DISTRO_NAME_NO_CAP;" branch of ``meta-intel``.
  141. In summary, here is where you can get the project files needed for
  142. development:
  143. - :yocto_git:`Source Repositories: <>` This area contains Poky, Yocto
  144. documentation, metadata layers, and Linux kernel. You can create local
  145. copies of Git repositories for each of these areas.
  146. .. image:: figures/source-repos.png
  147. :width: 100%
  148. For steps on how to view and access these upstream Git repositories,
  149. see the ":ref:`dev-manual/start:accessing source repositories`"
  150. Section in the Yocto Project Development Tasks Manual.
  151. - :yocto_dl:`Yocto release archives: </releases/yocto>` This is where you can
  152. download tarballs corresponding to each Yocto Project release. Downloading
  153. and extracting these files does not produce a local copy of a Git repository
  154. but rather a snapshot corresponding to a particular release.
  155. - :yocto_home:`DOWNLOADS page </software-overview/downloads/>`:
  156. The :yocto_home:`Yocto Project website <>` includes a "DOWNLOADS" page accessible
  157. through the "SOFTWARE" menu that allows you to download any Yocto
  158. Project release, tool, and Board Support Package (BSP) in tarball
  159. form. The hyperlinks point to the tarballs under
  160. :yocto_dl:`/releases/yocto/`.
  161. .. image:: figures/yp-download.png
  162. :width: 100%
  163. For steps on how to use the "DOWNLOADS" page, see the
  164. ":ref:`dev-manual/start:using the downloads page`"
  165. section in the Yocto Project Development Tasks Manual.
  166. Git Workflows and the Yocto Project
  167. ===================================
  168. Developing using the Yocto Project likely requires the use of
  169. :ref:`overview-manual/development-environment:git`.
  170. Git is a free, open source distributed version control
  171. system used as part of many collaborative design environments. This
  172. section provides workflow concepts using the Yocto Project and Git. In
  173. particular, the information covers basic practices that describe roles
  174. and actions in a collaborative development environment.
  175. .. note::
  176. If you are familiar with this type of development environment, you
  177. might not want to read this section.
  178. The Yocto Project files are maintained using Git in "branches" whose Git
  179. histories track every change and whose structures provide branches for
  180. all diverging functionality. Although there is no need to use Git, many
  181. open source projects do so.
  182. For the Yocto Project, a key individual called the "maintainer" is
  183. responsible for the integrity of the development branch of a given Git
  184. repository. The development branch is the "upstream" repository from which
  185. final or most recent builds of a project occur. The maintainer is
  186. responsible for accepting changes from other developers and for
  187. organizing the underlying branch structure to reflect release strategies
  188. and so forth.
  189. .. note::
  190. For information on finding out who is responsible for (maintains) a
  191. particular area of code in the Yocto Project, see the
  192. ":doc:`../contributor-guide/identify-component`"
  193. section of the Yocto Project and OpenEmbedded Contributor Guide.
  194. The Yocto Project ``poky`` Git repository also has an upstream
  195. contribution Git repository named ``poky-contrib``. You can see all the
  196. branches in this repository using the web interface of the
  197. :yocto_git:`Source Repositories <>` organized within the "Poky Support"
  198. area. These branches hold changes (commits) to the project that have
  199. been submitted or committed by the Yocto Project development team and by
  200. community members who contribute to the project. The maintainer
  201. determines if the changes are qualified to be moved from the "contrib"
  202. branches into the "master" branch of the Git repository.
  203. Developers (including contributing community members) create and
  204. maintain cloned repositories of upstream branches. The cloned
  205. repositories are local to their development platforms and are used to
  206. develop changes. When a developer is satisfied with a particular feature
  207. or change, they "push" the change to the appropriate "contrib"
  208. repository.
  209. Developers are responsible for keeping their local repository up-to-date
  210. with whatever upstream branch they are working against. They are also
  211. responsible for straightening out any conflicts that might arise within
  212. files that are being worked on simultaneously by more than one person.
  213. All this work is done locally on the development host before anything is
  214. pushed to a "contrib" area and examined at the maintainer's level.
  215. There is a somewhat formal method by which developers commit changes and
  216. push them into the "contrib" area and subsequently request that the
  217. maintainer include them into an upstream branch. This process is called
  218. "submitting a patch" or "submitting a change." For information on
  219. submitting patches and changes, see the
  220. ":doc:`../contributor-guide/submit-changes`" section in the Yocto Project
  221. and OpenEmbedded Contributor Guide.
  222. In summary, there is a single point of entry for changes into the
  223. development branch of the Git repository, which is controlled by the
  224. project's maintainer. A set of developers independently
  225. develop, test, and submit changes to "contrib" areas for the maintainer
  226. to examine. The maintainer then chooses which changes are going to
  227. become a permanent part of the project.
  228. .. image:: svg/git-workflow.*
  229. :width: 100%
  230. While each development environment is unique, there are some best
  231. practices or methods that help development run smoothly. The following
  232. list describes some of these practices. For more information about Git
  233. workflows, see the workflow topics in the `Git Community
  234. Book <https://book.git-scm.com>`__.
  235. - *Make Small Changes:* It is best to keep the changes you commit small
  236. as compared to bundling many disparate changes into a single commit.
  237. This practice not only keeps things manageable but also allows the
  238. maintainer to more easily include or refuse changes.
  239. - *Make Complete Changes:* It is also good practice to leave the
  240. repository in a state that allows you to still successfully build
  241. your project. In other words, do not commit half of a feature, then
  242. add the other half as a separate, later commit. Each commit should
  243. take you from one buildable project state to another buildable state.
  244. - *Use Branches Liberally:* It is very easy to create, use, and delete
  245. local branches in your working Git repository on the development
  246. host. You can name these branches anything you like. It is helpful to
  247. give them names associated with the particular feature or change on
  248. which you are working. Once you are done with a feature or change and
  249. have merged it into your local development branch, simply discard the
  250. temporary branch.
  251. - *Merge Changes:* The ``git merge`` command allows you to take the
  252. changes from one branch and fold them into another branch. This
  253. process is especially helpful when more than a single developer might
  254. be working on different parts of the same feature. Merging changes
  255. also automatically identifies any collisions or "conflicts" that
  256. might happen as a result of the same lines of code being altered by
  257. two different developers.
  258. - *Manage Branches:* Because branches are easy to use, you should use a
  259. system where branches indicate varying levels of code readiness. For
  260. example, you can have a "work" branch to develop in, a "test" branch
  261. where the code or change is tested, a "stage" branch where changes
  262. are ready to be committed, and so forth. As your project develops,
  263. you can merge code across the branches to reflect ever-increasing
  264. stable states of the development.
  265. - *Use Push and Pull:* The push-pull workflow is based on the concept
  266. of developers "pushing" local commits to a remote repository, which
  267. is usually a contribution repository. This workflow is also based on
  268. developers "pulling" known states of the project down into their
  269. local development repositories. The workflow easily allows you to
  270. pull changes submitted by other developers from the upstream
  271. repository into your work area ensuring that you have the most recent
  272. software on which to develop. The Yocto Project has two scripts named
  273. ``create-pull-request`` and ``send-pull-request`` that ship with the
  274. release to facilitate this workflow. You can find these scripts in
  275. the ``scripts`` folder of the :term:`Source Directory`. For information
  276. on how to use these scripts, see the
  277. ":ref:`contributor-guide/submit-changes:using scripts to push a change upstream and request a pull`"
  278. section in the Yocto Project and OpenEmbedded Contributor Guide.
  279. - *Patch Workflow:* This workflow allows you to notify the maintainer
  280. through an email that you have a change (or patch) you would like
  281. considered for the development branch of the Git repository. To send
  282. this type of change, you format the patch and then send the email
  283. using the Git commands ``git format-patch`` and ``git send-email``.
  284. For information on how to use these scripts, see the
  285. ":doc:`../contributor-guide/submit-changes`" section in the Yocto Project
  286. and OpenEmbedded Contributor Guide.
  287. Git
  288. ===
  289. The Yocto Project makes extensive use of Git, which is a free, open
  290. source distributed version control system. Git supports distributed
  291. development, non-linear development, and can handle large projects. It
  292. is best that you have some fundamental understanding of how Git tracks
  293. projects and how to work with Git if you are going to use the Yocto
  294. Project for development. This section provides a quick overview of how
  295. Git works and provides you with a summary of some essential Git
  296. commands.
  297. .. note::
  298. - For more information on Git, see
  299. https://git-scm.com/documentation.
  300. - If you need to download Git, it is recommended that you add Git to
  301. your system through your distribution's "software store" (e.g. for
  302. Ubuntu, use the Ubuntu Software feature). For the Git download
  303. page, see https://git-scm.com/download.
  304. - For information beyond the introductory nature in this section,
  305. see the ":ref:`dev-manual/start:locating yocto project source files`"
  306. section in the Yocto Project Development Tasks Manual.
  307. Repositories, Tags, and Branches
  308. --------------------------------
  309. As mentioned briefly in the previous section and also in the
  310. ":ref:`overview-manual/development-environment:git workflows and the yocto project`"
  311. section, the Yocto Project maintains source repositories at :yocto_git:`/`.
  312. If you look at this web-interface of the repositories, each item is a separate
  313. Git repository.
  314. Git repositories use branching techniques that track content change (not
  315. files) within a project (e.g. a new feature or updated documentation).
  316. Creating a tree-like structure based on project divergence allows for
  317. excellent historical information over the life of a project. This
  318. methodology also allows for an environment from which you can do lots of
  319. local experimentation on projects as you develop changes or new
  320. features.
  321. A Git repository represents all development efforts for a given project.
  322. For example, the Git repository ``poky`` contains all changes and
  323. developments for that repository over the course of its entire life.
  324. That means that all changes that make up all releases are captured. The
  325. repository maintains a complete history of changes.
  326. You can create a local copy of any repository by "cloning" it with the
  327. ``git clone`` command. When you clone a Git repository, you end up with
  328. an identical copy of the repository on your development system. Once you
  329. have a local copy of a repository, you can take steps to develop
  330. locally. For examples on how to clone Git repositories, see the
  331. ":ref:`dev-manual/start:locating yocto project source files`"
  332. section in the Yocto Project Development Tasks Manual.
  333. It is important to understand that Git tracks content change and not
  334. files. Git uses "branches" to organize different development efforts.
  335. For example, the ``poky`` repository has several branches that include
  336. the current "&DISTRO_NAME_NO_CAP;" branch, the "master" branch, and many
  337. branches for past Yocto Project releases. You can see all the branches
  338. by going to :yocto_git:`/poky/` and clicking on the
  339. ``[...]`` link beneath the "Branch" heading.
  340. Each of these branches represents a specific area of development. The
  341. "master" branch represents the current or most recent development. All
  342. other branches represent offshoots of the "master" branch.
  343. When you create a local copy of a Git repository, the copy has the same
  344. set of branches as the original. This means you can use Git to create a
  345. local working area (also called a branch) that tracks a specific
  346. development branch from the upstream source Git repository. In other
  347. words, you can define your local Git environment to work on any
  348. development branch in the repository. To help illustrate, consider the
  349. following example Git commands::
  350. $ cd ~
  351. $ git clone git://git.yoctoproject.org/poky -b &DISTRO_NAME_NO_CAP;
  352. In the previous example
  353. after moving to the home directory, the ``git clone`` command creates a
  354. local copy of the upstream ``poky`` Git repository and checks out a
  355. local branch named "&DISTRO_NAME_NO_CAP;", which tracks the upstream
  356. "origin/&DISTRO_NAME_NO_CAP;" branch. Changes you make while in this
  357. branch would ultimately affect the upstream "&DISTRO_NAME_NO_CAP;" branch
  358. of the ``poky`` repository.
  359. It is important to understand that when you create and checkout a local
  360. working branch based on a branch name, your local environment matches
  361. the "tip" of that particular development branch at the time you created
  362. your local branch, which could be different from the files in the
  363. "master" branch of the upstream repository. In other words, creating and
  364. checking out a local branch based on the "&DISTRO_NAME_NO_CAP;" branch
  365. name is not the same as checking out the "master" branch in the
  366. repository. Keep reading to see how you create a local snapshot of a
  367. Yocto Project Release.
  368. Git uses "tags" to mark specific changes in a repository branch
  369. structure. Typically, a tag is used to mark a special point such as the
  370. final change (or commit) before a project is released. You can see the
  371. tags used with the ``poky`` Git repository by going to :yocto_git:`/poky/`
  372. and clicking on the ``[...]`` link beneath the "Tag" heading.
  373. Some key tags for the ``poky`` repository are ``jethro-14.0.3``,
  374. ``morty-16.0.1``, ``pyro-17.0.0``, and
  375. ``&DISTRO_NAME_NO_CAP;-&DISTRO;``. These tags represent Yocto Project
  376. releases.
  377. When you create a local copy of the Git repository, you also have access
  378. to all the tags in the upstream repository. Similar to branches, you can
  379. create and checkout a local working Git branch based on a tag name. When
  380. you do this, you get a snapshot of the Git repository that reflects the
  381. state of the files when the change was made associated with that tag.
  382. The most common use is to checkout a working branch that matches a
  383. specific Yocto Project release. Here is an example::
  384. $ cd ~
  385. $ git clone git://git.yoctoproject.org/poky
  386. $ cd poky
  387. $ git fetch --tags
  388. $ git checkout tags/rocko-18.0.0 -b my_rocko-18.0.0
  389. In this example, the name
  390. of the top-level directory of your local Yocto Project repository is
  391. ``poky``. After moving to the ``poky`` directory, the ``git fetch``
  392. command makes all the upstream tags available locally in your
  393. repository. Finally, the ``git checkout`` command creates and checks out
  394. a branch named "my-rocko-18.0.0" that is based on the upstream branch
  395. whose "HEAD" matches the commit in the repository associated with the
  396. "rocko-18.0.0" tag. The files in your repository now exactly match that
  397. particular Yocto Project release as it is tagged in the upstream Git
  398. repository. It is important to understand that when you create and
  399. checkout a local working branch based on a tag, your environment matches
  400. a specific point in time and not the entire development branch (i.e.
  401. from the "tip" of the branch backwards).
  402. Basic Commands
  403. --------------
  404. Git has an extensive set of commands that lets you manage changes and
  405. perform collaboration over the life of a project. Conveniently though,
  406. you can manage with a small set of basic operations and workflows once
  407. you understand the basic philosophy behind Git. You do not have to be an
  408. expert in Git to be functional. A good place to look for instruction on
  409. a minimal set of Git commands is
  410. `here <https://git-scm.com/documentation>`__.
  411. The following list of Git commands briefly describes some basic Git
  412. operations as a way to get started. As with any set of commands, this
  413. list (in most cases) simply shows the base command and omits the many
  414. arguments it supports. See the Git documentation for complete
  415. descriptions and strategies on how to use these commands:
  416. - *git init:* Initializes an empty Git repository. You cannot use
  417. Git commands unless you have a ``.git`` repository.
  418. - *git clone:* Creates a local clone of a Git repository that is on
  419. equal footing with a fellow developer's Git repository or an upstream
  420. repository.
  421. - *git add:* Locally stages updated file contents to the index that
  422. Git uses to track changes. You must stage all files that have changed
  423. before you can commit them.
  424. - *git commit:* Creates a local "commit" that documents the changes
  425. you made. Only changes that have been staged can be committed.
  426. Commits are used for historical purposes, for determining if a
  427. maintainer of a project will allow the change, and for ultimately
  428. pushing the change from your local Git repository into the project's
  429. upstream repository.
  430. - *git status:* Reports any modified files that possibly need to be
  431. staged and gives you a status of where you stand regarding local
  432. commits as compared to the upstream repository.
  433. - *git checkout branch-name:* Changes your local working branch and
  434. in this form assumes the local branch already exists. This command is
  435. analogous to "cd".
  436. - *git checkout -b working-branch upstream-branch:* Creates and
  437. checks out a working branch on your local machine. The local branch
  438. tracks the upstream branch. You can use your local branch to isolate
  439. your work. It is a good idea to use local branches when adding
  440. specific features or changes. Using isolated branches facilitates
  441. easy removal of changes if they do not work out.
  442. - *git branch:* Displays the existing local branches associated
  443. with your local repository. The branch that you have currently
  444. checked out is noted with an asterisk character.
  445. - *git branch -D branch-name:* Deletes an existing local branch.
  446. You need to be in a local branch other than the one you are deleting
  447. in order to delete branch-name.
  448. - *git pull \-\-rebase*: Retrieves information from an upstream Git
  449. repository and places it in your local Git repository. You use this
  450. command to make sure you are synchronized with the repository from
  451. which you are basing changes (e.g. the "&DISTRO_NAME_NO_CAP;"
  452. branch). The ``--rebase`` option ensures that any local commits you
  453. have in your branch are preserved at the top of your local branch.
  454. - *git push repo-name local-branch:upstream-branch:* Sends
  455. all your committed local changes to the upstream Git repository that
  456. your local repository is tracking (e.g. a contribution repository).
  457. The maintainer of the project draws from these repositories to merge
  458. changes (commits) into the appropriate branch of project's upstream
  459. repository.
  460. - *git merge:* Combines or adds changes from one local branch of
  461. your repository with another branch. When you create a local Git
  462. repository, the default branch may be named "main". A typical
  463. workflow is to create a temporary branch that is based off "main"
  464. that you would use for isolated work. You would make your changes in
  465. that isolated branch, stage and commit them locally, switch to the
  466. "main" branch, and then use the ``git merge`` command to apply the
  467. changes from your isolated branch into the currently checked out
  468. branch (e.g. "main"). After the merge is complete and if you are
  469. done with working in that isolated branch, you can safely delete the
  470. isolated branch.
  471. - *git cherry-pick commits:* Choose and apply specific commits from
  472. one branch into another branch. There are times when you might not be
  473. able to merge all the changes in one branch with another but need to
  474. pick out certain ones.
  475. - *gitk:* Provides a GUI view of the branches and changes in your
  476. local Git repository. This command is a good way to graphically see
  477. where things have diverged in your local repository.
  478. .. note::
  479. You need to install the
  480. gitk
  481. package on your development system to use this command.
  482. - *git log:* Reports a history of your commits to the repository.
  483. This report lists all commits regardless of whether you have pushed
  484. them upstream or not.
  485. - *git diff:* Displays line-by-line differences between a local
  486. working file and the same file as understood by Git. This command is
  487. useful to see what you have changed in any given file.
  488. Licensing
  489. =========
  490. Because open source projects are open to the public, they have different
  491. licensing structures in place. License evolution for both Open Source
  492. and Free Software has an interesting history. If you are interested in
  493. this history, you can find basic information here:
  494. - :wikipedia:`Open source license history <Open-source_license>`
  495. - :wikipedia:`Free software license history <Free_software_license>`
  496. In general, the Yocto Project is broadly licensed under the
  497. Massachusetts Institute of Technology (MIT) License. MIT licensing
  498. permits the reuse of software within proprietary software as long as the
  499. license is distributed with that software. Patches to the Yocto Project
  500. follow the upstream licensing scheme. You can find information on the
  501. MIT license :wikipedia:`here <MIT_License>`.
  502. When you build an image using the Yocto Project, the build process uses
  503. a known list of licenses to ensure compliance. You can find this list in
  504. the :term:`Source Directory` at ``meta/files/common-licenses``. Once the
  505. build completes, the list of all licenses found and used during that build
  506. are kept in the :term:`Build Directory` at ``tmp/deploy/licenses``.
  507. If a module requires a license that is not in the base list, the build
  508. process generates a warning during the build. These tools make it easier
  509. for a developer to be certain of the licenses with which their shipped
  510. products must comply. However, even with these tools it is still up to
  511. the developer to resolve potential licensing issues.
  512. The base list of licenses used by the build process is a combination of
  513. the Software Package Data Exchange (SPDX) list and the Open Source
  514. Initiative (OSI) projects. `SPDX Group <https://spdx.org>`__ is a working
  515. group of the Linux Foundation that maintains a specification for a
  516. standard format for communicating the components, licenses, and
  517. copyrights associated with a software package.
  518. `OSI <https://opensource.org>`__ is a corporation dedicated to the Open
  519. Source Definition and the effort for reviewing and approving licenses
  520. that conform to the Open Source Definition (OSD).
  521. You can find a list of the combined SPDX and OSI licenses that the Yocto
  522. Project uses in the ``meta/files/common-licenses`` directory in your
  523. :term:`Source Directory`.
  524. For information that can help you maintain compliance with various open
  525. source licensing during the lifecycle of a product created using the
  526. Yocto Project, see the
  527. ":ref:`dev-manual/licenses:maintaining open source license compliance during your product's lifecycle`"
  528. section in the Yocto Project Development Tasks Manual.