summaryrefslogtreecommitdiffstats
path: root/documentation/brief-yoctoprojectqs/index.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/brief-yoctoprojectqs/index.rst')
-rw-r--r--documentation/brief-yoctoprojectqs/index.rst456
1 files changed, 0 insertions, 456 deletions
diff --git a/documentation/brief-yoctoprojectqs/index.rst b/documentation/brief-yoctoprojectqs/index.rst
deleted file mode 100644
index 4a6f13d7ea..0000000000
--- a/documentation/brief-yoctoprojectqs/index.rst
+++ /dev/null
@@ -1,456 +0,0 @@
1.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2
3=========================
4Yocto Project Quick Build
5=========================
6
7Welcome!
8========
9
10This short document steps you through the process for a typical
11image build using the Yocto Project. The document also introduces how to
12configure a build for specific hardware. You will use Yocto Project to
13build 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
23 :ref:`dev-manual/start:setting up to use cross platforms (crops)`
24 section
25 in the Yocto Project Development Tasks Manual for more
26 information.
27
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.
33
34If you want more conceptual or background information on the Yocto
35Project, see the :doc:`/overview-manual/index`.
36
37Compatible Linux Distribution
38=============================
39
40Make sure your :term:`Build Host` meets the
41following requirements:
42
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 build host with as
48 much RAM and as many CPU cores as possible is strongly recommended to
49 maximize build performance.
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
54 :ref:`ref-manual/system-requirements:supported linux distributions`
55 section in the Yocto Project Reference Manual. For detailed
56 information on preparing your build host, see the
57 :ref:`dev-manual/start:preparing the build host`
58 section in the Yocto Project Development Tasks Manual.
59
60- Ensure that the following utilities have these minimum version numbers:
61
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.
66 - GNU make &MIN_MAKE_VERSION; or greater
67
68If your build host does not satisfy all of the above version
69requirements, you can take steps to prepare the system so that you
70can still use the Yocto Project. See the
71:ref:`ref-manual/system-requirements:required git, tar, python, make and gcc versions`
72section in the Yocto Project Reference Manual for information.
73
74Build Host Packages
75===================
76
77You must install essential host packages on your build host. The
78following command installs the host packages based on an Ubuntu
79distribution:
80
81.. literalinclude:: ../tools/host_packages_scripts/ubuntu_essential.sh
82 :language: shell
83
84.. note::
85
86 For host package requirements on all supported Linux distributions,
87 see the :ref:`ref-manual/system-requirements:required packages for the build host`
88 section in the Yocto Project Reference Manual.
89
90Use Git to Clone Poky
91=====================
92
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
95commands to clone the Poky repository.
96
97.. code-block:: shell
98
99 $ git clone git://git.yoctoproject.org/poky
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
108Go to :yocto_wiki:`Releases wiki page </Releases>`, and choose a release
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
114.. code-block:: shell
115
116 $ cd poky
117 $ git branch -a
118 .
119 .
120 .
121 remotes/origin/HEAD -> origin/master
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
142.. code-block:: shell
143
144 $ git checkout -t origin/&DISTRO_NAME_NO_CAP; -b my-&DISTRO_NAME_NO_CAP;
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
148The previous Git checkout command creates a local branch named
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
153Note that you can regularly type the following command in the same directory
154to keep your local files in sync with the release branch:
155
156.. code-block:: shell
157
158 $ git pull
159
160For more options and information about accessing Yocto Project related
161repositories, see the
162:ref:`dev-manual/start:locating yocto project source files`
163section in the Yocto Project Development Tasks Manual.
164
165Building Your Image
166===================
167
168Use the following steps to build your image. The build process creates
169an entire Linux distribution, including the toolchain, from source.
170
171.. note::
172
173 - If you are working behind a firewall and your build host is not
174 set up for proxies, you could encounter problems with the build
175 process when fetching source code (e.g. fetcher failures or Git
176 failures).
177
178 - If you do not know your proxy settings, consult your local network
179 infrastructure resources and get that information. A good starting
180 point could also be to check your web browser settings. Finally,
181 you can find more information on the
182 ":yocto_wiki:`Working Behind a Network Proxy </Working_Behind_a_Network_Proxy>`"
183 page of the Yocto Project Wiki.
184
185#. **Initialize the Build Environment:** From within the ``poky``
186 directory, run the :ref:`ref-manual/structure:``oe-init-build-env```
187 environment
188 setup script to define Yocto Project's build environment on your
189 build host.
190
191 .. code-block:: shell
192
193 $ cd poky
194 $ source oe-init-build-env
195 You had no conf/local.conf file. This configuration file has therefore been
196 created for you with some default values. You may wish to edit it to, for
197 example, select a different MACHINE (target hardware). See conf/local.conf
198 for more information as common configuration options are commented.
199
200 You had no conf/bblayers.conf file. This configuration file has therefore
201 been created for you with some default values. To add additional metadata
202 layers into your configuration please add entries to conf/bblayers.conf.
203
204 The Yocto Project has extensive documentation about OE including a reference
205 manual which can be found at:
206 https://docs.yoctoproject.org
207
208 For more information about OpenEmbedded see their website:
209 https://www.openembedded.org/
210
211 ### Shell environment set up for builds. ###
212
213 You can now run 'bitbake <target>'
214
215 Common targets are:
216 core-image-minimal
217 core-image-full-cmdline
218 core-image-sato
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
266#. **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:
268
269 .. code-block:: shell
270
271 $ bitbake core-image-sato
272
273 For information on using the ``bitbake`` command, see the
274 :ref:`overview-manual/concepts:bitbake` section in the Yocto Project Overview and
275 Concepts Manual, or see
276 :ref:`bitbake-user-manual/bitbake-user-manual-intro:the bitbake command`
277 in the BitBake User Manual.
278
279#. **Simulate Your Image Using QEMU:** Once this particular image is
280 built, you can start QEMU, which is a Quick EMUlator that ships with
281 the Yocto Project:
282
283 .. code-block:: shell
284
285 $ runqemu qemux86-64
286
287 If you want to learn more about running QEMU, see the
288 :ref:`dev-manual/qemu:using the quick emulator (qemu)` chapter in
289 the Yocto Project Development Tasks Manual.
290
291#. **Exit QEMU:** Exit QEMU by either clicking on the shutdown icon or by typing
292 ``Ctrl-C`` in the QEMU transcript window from which you evoked QEMU.
293
294Customizing Your Build for Specific Hardware
295============================================
296
297So far, all you have done is quickly built an image suitable for
298emulation only. This section shows you how to customize your build for
299specific hardware by adding a hardware layer into the Yocto Project
300development environment.
301
302In general, layers are repositories that contain related sets of
303instructions and configurations that tell the Yocto Project what to do.
304Isolating related metadata into functionally specific layers facilitates
305modular development and makes it easier to reuse the layer metadata.
306
307.. note::
308
309 By convention, layer names start with the string "meta-".
310
311Follow these steps to add a hardware layer:
312
313#. **Find a Layer:** Many hardware layers are available. The Yocto Project
314 :yocto_git:`Source Repositories <>` has many hardware layers.
315 This example adds the
316 `meta-altera <https://github.com/kraj/meta-altera>`__ hardware layer.
317
318#. **Clone the Layer:** Use Git to make a local copy of the layer on your
319 machine. You can put the copy in the top level of the copy of the
320 Poky repository created earlier:
321
322 .. code-block:: shell
323
324 $ cd poky
325 $ git clone https://github.com/kraj/meta-altera.git
326 Cloning into 'meta-altera'...
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
334 The hardware layer is now available
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
339 .. note::
340
341 It is recommended for layers to have a branch per Yocto Project release.
342 Please make sure to checkout the layer branch supporting the Yocto Project
343 release you're using.
344
345#. **Change the Configuration to Build for a Specific Machine:** The
346 :term:`MACHINE` variable in the
347 ``local.conf`` file specifies the machine for the build. For this
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
352 .. note::
353
354 See the "Examine Your Local Configuration File" step earlier for more
355 information on configuring the build.
356
357#. **Add Your Layer to the Layer Configuration File:** Before you can use
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
361 Use the ``bitbake-layers add-layer`` command to add the layer to the
362 configuration file:
363
364 .. code-block:: shell
365
366 $ cd poky/build
367 $ bitbake-layers add-layer ../meta-altera
368 NOTE: Starting bitbake server...
369 Parsing recipes: 100% |##################################################################| Time: 0:00:32
370 Parsing of 918 .bb files complete (0 cached, 918 parsed). 1401 targets,
371 123 skipped, 0 masked, 0 errors.
372
373 You can find
374 more information on adding layers in the
375 :ref:`dev-manual/layers:adding a layer using the \`\`bitbake-layers\`\` script`
376 section.
377
378Completing these steps has added the ``meta-altera`` layer to your Yocto
379Project development environment and configured it to build for the
380``cyclone5`` machine.
381
382.. note::
383
384 The previous steps are for demonstration purposes only. If you were
385 to attempt to build an image for the ``cyclone5`` machine, you should
386 read the Altera ``README``.
387
388Creating Your Own General Layer
389===============================
390
391Maybe you have an application or specific set of behaviors you need to
392isolate. You can create your own general layer using the
393``bitbake-layers create-layer`` command. The tool automates layer
394creation by setting up a subdirectory with a ``layer.conf``
395configuration file, a ``recipes-example`` subdirectory that contains an
396``example.bb`` recipe, a licensing file, and a ``README``.
397
398The following commands run the tool to create a layer named
399``meta-mylayer`` in the ``poky`` directory:
400
401.. code-block:: shell
402
403 $ cd poky
404 $ bitbake-layers create-layer meta-mylayer
405 NOTE: Starting bitbake server...
406 Add your new layer with 'bitbake-layers add-layer meta-mylayer'
407
408For more information
409on layers and how to create them, see the
410:ref:`dev-manual/layers:creating a general layer using the \`\`bitbake-layers\`\` script`
411section in the Yocto Project Development Tasks Manual.
412
413Where To Go Next
414================
415
416Now that you have experienced using the Yocto Project, you might be
417asking yourself "What now?". The Yocto Project has many sources of
418information including the website, wiki pages, and user manuals:
419
420- **Website:** The :yocto_home:`Yocto Project Website <>` provides
421 background information, the latest builds, breaking news, full
422 development documentation, and access to a rich Yocto Project
423 Development Community into which you can tap.
424
425- **Video Seminar:** The `Introduction to the Yocto Project and BitBake, Part 1
426 <https://youtu.be/yuE7my3KOpo>`__ and
427 `Introduction to the Yocto Project and BitBake, Part 2
428 <https://youtu.be/iZ05TTyzGHk>`__ videos offer a video seminar
429 introducing you to the most important aspects of developing a
430 custom embedded Linux distribution with the Yocto Project.
431
432- **Yocto Project Overview and Concepts Manual:** The
433 :doc:`/overview-manual/index` is a great
434 place to start to learn about the Yocto Project. This manual
435 introduces you to the Yocto Project and its development environment.
436 The manual also provides conceptual information for various aspects
437 of the Yocto Project.
438
439- **Yocto Project Wiki:** The :yocto_wiki:`Yocto Project Wiki <>`
440 provides additional information on where to go next when ramping up
441 with the Yocto Project, release information, project planning, and QA
442 information.
443
444- **Yocto Project Mailing Lists:** Related mailing lists provide a forum
445 for discussion, patch submission and announcements. There are several
446 mailing lists grouped by topic. See the
447 :ref:`ref-manual/resources:mailing lists`
448 section in the Yocto Project Reference Manual for a complete list of
449 Yocto Project mailing lists.
450
451- **Comprehensive List of Links and Other Documentation:** The
452 :ref:`ref-manual/resources:links and related documentation`
453 section in the Yocto Project Reference Manual provides a
454 comprehensive list of all related links and other user documentation.
455
456.. include:: /boilerplate.rst