summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--documentation/brief-yoctoprojectqs/index.rst413
-rw-r--r--documentation/ref-manual/structure.rst5
2 files changed, 224 insertions, 194 deletions
diff --git a/documentation/brief-yoctoprojectqs/index.rst b/documentation/brief-yoctoprojectqs/index.rst
index 4a6f13d7ea..f110a106b7 100644
--- a/documentation/brief-yoctoprojectqs/index.rst
+++ b/documentation/brief-yoctoprojectqs/index.rst
@@ -87,80 +87,123 @@ distribution:
87 see the :ref:`ref-manual/system-requirements:required packages for the build host` 87 see the :ref:`ref-manual/system-requirements:required packages for the build host`
88 section in the Yocto Project Reference Manual. 88 section in the Yocto Project Reference Manual.
89 89
90Use Git to Clone Poky 90Use Git to Clone bitbake-setup
91===================== 91==============================
92 92
93Once you complete the setup instructions for your machine, you need to 93Once you complete the setup instructions for your machine, you need to
94get a copy of the Poky repository on your build host. Use the following 94get a copy of the ``bitbake-setup`` tool to setup the :term:`Poky` reference
95commands to clone the Poky repository. 95distribution on your build host. Use the following commands to clone
96the bitbake repository.
96 97
97.. code-block:: shell 98.. code-block:: shell
98 99
99 $ git clone git://git.yoctoproject.org/poky 100 $ git clone -b &DISTRO_REL_LATEST_TAG; git://git.openembedded.org/bitbake bitbake-setup
100 Cloning into 'poky'...
101 remote: Counting
102 objects: 432160, done. remote: Compressing objects: 100%
103 (102056/102056), done. remote: Total 432160 (delta 323116), reused
104 432037 (delta 323000) Receiving objects: 100% (432160/432160), 153.81 MiB | 8.54 MiB/s, done.
105 Resolving deltas: 100% (323116/323116), done.
106 Checking connectivity... done.
107 101
108Go to :yocto_wiki:`Releases wiki page </Releases>`, and choose a release 102Setup a build environment with the following command:
109codename (such as ``&DISTRO_NAME_NO_CAP;``), corresponding to either the
110latest stable release or a Long Term Support release.
111
112Then move to the ``poky`` directory and take a look at existing branches:
113 103
114.. code-block:: shell 104.. code-block:: shell
115 105
116 $ cd poky 106 $ ./bitbake-setup/bin/bitbake-setup init
117 $ git branch -a 107
118 . 108By default, this will setup a top directory in ``$HOME/bitbake-builds``.
119 . 109
120 . 110If you prefer to setup your builds in a different top directory, for example the
121 remotes/origin/HEAD -> origin/master 111current directory, you can set it with the :ref:`bitbake:ref-bbsetup-command-settings` command:
122 remotes/origin/dunfell
123 remotes/origin/dunfell-next
124 .
125 .
126 .
127 remotes/origin/gatesgarth
128 remotes/origin/gatesgarth-next
129 .
130 .
131 .
132 remotes/origin/master
133 remotes/origin/master-next
134 .
135 .
136 .
137
138
139For this example, check out the ``&DISTRO_NAME_NO_CAP;`` branch based on the
140``&DISTRO_NAME;`` release:
141 112
142.. code-block:: shell 113.. code-block:: shell
143 114
144 $ git checkout -t origin/&DISTRO_NAME_NO_CAP; -b my-&DISTRO_NAME_NO_CAP; 115 $ ./bitbake-setup/bin/bitbake-setup settings set --global default top-dir-prefix $PWD
145 Branch 'my-&DISTRO_NAME_NO_CAP;' set up to track remote branch '&DISTRO_NAME_NO_CAP;' from 'origin'.
146 Switched to a new branch 'my-&DISTRO_NAME_NO_CAP;'
147 116
148The previous Git checkout command creates a local branch named 117.. note::
149``my-&DISTRO_NAME_NO_CAP;``. The files available to you in that branch
150exactly match the repository's files in the ``&DISTRO_NAME_NO_CAP;``
151release branch.
152 118
153Note that you can regularly type the following command in the same directory 119 Use :ref:`bitbake:ref-bbsetup-command-list` to get an overview of the settings.
154to keep your local files in sync with the release branch:
155 120
156.. code-block:: shell 121:ref:`bitbake:ref-bbsetup-command-init` is an interactive program by default and
122will ask you to make some decisions. Depending on your answers, the output may
123differ from the examples below.
157 124
158 $ git pull 125#. Choose a configuration (for example, ``poky-master``):
159 126
160For more options and information about accessing Yocto Project related 127 .. code-block:: shell
161repositories, see the 128
162:ref:`dev-manual/start:locating yocto project source files` 129 Available configurations:
163section in the Yocto Project Development Tasks Manual. 130 0. poky-master Poky - The Yocto Project testing distribution configurations and hardware test platforms
131 1. oe-nodistro OpenEmbedded - 'nodistro' basic configuration
132
133 Please select one of the above configurations by its number:
134 0
135
136 Depending on the choice above, new options can be prompted to further specify
137 which configuration to use. For example:
138
139 .. code-block:: shell
140
141 Available bitbake configurations:
142 0. poky Poky - The Yocto Project testing distribution
143 1. poky-with-sstate Poky - The Yocto Project testing distribution with internet sstate acceleration. Use with caution as it requires a completely robust local network with sufficient bandwidth.
144
145 Please select one of the above bitbake configurations by its number:
146 0
147
148#. Choose a target :term:`MACHINE` (for example, ``qemux86-64``):
149
150 .. code-block:: shell
151
152 Target machines:
153 0. machine/qemux86-64
154 1. machine/qemuarm64
155 2. machine/qemuriscv64
156 3. machine/genericarm64
157 4. machine/genericx86-64
158
159 Please select one of the above options by its number:
160 0
161
162#. Choose a :term:`DISTRO` (for example, ``poky``):
163
164 .. code-block:: shell
165
166 Distribution configuration variants:
167 0. distro/poky
168 1. distro/poky-altcfg
169 2. distro/poky-tiny
170
171 Please select one of the above options by its number:
172 0
173
174.. note::
175
176 If you prefer to run non-interactively, you can run a command like the
177 following:
178
179 .. code-block:: shell
180
181 $ bitbake-setup init --non-interactive poky-master poky-with-sstate distro/poky machine/qemux86-64
182
183The ``init`` command creates a new :term:`bitbake:Setup` in the
184:term:`bitbake:top directory`. Its name is derived from the selected
185configuration above.
186
187For the selected options in the above example, this would be::
188
189 poky-master-poky-distro_poky-machine_qemux86-64
190
191This will be our example configuration in the following sections.
192
193This directory contains:
194
195- The :term:`bitbake:BitBake Build` directory, named ``build``. Later, when the
196 build completes, this directory contains all the files created during the
197 build.
198
199 This directory also contains a ``README``, describing the current
200 configuration and showing some instructions.
201
202- The :term:`layers <Layer>` needed to build the Poky reference distribution,
203 in the ``layers`` directory.
204
205- A ``config`` directory, representing the current configuration used for this
206 :term:`bitbake:setup`.
164 207
165Building Your Image 208Building Your Image
166=================== 209===================
@@ -182,86 +225,74 @@ an entire Linux distribution, including the toolchain, from source.
182 ":yocto_wiki:`Working Behind a Network Proxy </Working_Behind_a_Network_Proxy>`" 225 ":yocto_wiki:`Working Behind a Network Proxy </Working_Behind_a_Network_Proxy>`"
183 page of the Yocto Project Wiki. 226 page of the Yocto Project Wiki.
184 227
185#. **Initialize the Build Environment:** From within the ``poky`` 228#. **Initialize the Build Environment:** Source the ``init-build-env``
186 directory, run the :ref:`ref-manual/structure:``oe-init-build-env``` 229 environment setup script within the :term:`bitbake:BitBake build` directory
187 environment 230 to setup the :term:`BitBake` build environment on your host:
188 setup script to define Yocto Project's build environment on your
189 build host.
190 231
191 .. code-block:: shell 232 .. code-block:: shell
233
234 $ source poky-master-poky-distro_poky-machine_qemux86-64/build/init-build-env
235 Poky reference distro build
236
237#. **Examine Your Current Configuration:** When you set up the build
238 environment, an configuration file named :ref:`toolcfg.conf
239 <structure-build-conf-toolcfg.conf>` becomes available in a ``conf/``
240 sub-directory of the :term:`bitbake:BitBake build` directory. This file is
241 automatically modified by the ``bitbake-config-build`` command-line tool.
242 With this tool, list the currently enabled :term:`configuration fragments
243 <Configuration Fragment>`:
244
245 .. code-block:: shell
246
247 $ bitbake-config-build list-fragments
248
249 For this configuration, the default is to use two :term:`Built-in Fragments
250 <Built-in Fragment>`:
251
252 - ``distro/poky`` sets the :term:`DISTRO` to :term:`Poky`
253 (:ref:`ref-fragments-builtin-core-distro` fragment).
254 - ``machine/qemux86-64`` sets the :term:`MACHINE` to ``qemux86-64``
255 (:ref:`ref-fragments-builtin-core-machine` fragment).
256
257 These fragment values correspond to the choices made when running
258 :ref:`bitbake:ref-bbsetup-command-init`.
259
260 .. note::
261
262 These set up the environment similar to what was previously in the local
263 configuration file :ref:`local.conf <structure-build-conf-local.conf>`,
264 which is now largely empty.
265
266 The current configuration does not allow the ``root`` user to login. As this
267 can be useful for development, you can enable the
268 :ref:`ref-fragments-root-login-with-empty-password` fragment:
192 269
193 $ cd poky 270 .. code-block:: shell
194 $ source oe-init-build-env 271
195 You had no conf/local.conf file. This configuration file has therefore been 272 $ bitbake-config-build enable-fragment root-login-with-empty-password
196 created for you with some default values. You may wish to edit it to, for 273
197 example, select a different MACHINE (target hardware). See conf/local.conf 274 .. note::
198 for more information as common configuration options are commented. 275
199 276 You can significantly speed up your build and guard against fetcher
200 You had no conf/bblayers.conf file. This configuration file has therefore 277 failures by using :ref:`overview-manual/concepts:shared state cache`
201 been created for you with some default values. To add additional metadata 278 mirrors and enabling :ref:`overview-manual/concepts:hash equivalence`.
202 layers into your configuration please add entries to conf/bblayers.conf. 279 This way, you can use pre-built artifacts rather than building them.
203 280 This is relevant only when your network and the server that you use
204 The Yocto Project has extensive documentation about OE including a reference 281 can download these artifacts faster than you would be able to build them.
205 manual which can be found at: 282
206 https://docs.yoctoproject.org 283 To use such mirrors, enable the
207 284 :ref:`ref-fragments-core-yocto-sstate-mirror-cdn` fragment::
208 For more information about OpenEmbedded see their website: 285
209 https://www.openembedded.org/ 286 $ bitbake-config-build enable-fragment core/yocto/sstate-mirror-cdn
210 287
211 ### Shell environment set up for builds. ### 288 The hash equivalence server needs the websockets python module version 9.1
212 289 or later. Debian GNU/Linux 12 (Bookworm) and later, Fedora, CentOS Stream
213 You can now run 'bitbake <target>' 290 9 and later, and Ubuntu 22.04 (LTS) and later, all have a recent enough
214 291 package. Other supported distributions need to get the module some other
215 Common targets are: 292 place than their package feed, e.g. via ``pip``. You can otherwise
216 core-image-minimal 293 install a :term:`Buildtools` tarball by following the instructions in
217 core-image-full-cmdline 294 the :ref:`system-requirements-buildtools` section of the Yocto Project
218 core-image-sato 295 Reference Manual.
219 core-image-weston
220 meta-toolchain
221 meta-ide-support
222
223 You can also run generated QEMU images with a command like 'runqemu qemux86-64'
224
225 Other commonly useful commands are:
226 - 'devtool' and 'recipetool' handle common recipe tasks
227 - 'bitbake-layers' handles common layer tasks
228 - 'oe-pkgdata-util' handles common target package tasks
229
230 Among other things, the script creates the :term:`Build Directory`, which is
231 ``build`` in this case and is located in the :term:`Source Directory`. After
232 the script runs, your current working directory is set to the
233 :term:`Build Directory`. Later, when the build completes, the
234 :term:`Build Directory` contains all the files created during the build.
235
236#. **Examine Your Local Configuration File:** When you set up the build
237 environment, a local configuration file named ``local.conf`` becomes
238 available in a ``conf`` subdirectory of the :term:`Build Directory`. For this
239 example, the defaults are set to build for a ``qemux86`` target,
240 which is suitable for emulation. The package manager used is set to
241 the RPM package manager.
242
243 .. tip::
244
245 You can significantly speed up your build and guard against fetcher
246 failures by using :ref:`overview-manual/concepts:shared state cache`
247 mirrors and enabling :ref:`overview-manual/concepts:hash equivalence`.
248 This way, you can use pre-built artifacts rather than building them.
249 This is relevant only when your network and the server that you use
250 can download these artifacts faster than you would be able to build them.
251
252 To use such mirrors, uncomment the below lines in your ``conf/local.conf``
253 file in the :term:`Build Directory`::
254
255 BB_HASHSERVE_UPSTREAM = "wss://hashserv.yoctoproject.org/ws"
256 SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH"
257 BB_HASHSERVE = "auto"
258 BB_SIGNATURE_HANDLER = "OEEquivHash"
259
260 The hash equivalence server needs the websockets python module version 9.1
261 or later. Debian GNU/Linux 12 (Bookworm) and later, Fedora, CentOS Stream
262 9 and later, and Ubuntu 22.04 (LTS) and later, all have a recent enough
263 package. Other supported distributions need to get the module some other
264 place than their package feed, e.g. via ``pip``.
265 296
266#. **Start the Build:** Continue with the following command to build an OS 297#. **Start the Build:** Continue with the following command to build an OS
267 image for the target, which is ``core-image-sato`` in this example: 298 image for the target, which is ``core-image-sato`` in this example:
@@ -308,82 +339,73 @@ modular development and makes it easier to reuse the layer metadata.
308 339
309 By convention, layer names start with the string "meta-". 340 By convention, layer names start with the string "meta-".
310 341
311Follow these steps to add a hardware layer: 342Follow these steps to add a :ref:`BSP layer <overview-manual/concepts:bsp
343layer>`:
312 344
313#. **Find a Layer:** Many hardware layers are available. The Yocto Project 345#. **Find a Layer:** Many BSP layers are available. The
314 :yocto_git:`Source Repositories <>` has many hardware layers. 346 :oe_layerindex:`layer index <>` can be used to find such layers. This example
315 This example adds the 347 adds the :yocto_git:`meta-raspberrypi </meta-raspberrypi>` BSP
316 `meta-altera <https://github.com/kraj/meta-altera>`__ hardware layer. 348 layer.
317 349
318#. **Clone the Layer:** Use Git to make a local copy of the layer on your 350 First, clone the layer next the other layers::
319 machine. You can put the copy in the top level of the copy of the
320 Poky repository created earlier:
321 351
322 .. code-block:: shell 352 git clone -b &DISTRO_NAME_NO_CAP; https://git.yoctoproject.org/meta-raspberrypi ../layers/meta-raspberrypi
323 353
324 $ cd poky 354#. **Add Your Layer to the Layer Configuration File:** Before you can use
325 $ git clone https://github.com/kraj/meta-altera.git 355 it, you must add the layer and its dependencies it to your ``bblayers.conf``
326 Cloning into 'meta-altera'... 356 file, which is found in the :term:`Build Directory` (``conf/``) directory.
327 remote: Counting objects: 25170, done.
328 remote: Compressing objects: 100% (350/350), done.
329 remote: Total 25170 (delta 645), reused 719 (delta 538), pack-reused 24219
330 Receiving objects: 100% (25170/25170), 41.02 MiB | 1.64 MiB/s, done.
331 Resolving deltas: 100% (13385/13385), done.
332 Checking connectivity... done.
333 357
334 The hardware layer is now available 358 For this, the ``bitbake-layers add-layer`` can be used:
335 next to other layers inside the Poky reference repository on your build
336 host as ``meta-altera`` and contains all the metadata needed to
337 support hardware from Altera, which is owned by Intel.
338 359
339 .. note:: 360 .. code-block:: shell
340 361
341 It is recommended for layers to have a branch per Yocto Project release. 362 $ bitbake-layers add-layer ../layers/meta-raspberrypi
342 Please make sure to checkout the layer branch supporting the Yocto Project
343 release you're using.
344 363
345#. **Change the Configuration to Build for a Specific Machine:** The 364 You can find more information on adding layers in the
346 :term:`MACHINE` variable in the 365 :ref:`dev-manual/layers:adding a layer using the \`\`bitbake-layers\`\`
347 ``local.conf`` file specifies the machine for the build. For this 366 script` section.
348 example, set the :term:`MACHINE` variable to ``cyclone5``. These
349 configurations are used:
350 https://github.com/kraj/meta-altera/blob/master/conf/machine/cyclone5.conf.
351 367
352 .. note:: 368#. **Change the Configuration to Build for a Specific Machine:** The
369 :term:`MACHINE` variable is defined by the :ref:`ref-fragments-builtin-core-machine`
370 fragment. For this example, the meta-raspberrypi layer provides the
371 :yocto_git:`raspberrypi5 </meta-yocto/tree/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf>`
372 machine, so let's make it the :term:`MACHINE` used for the build with
373 ``bitbake-config-build``:
353 374
354 See the "Examine Your Local Configuration File" step earlier for more 375 .. code-block:: shell
355 information on configuring the build.
356 376
357#. **Add Your Layer to the Layer Configuration File:** Before you can use 377 $ bitbake-config-build enable-fragment machine/raspberrypi5
358 a layer during a build, you must add it to your ``bblayers.conf``
359 file, which is found in the :term:`Build Directory` ``conf`` directory.
360 378
361 Use the ``bitbake-layers add-layer`` command to add the layer to the 379 .. note::
362 configuration file:
363 380
364 .. code-block:: shell 381 See the "Examine Your Current Configuration" step earlier for more
382 information on configuring the build.
365 383
366 $ cd poky/build 384 The ``raspberrypi5`` build depends on non-free firmware
367 $ bitbake-layers add-layer ../meta-altera 385 (https://github.com/RPi-Distro/firmware-nonfree) that includes the
368 NOTE: Starting bitbake server... 386 `Synaptics` license. See the :yocto_git:`ipcompliance.md
369 Parsing recipes: 100% |##################################################################| Time: 0:00:32 387 </meta-raspberrypi/tree/docs/ipcompliance.md>` document for more information.
370 Parsing of 918 .bb files complete (0 cached, 918 parsed). 1401 targets, 388 Add the ``synaptics-killswitch`` value to the :term:`LICENSE_FLAGS_ACCEPTED`
371 123 skipped, 0 masked, 0 errors. 389 variable, in the ``conf/local.conf`` file of your build directory::
372 390
373 You can find 391 LICENSE_FLAGS_ACCEPTED = "synaptics-killswitch"
374 more information on adding layers in the
375 :ref:`dev-manual/layers:adding a layer using the \`\`bitbake-layers\`\` script`
376 section.
377 392
378Completing these steps has added the ``meta-altera`` layer to your Yocto 393#. **Start The Build:** The configuration is now set to build for the Raspberry
394 Pi 5. Start the build again:
395
396 .. code-block:: shell
397
398 $ bitbake core-image-sato
399
400Completing these steps has added the ``meta-raspberrypi`` layer to your Yocto
379Project development environment and configured it to build for the 401Project development environment and configured it to build for the
380``cyclone5`` machine. 402``raspberrypi5`` machine.
381 403
382.. note:: 404.. note::
383 405
384 The previous steps are for demonstration purposes only. If you were 406 The previous steps are for demonstration purposes only. If you were
385 to attempt to build an image for the ``cyclone5`` machine, you should 407 to attempt to build an image for the ``raspberrypi5`` machine, you
386 read the Altera ``README``. 408 should read the ``README.md`` file in ``meta-raspberrypi``.
387 409
388Creating Your Own General Layer 410Creating Your Own General Layer
389=============================== 411===============================
@@ -396,14 +418,17 @@ configuration file, a ``recipes-example`` subdirectory that contains an
396``example.bb`` recipe, a licensing file, and a ``README``. 418``example.bb`` recipe, a licensing file, and a ``README``.
397 419
398The following commands run the tool to create a layer named 420The following commands run the tool to create a layer named
399``meta-mylayer`` in the ``poky`` directory: 421``meta-mylayer``:
400 422
401.. code-block:: shell 423.. code-block:: shell
402 424
403 $ cd poky 425 $ bitbake-layers create-layer ../layers/meta-mylayer
404 $ bitbake-layers create-layer meta-mylayer
405 NOTE: Starting bitbake server... 426 NOTE: Starting bitbake server...
406 Add your new layer with 'bitbake-layers add-layer meta-mylayer' 427 Add your new layer with 'bitbake-layers add-layer ../layers/meta-mylayer'
428
429.. note::
430
431 By convention, layers are placed side-by-side.
407 432
408For more information 433For more information
409on layers and how to create them, see the 434on layers and how to create them, see the
diff --git a/documentation/ref-manual/structure.rst b/documentation/ref-manual/structure.rst
index f0205f0e5c..c0eae9b7b0 100644
--- a/documentation/ref-manual/structure.rst
+++ b/documentation/ref-manual/structure.rst
@@ -372,6 +372,11 @@ symbolic link to a common ``site.conf`` file::
372This way, site-specific settings can be shared for multiple build 372This way, site-specific settings can be shared for multiple build
373configurations. 373configurations.
374 374
375.. note::
376
377 For more information on how to use ``bitbake-setup``, see the
378 :doc:`/brief-yoctoprojectqs/index` document.
379
375.. _structure-build-conf-bblock.conf: 380.. _structure-build-conf-bblock.conf:
376 381
377``build/conf/bblock.conf`` 382``build/conf/bblock.conf``