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