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