| 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 | Yocto Project Quick Build | 
|  | 5 | ========================= | 
|  | 6 |  | 
|  | 7 | Welcome! | 
|  | 8 | ======== | 
|  | 9 |  | 
|  | 10 | This short document steps you through the process for a typical | 
|  | 11 | image build using the Yocto Project. The document also introduces how to | 
|  | 12 | configure a build for specific hardware. You will use Yocto Project to | 
|  | 13 | build a reference embedded OS called Poky. | 
|  | 14 |  | 
|  | 15 | .. note:: | 
|  | 16 |  | 
|  | 17 | -  The examples in this paper assume you are using a native Linux | 
|  | 18 | system running a recent Ubuntu Linux distribution. If the machine | 
|  | 19 | you want to use Yocto Project on to build an image | 
|  | 20 | (:term:`Build Host`) is not | 
|  | 21 | a native Linux system, you can still perform these steps by using | 
|  | 22 | CROss PlatformS (CROPS) and setting up a Poky container. See the | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 23 | :ref:`dev-manual/start:setting up to use cross platforms (crops)` | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 24 | section | 
|  | 25 | in the Yocto Project Development Tasks Manual for more | 
|  | 26 | information. | 
|  | 27 |  | 
| Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 28 | -  You may use version 2 of Windows Subsystem For Linux (WSL 2) to set | 
|  | 29 | up a build host using Windows 10 or later, Windows Server 2019 or later. | 
|  | 30 | See the :ref:`dev-manual/start:setting up to use windows subsystem for | 
|  | 31 | linux (wsl 2)` section in the Yocto Project Development Tasks Manual | 
|  | 32 | for more information. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 33 |  | 
|  | 34 | If you want more conceptual or background information on the Yocto | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 35 | Project, see the :doc:`/overview-manual/index`. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 36 |  | 
|  | 37 | Compatible Linux Distribution | 
|  | 38 | ============================= | 
|  | 39 |  | 
|  | 40 | Make sure your :term:`Build Host` meets the | 
|  | 41 | following requirements: | 
|  | 42 |  | 
| Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 43 | -  At least &MIN_DISK_SPACE; Gbytes of free disk space, though | 
|  | 44 | much more will help to run multiple builds and increase | 
|  | 45 | performance by reusing build artifacts. | 
|  | 46 |  | 
|  | 47 | -  At least &MIN_RAM; Gbytes of RAM, though a modern modern build host with as | 
|  | 48 | much RAM and as many CPU cores as possible is strongly recommended to | 
|  | 49 | maximize build performance. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 50 |  | 
|  | 51 | -  Runs a supported Linux distribution (i.e. recent releases of Fedora, | 
|  | 52 | openSUSE, CentOS, Debian, or Ubuntu). For a list of Linux | 
|  | 53 | distributions that support the Yocto Project, see the | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 54 | :ref:`ref-manual/system-requirements:supported linux distributions` | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 55 | section in the Yocto Project Reference Manual. For detailed | 
|  | 56 | information on preparing your build host, see the | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 57 | :ref:`dev-manual/start:preparing the build host` | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 58 | section in the Yocto Project Development Tasks Manual. | 
|  | 59 |  | 
|  | 60 | - | 
|  | 61 |  | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 62 | -  Git &MIN_GIT_VERSION; or greater | 
|  | 63 | -  tar &MIN_TAR_VERSION; or greater | 
|  | 64 | -  Python &MIN_PYTHON_VERSION; or greater. | 
|  | 65 | -  gcc &MIN_GCC_VERSION; or greater. | 
| Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 66 | -  GNU make &MIN_MAKE_VERSION; or greater | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 67 |  | 
|  | 68 | If your build host does not meet any of these three listed version | 
|  | 69 | requirements, you can take steps to prepare the system so that you | 
|  | 70 | can still use the Yocto Project. See the | 
| Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 71 | :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] | 72 | section in the Yocto Project Reference Manual for information. | 
|  | 73 |  | 
|  | 74 | Build Host Packages | 
|  | 75 | =================== | 
|  | 76 |  | 
|  | 77 | You must install essential host packages on your build host. The | 
|  | 78 | following command installs the host packages based on an Ubuntu | 
| Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 79 | distribution:: | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 80 |  | 
| Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 81 | $ sudo apt install &UBUNTU_HOST_PACKAGES_ESSENTIAL; | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 82 |  | 
|  | 83 | .. note:: | 
|  | 84 |  | 
|  | 85 | For host package requirements on all supported Linux distributions, | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 86 | see the :ref:`ref-manual/system-requirements:required packages for the build host` | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 87 | section in the Yocto Project Reference Manual. | 
|  | 88 |  | 
|  | 89 | Use Git to Clone Poky | 
|  | 90 | ===================== | 
|  | 91 |  | 
|  | 92 | Once you complete the setup instructions for your machine, you need to | 
|  | 93 | get a copy of the Poky repository on your build host. Use the following | 
|  | 94 | commands to clone the Poky repository. | 
|  | 95 |  | 
|  | 96 | .. code-block:: shell | 
|  | 97 |  | 
|  | 98 | $ git clone git://git.yoctoproject.org/poky | 
|  | 99 | Cloning into 'poky'... | 
|  | 100 | remote: Counting | 
|  | 101 | objects: 432160, done. remote: Compressing objects: 100% | 
|  | 102 | (102056/102056), done. remote: Total 432160 (delta 323116), reused | 
|  | 103 | 432037 (delta 323000) Receiving objects: 100% (432160/432160), 153.81 MiB | 8.54 MiB/s, done. | 
|  | 104 | Resolving deltas: 100% (323116/323116), done. | 
|  | 105 | Checking connectivity... done. | 
|  | 106 |  | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 107 | Go to :yocto_wiki:`Releases wiki page </Releases>`, and choose a release | 
|  | 108 | codename (such as ``&DISTRO_NAME_NO_CAP;``), corresponding to either the | 
|  | 109 | latest stable release or a Long Term Support release. | 
|  | 110 |  | 
|  | 111 | Then move to the ``poky`` directory and take a look at existing branches: | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 112 |  | 
|  | 113 | .. code-block:: shell | 
|  | 114 |  | 
|  | 115 | $ cd poky | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 116 | $ git branch -a | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 117 | . | 
|  | 118 | . | 
|  | 119 | . | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 120 | remotes/origin/HEAD -> origin/master | 
|  | 121 | remotes/origin/dunfell | 
|  | 122 | remotes/origin/dunfell-next | 
|  | 123 | . | 
|  | 124 | . | 
|  | 125 | . | 
|  | 126 | remotes/origin/gatesgarth | 
|  | 127 | remotes/origin/gatesgarth-next | 
|  | 128 | . | 
|  | 129 | . | 
|  | 130 | . | 
|  | 131 | remotes/origin/master | 
|  | 132 | remotes/origin/master-next | 
|  | 133 | . | 
|  | 134 | . | 
|  | 135 | . | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 136 |  | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 137 |  | 
|  | 138 | For this example, check out the ``&DISTRO_NAME_NO_CAP;`` branch based on the | 
|  | 139 | ``&DISTRO_NAME;`` release: | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 140 |  | 
|  | 141 | .. code-block:: shell | 
|  | 142 |  | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 143 | $ git checkout -t origin/&DISTRO_NAME_NO_CAP; -b my-&DISTRO_NAME_NO_CAP; | 
|  | 144 | Branch 'my-&DISTRO_NAME_NO_CAP;' set up to track remote branch '&DISTRO_NAME_NO_CAP;' from 'origin'. | 
|  | 145 | Switched to a new branch 'my-&DISTRO_NAME_NO_CAP;' | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 146 |  | 
|  | 147 | The previous Git checkout command creates a local branch named | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 148 | ``my-&DISTRO_NAME_NO_CAP;``. The files available to you in that branch | 
|  | 149 | exactly match the repository's files in the ``&DISTRO_NAME_NO_CAP;`` | 
|  | 150 | release branch. | 
|  | 151 |  | 
|  | 152 | Note that you can regularly type the following command in the same directory | 
|  | 153 | to keep your local files in sync with the release branch: | 
|  | 154 |  | 
|  | 155 | .. code-block:: shell | 
|  | 156 |  | 
|  | 157 | $ git pull | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 158 |  | 
|  | 159 | For more options and information about accessing Yocto Project related | 
|  | 160 | repositories, see the | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 161 | :ref:`dev-manual/start:locating yocto project source files` | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 162 | section in the Yocto Project Development Tasks Manual. | 
|  | 163 |  | 
|  | 164 | Building Your Image | 
|  | 165 | =================== | 
|  | 166 |  | 
|  | 167 | Use the following steps to build your image. The build process creates | 
|  | 168 | an entire Linux distribution, including the toolchain, from source. | 
|  | 169 |  | 
|  | 170 | .. note:: | 
|  | 171 |  | 
|  | 172 | -  If you are working behind a firewall and your build host is not | 
|  | 173 | set up for proxies, you could encounter problems with the build | 
|  | 174 | process when fetching source code (e.g. fetcher failures or Git | 
|  | 175 | failures). | 
|  | 176 |  | 
|  | 177 | -  If you do not know your proxy settings, consult your local network | 
|  | 178 | infrastructure resources and get that information. A good starting | 
|  | 179 | point could also be to check your web browser settings. Finally, | 
|  | 180 | you can find more information on the | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 181 | ":yocto_wiki:`Working Behind a Network Proxy </Working_Behind_a_Network_Proxy>`" | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 182 | page of the Yocto Project Wiki. | 
|  | 183 |  | 
|  | 184 | #. **Initialize the Build Environment:** From within the ``poky`` | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 185 | directory, run the :ref:`ref-manual/structure:\`\`oe-init-build-env\`\`` | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 186 | environment | 
|  | 187 | setup script to define Yocto Project's build environment on your | 
|  | 188 | build host. | 
|  | 189 |  | 
|  | 190 | .. code-block:: shell | 
|  | 191 |  | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 192 | $ cd poky | 
| Andrew Geissler | 4c19ea1 | 2020-10-27 13:52:24 -0500 | [diff] [blame] | 193 | $ source oe-init-build-env | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 194 | You had no conf/local.conf file. This configuration file has therefore been | 
|  | 195 | created for you with some default values. You may wish to edit it to, for | 
|  | 196 | example, select a different MACHINE (target hardware). See conf/local.conf | 
|  | 197 | for more information as common configuration options are commented. | 
|  | 198 |  | 
|  | 199 | You had no conf/bblayers.conf file. This configuration file has therefore | 
|  | 200 | been created for you with some default values. To add additional metadata | 
|  | 201 | layers into your configuration please add entries to conf/bblayers.conf. | 
|  | 202 |  | 
|  | 203 | The Yocto Project has extensive documentation about OE including a reference | 
|  | 204 | manual which can be found at: | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 205 | https://docs.yoctoproject.org | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 206 |  | 
|  | 207 | For more information about OpenEmbedded see their website: | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 208 | https://www.openembedded.org/ | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 209 |  | 
|  | 210 | ### Shell environment set up for builds. ### | 
|  | 211 |  | 
|  | 212 | You can now run 'bitbake <target>' | 
|  | 213 |  | 
|  | 214 | Common targets are: | 
|  | 215 | core-image-minimal | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 216 | core-image-full-cmdline | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 217 | core-image-sato | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 218 | core-image-weston | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 219 | meta-toolchain | 
|  | 220 | meta-ide-support | 
|  | 221 |  | 
| Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 222 | You can also run generated QEMU images with a command like 'runqemu qemux86-64' | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 223 |  | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 224 | Other commonly useful commands are: | 
|  | 225 | - 'devtool' and 'recipetool' handle common recipe tasks | 
|  | 226 | - 'bitbake-layers' handles common layer tasks | 
|  | 227 | - 'oe-pkgdata-util' handles common target package tasks | 
|  | 228 |  | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 229 | Among other things, the script creates the :term:`Build Directory`, which is | 
|  | 230 | ``build`` in this case and is located in the :term:`Source Directory`.  After | 
| Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 231 | the script runs, your current working directory is set to the | 
|  | 232 | :term:`Build Directory`. Later, when the build completes, the | 
|  | 233 | :term:`Build Directory` contains all the files created during the build. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 234 |  | 
|  | 235 | #. **Examine Your Local Configuration File:** When you set up the build | 
|  | 236 | environment, a local configuration file named ``local.conf`` becomes | 
| Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 237 | available in a ``conf`` subdirectory of the :term:`Build Directory`. For this | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 238 | example, the defaults are set to build for a ``qemux86`` target, | 
|  | 239 | which is suitable for emulation. The package manager used is set to | 
|  | 240 | the RPM package manager. | 
|  | 241 |  | 
|  | 242 | .. tip:: | 
|  | 243 |  | 
|  | 244 | You can significantly speed up your build and guard against fetcher | 
| Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 245 | failures by using :ref:`overview-manual/concepts:shared state cache` | 
|  | 246 | mirrors and enabling :ref:`overview-manual/concepts:hash equivalence`. | 
|  | 247 | This way, you can use pre-built artifacts rather than building them. | 
|  | 248 | This is relevant only when your network and the server that you use | 
|  | 249 | can download these artifacts faster than you would be able to build them. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 250 |  | 
| Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 251 | To use such mirrors, uncomment the below lines in your ``conf/local.conf`` | 
| Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 252 | file in the :term:`Build Directory`:: | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 253 |  | 
| Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 254 | BB_SIGNATURE_HANDLER = "OEEquivHash" | 
|  | 255 | BB_HASHSERVE = "auto" | 
| Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 256 | BB_HASHSERVE_UPSTREAM = "hashserv.yocto.io:8687" | 
| Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 257 | SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH" | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 258 |  | 
|  | 259 | #. **Start the Build:** Continue with the following command to build an OS | 
|  | 260 | image for the target, which is ``core-image-sato`` in this example: | 
|  | 261 |  | 
|  | 262 | .. code-block:: shell | 
|  | 263 |  | 
|  | 264 | $ bitbake core-image-sato | 
|  | 265 |  | 
|  | 266 | For information on using the ``bitbake`` command, see the | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 267 | :ref:`overview-manual/concepts:bitbake` section in the Yocto Project Overview and | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 268 | Concepts Manual, or see | 
| Andrew Geissler | fc113ea | 2023-03-31 09:59:46 -0500 | [diff] [blame] | 269 | :ref:`bitbake-user-manual/bitbake-user-manual-intro:the bitbake command` | 
| Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 270 | in the BitBake User Manual. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 271 |  | 
|  | 272 | #. **Simulate Your Image Using QEMU:** Once this particular image is | 
|  | 273 | built, you can start QEMU, which is a Quick EMUlator that ships with | 
|  | 274 | the Yocto Project: | 
|  | 275 |  | 
|  | 276 | .. code-block:: shell | 
|  | 277 |  | 
|  | 278 | $ runqemu qemux86-64 | 
|  | 279 |  | 
|  | 280 | If you want to learn more about running QEMU, see the | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 281 | :ref:`dev-manual/qemu:using the quick emulator (qemu)` chapter in | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 282 | the Yocto Project Development Tasks Manual. | 
|  | 283 |  | 
|  | 284 | #. **Exit QEMU:** Exit QEMU by either clicking on the shutdown icon or by typing | 
|  | 285 | ``Ctrl-C`` in the QEMU transcript window from which you evoked QEMU. | 
|  | 286 |  | 
|  | 287 | Customizing Your Build for Specific Hardware | 
|  | 288 | ============================================ | 
|  | 289 |  | 
|  | 290 | So far, all you have done is quickly built an image suitable for | 
|  | 291 | emulation only. This section shows you how to customize your build for | 
|  | 292 | specific hardware by adding a hardware layer into the Yocto Project | 
|  | 293 | development environment. | 
|  | 294 |  | 
|  | 295 | In general, layers are repositories that contain related sets of | 
|  | 296 | instructions and configurations that tell the Yocto Project what to do. | 
|  | 297 | Isolating related metadata into functionally specific layers facilitates | 
|  | 298 | modular development and makes it easier to reuse the layer metadata. | 
|  | 299 |  | 
|  | 300 | .. note:: | 
|  | 301 |  | 
|  | 302 | By convention, layer names start with the string "meta-". | 
|  | 303 |  | 
|  | 304 | Follow these steps to add a hardware layer: | 
|  | 305 |  | 
| William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 306 | #. **Find a Layer:** Many hardware layers are available. The Yocto Project | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 307 | :yocto_git:`Source Repositories <>` has many hardware layers. | 
|  | 308 | This example adds the | 
|  | 309 | `meta-altera <https://github.com/kraj/meta-altera>`__ hardware layer. | 
|  | 310 |  | 
|  | 311 | #. **Clone the Layer:** Use Git to make a local copy of the layer on your | 
|  | 312 | machine. You can put the copy in the top level of the copy of the | 
|  | 313 | Poky repository created earlier: | 
|  | 314 |  | 
|  | 315 | .. code-block:: shell | 
|  | 316 |  | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 317 | $ cd poky | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 318 | $ git clone https://github.com/kraj/meta-altera.git | 
|  | 319 | Cloning into 'meta-altera'... | 
|  | 320 | remote: Counting objects: 25170, done. | 
|  | 321 | remote: Compressing objects: 100% (350/350), done. | 
|  | 322 | remote: Total 25170 (delta 645), reused 719 (delta 538), pack-reused 24219 | 
|  | 323 | Receiving objects: 100% (25170/25170), 41.02 MiB | 1.64 MiB/s, done. | 
|  | 324 | Resolving deltas: 100% (13385/13385), done. | 
|  | 325 | Checking connectivity... done. | 
|  | 326 |  | 
| William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 327 | The hardware layer is now available | 
|  | 328 | next to other layers inside the Poky reference repository on your build | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 329 | host as ``meta-altera`` and contains all the metadata needed to | 
|  | 330 | support hardware from Altera, which is owned by Intel. | 
|  | 331 |  | 
|  | 332 | .. note:: | 
|  | 333 |  | 
|  | 334 | It is recommended for layers to have a branch per Yocto Project release. | 
|  | 335 | Please make sure to checkout the layer branch supporting the Yocto Project | 
|  | 336 | release you're using. | 
|  | 337 |  | 
|  | 338 | #. **Change the Configuration to Build for a Specific Machine:** The | 
|  | 339 | :term:`MACHINE` variable in the | 
|  | 340 | ``local.conf`` file specifies the machine for the build. For this | 
| Andrew Geissler | 0903674 | 2021-06-25 14:25:14 -0500 | [diff] [blame] | 341 | example, set the :term:`MACHINE` variable to ``cyclone5``. These | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 342 | configurations are used: | 
|  | 343 | https://github.com/kraj/meta-altera/blob/master/conf/machine/cyclone5.conf. | 
|  | 344 |  | 
|  | 345 | .. note:: | 
|  | 346 |  | 
|  | 347 | See the "Examine Your Local Configuration File" step earlier for more | 
|  | 348 | information on configuring the build. | 
|  | 349 |  | 
|  | 350 | #. **Add Your Layer to the Layer Configuration File:** Before you can use | 
|  | 351 | a layer during a build, you must add it to your ``bblayers.conf`` | 
| Patrick Williams | 2390b1b | 2022-11-03 13:47:49 -0500 | [diff] [blame] | 352 | file, which is found in the :term:`Build Directory` ``conf`` directory. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 353 |  | 
|  | 354 | Use the ``bitbake-layers add-layer`` command to add the layer to the | 
|  | 355 | configuration file: | 
|  | 356 |  | 
|  | 357 | .. code-block:: shell | 
|  | 358 |  | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 359 | $ cd poky/build | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 360 | $ bitbake-layers add-layer ../meta-altera | 
|  | 361 | NOTE: Starting bitbake server... | 
|  | 362 | Parsing recipes: 100% |##################################################################| Time: 0:00:32 | 
|  | 363 | Parsing of 918 .bb files complete (0 cached, 918 parsed). 1401 targets, | 
|  | 364 | 123 skipped, 0 masked, 0 errors. | 
|  | 365 |  | 
|  | 366 | You can find | 
|  | 367 | more information on adding layers in the | 
| Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 368 | :ref:`dev-manual/layers:adding a layer using the \`\`bitbake-layers\`\` script` | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 369 | section. | 
|  | 370 |  | 
|  | 371 | Completing these steps has added the ``meta-altera`` layer to your Yocto | 
|  | 372 | Project development environment and configured it to build for the | 
|  | 373 | ``cyclone5`` machine. | 
|  | 374 |  | 
|  | 375 | .. note:: | 
|  | 376 |  | 
|  | 377 | The previous steps are for demonstration purposes only. If you were | 
|  | 378 | to attempt to build an image for the ``cyclone5`` machine, you should | 
|  | 379 | read the Altera ``README``. | 
|  | 380 |  | 
|  | 381 | Creating Your Own General Layer | 
|  | 382 | =============================== | 
|  | 383 |  | 
|  | 384 | Maybe you have an application or specific set of behaviors you need to | 
|  | 385 | isolate. You can create your own general layer using the | 
|  | 386 | ``bitbake-layers create-layer`` command. The tool automates layer | 
|  | 387 | creation by setting up a subdirectory with a ``layer.conf`` | 
|  | 388 | configuration file, a ``recipes-example`` subdirectory that contains an | 
|  | 389 | ``example.bb`` recipe, a licensing file, and a ``README``. | 
|  | 390 |  | 
|  | 391 | The following commands run the tool to create a layer named | 
|  | 392 | ``meta-mylayer`` in the ``poky`` directory: | 
|  | 393 |  | 
|  | 394 | .. code-block:: shell | 
|  | 395 |  | 
| Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 396 | $ cd poky | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 397 | $ bitbake-layers create-layer meta-mylayer | 
|  | 398 | NOTE: Starting bitbake server... | 
|  | 399 | Add your new layer with 'bitbake-layers add-layer meta-mylayer' | 
|  | 400 |  | 
|  | 401 | For more information | 
|  | 402 | on layers and how to create them, see the | 
| Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 403 | :ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script` | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 404 | section in the Yocto Project Development Tasks Manual. | 
|  | 405 |  | 
|  | 406 | Where To Go Next | 
|  | 407 | ================ | 
|  | 408 |  | 
|  | 409 | Now that you have experienced using the Yocto Project, you might be | 
|  | 410 | asking yourself "What now?". The Yocto Project has many sources of | 
|  | 411 | information including the website, wiki pages, and user manuals: | 
|  | 412 |  | 
|  | 413 | -  **Website:** The :yocto_home:`Yocto Project Website <>` provides | 
|  | 414 | background information, the latest builds, breaking news, full | 
|  | 415 | development documentation, and access to a rich Yocto Project | 
|  | 416 | Development Community into which you can tap. | 
|  | 417 |  | 
| Andrew Geissler | d583833 | 2022-05-27 11:33:10 -0500 | [diff] [blame] | 418 | -  **Video Seminar:** The `Introduction to the Yocto Project and BitBake, Part 1 | 
| Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 419 | <https://youtu.be/yuE7my3KOpo>`__ and | 
| Andrew Geissler | d583833 | 2022-05-27 11:33:10 -0500 | [diff] [blame] | 420 | `Introduction to the Yocto Project and BitBake, Part 2 | 
| Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 421 | <https://youtu.be/iZ05TTyzGHk>`__ videos offer a video seminar | 
|  | 422 | introducing you to the most important aspects of developing a | 
|  | 423 | custom embedded Linux distribution with the Yocto Project. | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 424 |  | 
|  | 425 | -  **Yocto Project Overview and Concepts Manual:** The | 
| Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 426 | :doc:`/overview-manual/index` is a great | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 427 | place to start to learn about the Yocto Project. This manual | 
|  | 428 | introduces you to the Yocto Project and its development environment. | 
|  | 429 | The manual also provides conceptual information for various aspects | 
|  | 430 | of the Yocto Project. | 
|  | 431 |  | 
|  | 432 | -  **Yocto Project Wiki:** The :yocto_wiki:`Yocto Project Wiki <>` | 
|  | 433 | provides additional information on where to go next when ramping up | 
|  | 434 | with the Yocto Project, release information, project planning, and QA | 
|  | 435 | information. | 
|  | 436 |  | 
|  | 437 | -  **Yocto Project Mailing Lists:** Related mailing lists provide a forum | 
| William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 438 | for discussion, patch submission and announcements. There are several | 
|  | 439 | mailing lists grouped by topic. See the | 
| Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 440 | :ref:`ref-manual/resources:mailing lists` | 
|  | 441 | section in the Yocto Project Reference Manual for a complete list of | 
|  | 442 | Yocto Project mailing lists. | 
|  | 443 |  | 
|  | 444 | -  **Comprehensive List of Links and Other Documentation:** The | 
|  | 445 | :ref:`ref-manual/resources:links and related documentation` | 
|  | 446 | section in the Yocto Project Reference Manual provides a | 
|  | 447 | comprehensive list of all related links and other user documentation. | 
|  | 448 |  | 
|  | 449 | .. include:: /boilerplate.rst |