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