dev-manual-start.rst 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. ***********************************
  3. Setting Up to Use the Yocto Project
  4. ***********************************
  5. This chapter provides guidance on how to prepare to use the Yocto
  6. Project. You can learn about creating a team environment to develop
  7. using the Yocto Project, how to set up a :ref:`build
  8. host <dev-manual/dev-manual-start:preparing the build host>`, how to locate
  9. Yocto Project source repositories, and how to create local Git
  10. repositories.
  11. .. _usingpoky-changes-collaborate:
  12. Creating a Team Development Environment
  13. =======================================
  14. It might not be immediately clear how you can use the Yocto Project in a
  15. team development environment, or how to scale it for a large team of
  16. developers. You can adapt the Yocto Project to many different use cases
  17. and scenarios; however, this flexibility could cause difficulties if you
  18. are trying to create a working setup that scales effectively.
  19. To help you understand how to set up this type of environment, this
  20. section presents a procedure that gives you information that can help
  21. you get the results you want. The procedure is high-level and presents
  22. some of the project's most successful experiences, practices, solutions,
  23. and available technologies that have proved to work well in the past;
  24. however, keep in mind, the procedure here is simply a starting point.
  25. You can build off these steps and customize the procedure to fit any
  26. particular working environment and set of practices.
  27. 1. *Determine Who is Going to be Developing:* You first need to
  28. understand who is going to be doing anything related to the Yocto
  29. Project and determine their roles. Making this determination is
  30. essential to completing subsequent steps, which are to get your
  31. equipment together and set up your development environment's
  32. hardware topology.
  33. The following roles exist:
  34. - *Application Developer:* This type of developer does application
  35. level work on top of an existing software stack.
  36. - *Core System Developer:* This type of developer works on the
  37. contents of the operating system image itself.
  38. - *Build Engineer:* This type of developer manages Autobuilders and
  39. releases. Depending on the specifics of the environment, not all
  40. situations might need a Build Engineer.
  41. - *Test Engineer:* This type of developer creates and manages
  42. automated tests that are used to ensure all application and core
  43. system development meets desired quality standards.
  44. 2. *Gather the Hardware:* Based on the size and make-up of the team,
  45. get the hardware together. Ideally, any development, build, or test
  46. engineer uses a system that runs a supported Linux distribution.
  47. These systems, in general, should be high performance (e.g. dual,
  48. six-core Xeons with 24 Gbytes of RAM and plenty of disk space). You
  49. can help ensure efficiency by having any machines used for testing
  50. or that run Autobuilders be as high performance as possible.
  51. .. note::
  52. Given sufficient processing power, you might also consider
  53. building Yocto Project development containers to be run under
  54. Docker, which is described later.
  55. 3. *Understand the Hardware Topology of the Environment:* Once you
  56. understand the hardware involved and the make-up of the team, you
  57. can understand the hardware topology of the development environment.
  58. You can get a visual idea of the machines and their roles across the
  59. development environment.
  60. 4. *Use Git as Your Source Control Manager (SCM):* Keeping your
  61. :term:`Metadata` (i.e. recipes,
  62. configuration files, classes, and so forth) and any software you are
  63. developing under the control of an SCM system that is compatible
  64. with the OpenEmbedded build system is advisable. Of all of the SCMs
  65. supported by BitBake, the Yocto Project team strongly recommends using
  66. :ref:`overview-manual/overview-manual-development-environment:git`.
  67. Git is a distributed system
  68. that is easy to back up, allows you to work remotely, and then
  69. connects back to the infrastructure.
  70. .. note::
  71. For information about BitBake, see the
  72. BitBake User Manual
  73. .
  74. It is relatively easy to set up Git services and create
  75. infrastructure like
  76. :yocto_git:`http://git.yoctoproject.org <>`, which is based on
  77. server software called ``gitolite`` with ``cgit`` being used to
  78. generate the web interface that lets you view the repositories. The
  79. ``gitolite`` software identifies users using SSH keys and allows
  80. branch-based access controls to repositories that you can control as
  81. little or as much as necessary.
  82. .. note::
  83. The setup of these services is beyond the scope of this manual.
  84. However, sites such as the following exist that describe how to
  85. perform setup:
  86. - `Git documentation <http://git-scm.com/book/ch4-8.html>`__:
  87. Describes how to install ``gitolite`` on the server.
  88. - `Gitolite <http://gitolite.com>`__: Information for
  89. ``gitolite``.
  90. - `Interfaces, frontends, and
  91. tools <https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools>`__:
  92. Documentation on how to create interfaces and frontends for
  93. Git.
  94. 5. *Set up the Application Development Machines:* As mentioned earlier,
  95. application developers are creating applications on top of existing
  96. software stacks. Following are some best practices for setting up
  97. machines used for application development:
  98. - Use a pre-built toolchain that contains the software stack
  99. itself. Then, develop the application code on top of the stack.
  100. This method works well for small numbers of relatively isolated
  101. applications.
  102. - Keep your cross-development toolchains updated. You can do this
  103. through provisioning either as new toolchain downloads or as
  104. updates through a package update mechanism using ``opkg`` to
  105. provide updates to an existing toolchain. The exact mechanics of
  106. how and when to do this depend on local policy.
  107. - Use multiple toolchains installed locally into different
  108. locations to allow development across versions.
  109. 6. *Set up the Core Development Machines:* As mentioned earlier, core
  110. developers work on the contents of the operating system itself.
  111. Following are some best practices for setting up machines used for
  112. developing images:
  113. - Have the :term:`OpenEmbedded Build System` available on
  114. the developer workstations so developers can run their own builds
  115. and directly rebuild the software stack.
  116. - Keep the core system unchanged as much as possible and do your
  117. work in layers on top of the core system. Doing so gives you a
  118. greater level of portability when upgrading to new versions of
  119. the core system or Board Support Packages (BSPs).
  120. - Share layers amongst the developers of a particular project and
  121. contain the policy configuration that defines the project.
  122. 7. *Set up an Autobuilder:* Autobuilders are often the core of the
  123. development environment. It is here that changes from individual
  124. developers are brought together and centrally tested. Based on this
  125. automated build and test environment, subsequent decisions about
  126. releases can be made. Autobuilders also allow for "continuous
  127. integration" style testing of software components and regression
  128. identification and tracking.
  129. See "`Yocto Project
  130. Autobuilder <http://autobuilder.yoctoproject.org>`__" for more
  131. information and links to buildbot. The Yocto Project team has found
  132. this implementation works well in this role. A public example of
  133. this is the Yocto Project Autobuilders, which the Yocto Project team
  134. uses to test the overall health of the project.
  135. The features of this system are:
  136. - Highlights when commits break the build.
  137. - Populates an :ref:`sstate
  138. cache <overview-manual/overview-manual-concepts:shared state cache>` from which
  139. developers can pull rather than requiring local builds.
  140. - Allows commit hook triggers, which trigger builds when commits
  141. are made.
  142. - Allows triggering of automated image booting and testing under
  143. the QuickEMUlator (QEMU).
  144. - Supports incremental build testing and from-scratch builds.
  145. - Shares output that allows developer testing and historical
  146. regression investigation.
  147. - Creates output that can be used for releases.
  148. - Allows scheduling of builds so that resources can be used
  149. efficiently.
  150. 8. *Set up Test Machines:* Use a small number of shared, high
  151. performance systems for testing purposes. Developers can use these
  152. systems for wider, more extensive testing while they continue to
  153. develop locally using their primary development system.
  154. 9. *Document Policies and Change Flow:* The Yocto Project uses a
  155. hierarchical structure and a pull model. Scripts exist to create and
  156. send pull requests (i.e. ``create-pull-request`` and
  157. ``send-pull-request``). This model is in line with other open source
  158. projects where maintainers are responsible for specific areas of the
  159. project and a single maintainer handles the final "top-of-tree"
  160. merges.
  161. .. note::
  162. You can also use a more collective push model. The
  163. gitolite
  164. software supports both the push and pull models quite easily.
  165. As with any development environment, it is important to document the
  166. policy used as well as any main project guidelines so they are
  167. understood by everyone. It is also a good idea to have
  168. well-structured commit messages, which are usually a part of a
  169. project's guidelines. Good commit messages are essential when
  170. looking back in time and trying to understand why changes were made.
  171. If you discover that changes are needed to the core layer of the
  172. project, it is worth sharing those with the community as soon as
  173. possible. Chances are if you have discovered the need for changes,
  174. someone else in the community needs them also.
  175. 10. *Development Environment Summary:* Aside from the previous steps,
  176. some best practices exist within the Yocto Project development
  177. environment. Consider the following:
  178. - Use :ref:`overview-manual/overview-manual-development-environment:git` as the source control
  179. system.
  180. - Maintain your Metadata in layers that make sense for your
  181. situation. See the ":ref:`overview-manual/overview-manual-yp-intro:the yocto project layer model`"
  182. section in the Yocto Project Overview and Concepts Manual and the
  183. ":ref:`dev-manual/dev-manual-common-tasks:understanding and creating layers`"
  184. section for more information on layers.
  185. - Separate the project's Metadata and code by using separate Git
  186. repositories. See the ":ref:`overview-manual/overview-manual-development-environment:yocto project source repositories`"
  187. section in the Yocto Project Overview and Concepts Manual for
  188. information on these repositories. See the "`Locating Yocto
  189. Project Source Files <#locating-yocto-project-source-files>`__"
  190. section for information on how to set up local Git repositories
  191. for related upstream Yocto Project Git repositories.
  192. - Set up the directory for the shared state cache
  193. (:term:`SSTATE_DIR`) where
  194. it makes sense. For example, set up the sstate cache on a system
  195. used by developers in the same organization and share the same
  196. source directories on their machines.
  197. - Set up an Autobuilder and have it populate the sstate cache and
  198. source directories.
  199. - The Yocto Project community encourages you to send patches to the
  200. project to fix bugs or add features. If you do submit patches,
  201. follow the project commit guidelines for writing good commit
  202. messages. See the
  203. ":ref:`dev-manual/dev-manual-common-tasks:submitting a change to the yocto project`"
  204. section.
  205. - Send changes to the core sooner than later as others are likely
  206. to run into the same issues. For some guidance on mailing lists
  207. to use, see the list in the
  208. ":ref:`dev-manual/dev-manual-common-tasks:submitting a change to the yocto project`"
  209. section. For a description
  210. of the available mailing lists, see the ":ref:`resources-mailinglist`" section in
  211. the Yocto Project Reference Manual.
  212. .. _dev-preparing-the-build-host:
  213. Preparing the Build Host
  214. ========================
  215. This section provides procedures to set up a system to be used as your
  216. :term:`Build Host` for
  217. development using the Yocto Project. Your build host can be a native
  218. Linux machine (recommended), it can be a machine (Linux, Mac, or
  219. Windows) that uses `CROPS <https://github.com/crops/poky-container>`__,
  220. which leverages `Docker Containers <https://www.docker.com/>`__ or it
  221. can be a Windows machine capable of running Windows Subsystem For Linux
  222. v2 (WSL).
  223. .. note::
  224. The Yocto Project is not compatible with
  225. Windows Subsystem for Linux v1
  226. . It is compatible but not officially supported nor validated with
  227. WSLv2. If you still decide to use WSL please upgrade to
  228. WSLv2
  229. .
  230. Once your build host is set up to use the Yocto Project, further steps
  231. are necessary depending on what you want to accomplish. See the
  232. following references for information on how to prepare for Board Support
  233. Package (BSP) development and kernel development:
  234. - *BSP Development:* See the ":ref:`bsp-guide/bsp:preparing your build host to work with bsp layers`"
  235. section in the Yocto Project Board Support Package (BSP) Developer's
  236. Guide.
  237. - *Kernel Development:* See the ":ref:`kernel-dev/kernel-dev-common:preparing the build host to work on the kernel`"
  238. section in the Yocto Project Linux Kernel Development Manual.
  239. Setting Up a Native Linux Host
  240. ------------------------------
  241. Follow these steps to prepare a native Linux machine as your Yocto
  242. Project Build Host:
  243. 1. *Use a Supported Linux Distribution:* You should have a reasonably
  244. current Linux-based host system. You will have the best results with
  245. a recent release of Fedora, openSUSE, Debian, Ubuntu, RHEL or CentOS
  246. as these releases are frequently tested against the Yocto Project and
  247. officially supported. For a list of the distributions under
  248. validation and their status, see the ":ref:`Supported Linux
  249. Distributions <detailed-supported-distros>`"
  250. section in the Yocto Project Reference Manual and the wiki page at
  251. :yocto_wiki:`Distribution Support </wiki/Distribution_Support>`.
  252. 2. *Have Enough Free Memory:* Your system should have at least 50 Gbytes
  253. of free disk space for building images.
  254. 3. *Meet Minimal Version Requirements:* The OpenEmbedded build system
  255. should be able to run on any modern distribution that has the
  256. following versions for Git, tar, Python and gcc.
  257. - Git 1.8.3.1 or greater
  258. - tar 1.28 or greater
  259. - Python 3.5.0 or greater.
  260. - gcc 5.0 or greater.
  261. If your build host does not meet any of these three listed version
  262. requirements, you can take steps to prepare the system so that you
  263. can still use the Yocto Project. See the
  264. ":ref:`ref-manual/ref-system-requirements:required git, tar, python and gcc versions`"
  265. section in the Yocto Project Reference Manual for information.
  266. 4. *Install Development Host Packages:* Required development host
  267. packages vary depending on your build host and what you want to do
  268. with the Yocto Project. Collectively, the number of required packages
  269. is large if you want to be able to cover all cases.
  270. For lists of required packages for all scenarios, see the
  271. ":ref:`ref-manual/ref-system-requirements:required packages for the build host`"
  272. section in the Yocto Project Reference Manual.
  273. Once you have completed the previous steps, you are ready to continue
  274. using a given development path on your native Linux machine. If you are
  275. going to use BitBake, see the
  276. ":ref:`dev-manual/dev-manual-start:cloning the \`\`poky\`\` repository`"
  277. section. If you are going
  278. to use the Extensible SDK, see the ":doc:`../sdk-manual/sdk-extensible`" Chapter in the Yocto
  279. Project Application Development and the Extensible Software Development
  280. Kit (eSDK) manual. If you want to work on the kernel, see the :doc:`../kernel-dev/kernel-dev`. If you are going to use
  281. Toaster, see the ":doc:`../toaster-manual/toaster-manual-setup-and-use`"
  282. section in the Toaster User Manual.
  283. .. _setting-up-to-use-crops:
  284. Setting Up to Use CROss PlatformS (CROPS)
  285. -----------------------------------------
  286. With `CROPS <https://github.com/crops/poky-container>`__, which
  287. leverages `Docker Containers <https://www.docker.com/>`__, you can
  288. create a Yocto Project development environment that is operating system
  289. agnostic. You can set up a container in which you can develop using the
  290. Yocto Project on a Windows, Mac, or Linux machine.
  291. Follow these general steps to prepare a Windows, Mac, or Linux machine
  292. as your Yocto Project build host:
  293. 1. *Determine What Your Build Host Needs:*
  294. `Docker <https://www.docker.com/what-docker>`__ is a software
  295. container platform that you need to install on the build host.
  296. Depending on your build host, you might have to install different
  297. software to support Docker containers. Go to the Docker installation
  298. page and read about the platform requirements in "`Supported
  299. Platforms <https://docs.docker.com/engine/install/#supported-platforms>`__"
  300. your build host needs to run containers.
  301. 2. *Choose What To Install:* Depending on whether or not your build host
  302. meets system requirements, you need to install "Docker CE Stable" or
  303. the "Docker Toolbox". Most situations call for Docker CE. However, if
  304. you have a build host that does not meet requirements (e.g.
  305. Pre-Windows 10 or Windows 10 "Home" version), you must install Docker
  306. Toolbox instead.
  307. 3. *Go to the Install Site for Your Platform:* Click the link for the
  308. Docker edition associated with your build host's native software. For
  309. example, if your build host is running Microsoft Windows Version 10
  310. and you want the Docker CE Stable edition, click that link under
  311. "Supported Platforms".
  312. 4. *Install the Software:* Once you have understood all the
  313. pre-requisites, you can download and install the appropriate
  314. software. Follow the instructions for your specific machine and the
  315. type of the software you need to install:
  316. - Install `Docker CE for
  317. Windows <https://docs.docker.com/docker-for-windows/install/#install-docker-desktop-on-windows>`__
  318. for Windows build hosts that meet requirements.
  319. - Install `Docker CE for
  320. MacOs <https://docs.docker.com/docker-for-mac/install/#install-and-run-docker-desktop-on-mac>`__
  321. for Mac build hosts that meet requirements.
  322. - Install `Docker Toolbox for
  323. Windows <https://docs.docker.com/toolbox/toolbox_install_windows/>`__
  324. for Windows build hosts that do not meet Docker requirements.
  325. - Install `Docker Toolbox for
  326. MacOS <https://docs.docker.com/toolbox/toolbox_install_mac/>`__
  327. for Mac build hosts that do not meet Docker requirements.
  328. - Install `Docker CE for
  329. CentOS <https://docs.docker.com/install/linux/docker-ce/centos/>`__
  330. for Linux build hosts running the CentOS distribution.
  331. - Install `Docker CE for
  332. Debian <https://docs.docker.com/install/linux/docker-ce/debian/>`__
  333. for Linux build hosts running the Debian distribution.
  334. - Install `Docker CE for
  335. Fedora <https://docs.docker.com/install/linux/docker-ce/fedora/>`__
  336. for Linux build hosts running the Fedora distribution.
  337. - Install `Docker CE for
  338. Ubuntu <https://docs.docker.com/install/linux/docker-ce/ubuntu/>`__
  339. for Linux build hosts running the Ubuntu distribution.
  340. 5. *Optionally Orient Yourself With Docker:* If you are unfamiliar with
  341. Docker and the container concept, you can learn more here -
  342. https://docs.docker.com/get-started/.
  343. 6. *Launch Docker or Docker Toolbox:* You should be able to launch
  344. Docker or the Docker Toolbox and have a terminal shell on your
  345. development host.
  346. 7. *Set Up the Containers to Use the Yocto Project:* Go to
  347. https://github.com/crops/docker-win-mac-docs/wiki and follow
  348. the directions for your particular build host (i.e. Linux, Mac, or
  349. Windows).
  350. Once you complete the setup instructions for your machine, you have
  351. the Poky, Extensible SDK, and Toaster containers available. You can
  352. click those links from the page and learn more about using each of
  353. those containers.
  354. Once you have a container set up, everything is in place to develop just
  355. as if you were running on a native Linux machine. If you are going to
  356. use the Poky container, see the "`Cloning the ``poky``
  357. Repository <#cloning-the-poky-repository>`__" section. If you are going
  358. to use the Extensible SDK container, see the
  359. ":doc:`../sdk-manual/sdk-extensible`" Chapter in the Yocto
  360. Project Application Development and the Extensible Software Development
  361. Kit (eSDK) manual. If you are going to use the Toaster container, see
  362. the ":doc:`../toaster-manual/toaster-manual-setup-and-use`"
  363. section in the Toaster User Manual.
  364. .. _setting-up-to-use-wsl:
  365. Setting Up to Use Windows Subsystem For Linux (WSLv2)
  366. -----------------------------------------------------
  367. With `Windows Subsystem for Linux
  368. (WSLv2) <https://docs.microsoft.com/en-us/windows/wsl/wsl2-about>`__,
  369. you can create a Yocto Project development environment that allows you
  370. to build on Windows. You can set up a Linux distribution inside Windows
  371. in which you can develop using the Yocto Project.
  372. Follow these general steps to prepare a Windows machine using WSLv2 as
  373. your Yocto Project build host:
  374. 1. *Make sure your Windows 10 machine is capable of running WSLv2:*
  375. WSLv2 is only available for Windows 10 builds > 18917. To check which
  376. build version you are running, you may open a command prompt on
  377. Windows and execute the command "ver".
  378. ::
  379. C:\Users\myuser> ver
  380. Microsoft Windows [Version 10.0.19041.153]
  381. If your build is capable of running
  382. WSLv2 you may continue, for more information on this subject or
  383. instructions on how to upgrade to WSLv2 visit `Windows 10
  384. WSLv2 <https://docs.microsoft.com/en-us/windows/wsl/wsl2-install>`__
  385. 2. *Install the Linux distribution of your choice inside Windows 10:*
  386. Once you know your version of Windows 10 supports WSLv2, you can
  387. install the distribution of your choice from the Microsoft Store.
  388. Open the Microsoft Store and search for Linux. While there are
  389. several Linux distributions available, the assumption is that your
  390. pick will be one of the distributions supported by the Yocto Project
  391. as stated on the instructions for using a native Linux host. After
  392. making your selection, simply click "Get" to download and install the
  393. distribution.
  394. 3. *Check your Linux distribution is using WSLv2:* Open a Windows
  395. PowerShell and run:
  396. ::
  397. C:\WINDOWS\system32> wsl -l -v
  398. NAME STATE VERSION
  399. *Ubuntu Running 2
  400. Note the version column which says the WSL version
  401. being used by your distribution, on compatible systems, this can be
  402. changed back at any point in time.
  403. 4. *Optionally Orient Yourself on WSL:* If you are unfamiliar with WSL,
  404. you can learn more here -
  405. https://docs.microsoft.com/en-us/windows/wsl/wsl2-about.
  406. 5. *Launch your WSL Distibution:* From the Windows start menu simply
  407. launch your WSL distribution just like any other application.
  408. 6. *Optimize your WSLv2 storage often:* Due to the way storage is
  409. handled on WSLv2, the storage space used by the undelying Linux
  410. distribution is not reflected immedately, and since bitbake heavily
  411. uses storage, after several builds, you may be unaware you are
  412. running out of space. WSLv2 uses a VHDX file for storage, this issue
  413. can be easily avoided by manually optimizing this file often, this
  414. can be done in the following way:
  415. 1. *Find the location of your VHDX file:* First you need to find the
  416. distro app package directory, to achieve this open a Windows
  417. Powershell as Administrator and run:
  418. ::
  419. C:\WINDOWS\system32> Get-AppxPackage -Name "*Ubuntu*" | Select PackageFamilyName
  420. PackageFamilyName
  421. -----------------
  422. CanonicalGroupLimited.UbuntuonWindows_79abcdefgh
  423. You should now
  424. replace the PackageFamilyName and your user on the following path
  425. to find your VHDX file:
  426. ::
  427. ls C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\
  428. Mode LastWriteTime Length Name
  429. -a---- 3/14/2020 9:52 PM 57418973184 ext4.vhdx
  430. Your VHDX file path is:
  431. ``C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ext4.vhdx``
  432. 2. *Optimize your VHDX file:* Open a Windows Powershell as
  433. Administrator to optimize your VHDX file, shutting down WSL first:
  434. ::
  435. C:\WINDOWS\system32> wsl --shutdown
  436. C:\WINDOWS\system32> optimize-vhd -Path C:\Users\myuser\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79abcdefgh\LocalState\ext4.vhdx -Mode full
  437. A progress bar should be shown while optimizing the
  438. VHDX file, and storage should now be reflected correctly on the
  439. Windows Explorer.
  440. .. note::
  441. The current implementation of WSLv2 does not have out-of-the-box
  442. access to external devices such as those connected through a USB
  443. port, but it automatically mounts your
  444. C:
  445. drive on
  446. /mnt/c/
  447. (and others), which you can use to share deploy artifacts to be later
  448. flashed on hardware through Windows, but your build directory should
  449. not reside inside this mountpoint.
  450. Once you have WSLv2 set up, everything is in place to develop just as if
  451. you were running on a native Linux machine. If you are going to use the
  452. Extensible SDK container, see the ":doc:`../sdk-manual/sdk-extensible`" Chapter in the Yocto
  453. Project Application Development and the Extensible Software Development
  454. Kit (eSDK) manual. If you are going to use the Toaster container, see
  455. the ":doc:`../toaster-manual/toaster-manual-setup-and-use`"
  456. section in the Toaster User Manual.
  457. Locating Yocto Project Source Files
  458. ===================================
  459. This section shows you how to locate, fetch and configure the source
  460. files you'll need to work with the Yocto Project.
  461. .. note::
  462. - For concepts and introductory information about Git as it is used
  463. in the Yocto Project, see the ":ref:`overview-manual/overview-manual-development-environment:git`"
  464. section in the Yocto Project Overview and Concepts Manual.
  465. - For concepts on Yocto Project source repositories, see the
  466. ":ref:`overview-manual/overview-manual-development-environment:yocto project source repositories`"
  467. section in the Yocto Project Overview and Concepts Manual."
  468. Accessing Source Repositories
  469. -----------------------------
  470. Working from a copy of the upstream :ref:`dev-manual/dev-manual-start:accessing source repositories` is the
  471. preferred method for obtaining and using a Yocto Project release. You
  472. can view the Yocto Project Source Repositories at
  473. :yocto_git:`/`. In particular, you can find the ``poky``
  474. repository at :yocto_git:`/cgit.cgi/poky`.
  475. Use the following procedure to locate the latest upstream copy of the
  476. ``poky`` Git repository:
  477. 1. *Access Repositories:* Open a browser and go to
  478. :yocto_git:`/` to access the GUI-based interface into the
  479. Yocto Project source repositories.
  480. 2. *Select the Repository:* Click on the repository in which you are
  481. interested (e.g. ``poky``).
  482. 3. *Find the URL Used to Clone the Repository:* At the bottom of the
  483. page, note the URL used to clone that repository
  484. (e.g. :yocto_git:`/cgit.cgi/poky`).
  485. .. note::
  486. For information on cloning a repository, see the "
  487. Cloning the
  488. poky
  489. Repository
  490. " section.
  491. Accessing Index of Releases
  492. ---------------------------
  493. Yocto Project maintains an Index of Releases area that contains related
  494. files that contribute to the Yocto Project. Rather than Git
  495. repositories, these files are tarballs that represent snapshots in time
  496. of a given component.
  497. .. note::
  498. The recommended method for accessing Yocto Project components is to
  499. use Git to clone the upstream repository and work from within that
  500. locally cloned repository. The procedure in this section exists
  501. should you desire a tarball snapshot of any given component.
  502. Follow these steps to locate and download a particular tarball:
  503. 1. *Access the Index of Releases:* Open a browser and go to
  504. :yocto_dl:`Index of Releases </releases>`. The
  505. list represents released components (e.g. ``bitbake``, ``sato``, and
  506. so on).
  507. .. note::
  508. The
  509. yocto
  510. directory contains the full array of released Poky tarballs. The
  511. poky
  512. directory in the Index of Releases was historically used for very
  513. early releases and exists now only for retroactive completeness.
  514. 2. *Select a Component:* Click on any released component in which you
  515. are interested (e.g. ``yocto``).
  516. 3. *Find the Tarball:* Drill down to find the associated tarball. For
  517. example, click on ``yocto-&DISTRO;`` to view files associated with the
  518. Yocto Project &DISTRO; release (e.g.
  519. ``&YOCTO_POKY;.tar.bz2``, which is the
  520. released Poky tarball).
  521. 4. *Download the Tarball:* Click the tarball to download and save a
  522. snapshot of the given component.
  523. Using the Downloads Page
  524. ------------------------
  525. The :yocto_home:`Yocto Project Website <>` uses a "DOWNLOADS" page
  526. from which you can locate and download tarballs of any Yocto Project
  527. release. Rather than Git repositories, these files represent snapshot
  528. tarballs similar to the tarballs located in the Index of Releases
  529. described in the "`Accessing Index of
  530. Releases <#accessing-index-of-releases>`__" section.
  531. .. note::
  532. The recommended method for accessing Yocto Project components is to
  533. use Git to clone a repository and work from within that local
  534. repository. The procedure in this section exists should you desire a
  535. tarball snapshot of any given component.
  536. 1. *Go to the Yocto Project Website:* Open The
  537. :yocto_home:`Yocto Project Website <>` in your browser.
  538. 2. *Get to the Downloads Area:* Select the "DOWNLOADS" item from the
  539. pull-down "SOFTWARE" tab menu near the top of the page.
  540. 3. *Select a Yocto Project Release:* Use the menu next to "RELEASE" to
  541. display and choose a recent or past supported Yocto Project release
  542. (e.g. &DISTRO_NAME_NO_CAP;, &DISTRO_NAME_NO_CAP_MINUS_ONE;, and so forth).
  543. .. note::
  544. For a "map" of Yocto Project releases to version numbers, see the
  545. Releases
  546. wiki page.
  547. You can use the "RELEASE ARCHIVE" link to reveal a menu of all Yocto
  548. Project releases.
  549. 4. *Download Tools or Board Support Packages (BSPs):* From the
  550. "DOWNLOADS" page, you can download tools or BSPs as well. Just scroll
  551. down the page and look for what you need.
  552. Accessing Nightly Builds
  553. ------------------------
  554. Yocto Project maintains an area for nightly builds that contains tarball
  555. releases at https://autobuilder.yocto.io//pub/nightly/. These builds include Yocto
  556. Project releases ("poky"), toolchains, and builds for supported
  557. machines.
  558. Should you ever want to access a nightly build of a particular Yocto
  559. Project component, use the following procedure:
  560. 1. *Locate the Index of Nightly Builds:* Open a browser and go to
  561. https://autobuilder.yocto.io//pub/nightly/ to access the Nightly Builds.
  562. 2. *Select a Date:* Click on the date in which you are interested. If
  563. you want the latest builds, use "CURRENT".
  564. 3. *Select a Build:* Choose the area in which you are interested. For
  565. example, if you are looking for the most recent toolchains, select
  566. the "toolchain" link.
  567. 4. *Find the Tarball:* Drill down to find the associated tarball.
  568. 5. *Download the Tarball:* Click the tarball to download and save a
  569. snapshot of the given component.
  570. Cloning and Checking Out Branches
  571. =================================
  572. To use the Yocto Project for development, you need a release locally
  573. installed on your development system. This locally installed set of
  574. files is referred to as the :term:`Source Directory`
  575. in the Yocto Project documentation.
  576. The preferred method of creating your Source Directory is by using
  577. :ref:`overview-manual/overview-manual-development-environment:git` to clone a local copy of the upstream
  578. ``poky`` repository. Working from a cloned copy of the upstream
  579. repository allows you to contribute back into the Yocto Project or to
  580. simply work with the latest software on a development branch. Because
  581. Git maintains and creates an upstream repository with a complete history
  582. of changes and you are working with a local clone of that repository,
  583. you have access to all the Yocto Project development branches and tag
  584. names used in the upstream repository.
  585. Cloning the ``poky`` Repository
  586. -------------------------------
  587. Follow these steps to create a local version of the upstream
  588. :term:`Poky` Git repository.
  589. 1. *Set Your Directory:* Change your working directory to where you want
  590. to create your local copy of ``poky``.
  591. 2. *Clone the Repository:* The following example command clones the
  592. ``poky`` repository and uses the default name "poky" for your local
  593. repository:
  594. ::
  595. $ git clone git://git.yoctoproject.org/poky
  596. Cloning into 'poky'...
  597. remote: Counting objects: 432160, done.
  598. remote: Compressing objects: 100% (102056/102056), done.
  599. remote: Total 432160 (delta 323116), reused 432037 (delta 323000)
  600. Receiving objects: 100% (432160/432160), 153.81 MiB | 8.54 MiB/s, done.
  601. Resolving deltas: 100% (323116/323116), done.
  602. Checking connectivity... done.
  603. Unless you
  604. specify a specific development branch or tag name, Git clones the
  605. "master" branch, which results in a snapshot of the latest
  606. development changes for "master". For information on how to check out
  607. a specific development branch or on how to check out a local branch
  608. based on a tag name, see the "`Checking Out By Branch in
  609. Poky <#checking-out-by-branch-in-poky>`__" and `Checking Out By Tag
  610. in Poky <#checkout-out-by-tag-in-poky>`__" sections, respectively.
  611. Once the local repository is created, you can change to that
  612. directory and check its status. Here, the single "master" branch
  613. exists on your system and by default, it is checked out:
  614. ::
  615. $ cd ~/poky
  616. $ git status
  617. On branch master
  618. Your branch is up-to-date with 'origin/master'.
  619. nothing to commit, working directory clean
  620. $ git branch
  621. * master
  622. Your local repository of poky is identical to the
  623. upstream poky repository at the time from which it was cloned. As you
  624. work with the local branch, you can periodically use the
  625. ``git pull --rebase`` command to be sure you are up-to-date
  626. with the upstream branch.
  627. Checking Out by Branch in Poky
  628. ------------------------------
  629. When you clone the upstream poky repository, you have access to all its
  630. development branches. Each development branch in a repository is unique
  631. as it forks off the "master" branch. To see and use the files of a
  632. particular development branch locally, you need to know the branch name
  633. and then specifically check out that development branch.
  634. .. note::
  635. Checking out an active development branch by branch name gives you a
  636. snapshot of that particular branch at the time you check it out.
  637. Further development on top of the branch that occurs after check it
  638. out can occur.
  639. 1. *Switch to the Poky Directory:* If you have a local poky Git
  640. repository, switch to that directory. If you do not have the local
  641. copy of poky, see the "`Cloning the ``poky``
  642. Repository <#cloning-the-poky-repository>`__" section.
  643. 2. *Determine Existing Branch Names:*
  644. ::
  645. $ git branch -a
  646. * master
  647. remotes/origin/1.1_M1
  648. remotes/origin/1.1_M2
  649. remotes/origin/1.1_M3
  650. remotes/origin/1.1_M4
  651. remotes/origin/1.2_M1
  652. remotes/origin/1.2_M2
  653. remotes/origin/1.2_M3
  654. . . .
  655. remotes/origin/thud
  656. remotes/origin/thud-next
  657. remotes/origin/warrior
  658. remotes/origin/warrior-next
  659. remotes/origin/zeus
  660. remotes/origin/zeus-next
  661. ... and so on ...
  662. 3. *Check out the Branch:* Check out the development branch in which you
  663. want to work. For example, to access the files for the Yocto Project
  664. &DISTRO; Release (&DISTRO_NAME;), use the following command:
  665. ::
  666. $ git checkout -b &DISTRO_NAME; origin/&DISTRO_NAME;
  667. Branch &DISTRO_NAME; set up to track remote branch &DISTRO_NAME; from origin.
  668. Switched to a new branch '&DISTRO_NAME;'
  669. The previous command checks out the "&DISTRO_NAME;" development
  670. branch and reports that the branch is tracking the upstream
  671. "origin/&DISTRO_NAME;" branch.
  672. The following command displays the branches that are now part of your
  673. local poky repository. The asterisk character indicates the branch
  674. that is currently checked out for work:
  675. ::
  676. $ git branch
  677. master *
  678. &DISTRO_NAME;
  679. .. _checkout-out-by-tag-in-poky:
  680. Checking Out by Tag in Poky
  681. ---------------------------
  682. Similar to branches, the upstream repository uses tags to mark specific
  683. commits associated with significant points in a development branch (i.e.
  684. a release point or stage of a release). You might want to set up a local
  685. branch based on one of those points in the repository. The process is
  686. similar to checking out by branch name except you use tag names.
  687. .. note::
  688. Checking out a branch based on a tag gives you a stable set of files
  689. not affected by development on the branch above the tag.
  690. 1. *Switch to the Poky Directory:* If you have a local poky Git
  691. repository, switch to that directory. If you do not have the local
  692. copy of poky, see the "`Cloning the ``poky``
  693. Repository <#cloning-the-poky-repository>`__" section.
  694. 2. *Fetch the Tag Names:* To checkout the branch based on a tag name,
  695. you need to fetch the upstream tags into your local repository:
  696. ::
  697. $ git fetch --tags
  698. $
  699. 3. *List the Tag Names:* You can list the tag names now:
  700. ::
  701. $ git tag
  702. 1.1_M1.final
  703. 1.1_M1.rc1
  704. 1.1_M1.rc2
  705. 1.1_M2.final
  706. 1.1_M2.rc1
  707. .
  708. .
  709. .
  710. yocto-2.5
  711. yocto-2.5.1
  712. yocto-2.5.2
  713. yocto-2.5.3
  714. yocto-2.6
  715. yocto-2.6.1
  716. yocto-2.6.2
  717. yocto-2.7
  718. yocto_1.5_M5.rc8
  719. 4. *Check out the Branch:*
  720. ::
  721. $ git checkout tags/yocto-&DISTRO; -b my_yocto_&DISTRO;
  722. Switched to a new branch 'my_yocto_&DISTRO;'
  723. $ git branch
  724. master
  725. * my_yocto_&DISTRO;
  726. The previous command creates and
  727. checks out a local branch named "my_yocto_&DISTRO;", which is based on
  728. the commit in the upstream poky repository that has the same tag. In
  729. this example, the files you have available locally as a result of the
  730. ``checkout`` command are a snapshot of the "&DISTRO_NAME_NO_CAP;"
  731. development branch at the point where Yocto Project &DISTRO; was
  732. released.