Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
| 2 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" |
| 3 | [<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] > |
| 4 | |
| 5 | <article id='yocto-project-qs-intro'> |
| 6 | <articleinfo> |
| 7 | <title>Yocto Project Quick Start</title> |
| 8 | |
| 9 | <copyright> |
| 10 | <year>©RIGHT_YEAR;</year> |
| 11 | <holder>Linux Foundation</holder> |
| 12 | </copyright> |
| 13 | |
| 14 | <legalnotice> |
| 15 | <para> |
| 16 | Permission is granted to copy, distribute and/or modify this document under |
| 17 | the terms of the <ulink type="http" url="http://creativecommons.org/licenses/by-sa/2.0/uk/">Creative Commons Attribution-Share Alike 2.0 UK: England & Wales</ulink> as published by Creative Commons. |
| 18 | </para> |
| 19 | <note> |
| 20 | For the latest version of this manual associated with this |
| 21 | Yocto Project release, see the |
| 22 | <ulink url='&YOCTO_DOCS_QS_URL;'>Yocto Project Quick Start</ulink> |
| 23 | from the Yocto Project website. |
| 24 | </note> |
| 25 | </legalnotice> |
| 26 | |
| 27 | |
| 28 | <abstract> |
| 29 | <imagedata fileref="figures/yocto-project-transp.png" |
| 30 | width="6in" depth="1in" |
| 31 | align="right" scale="25" /> |
| 32 | </abstract> |
| 33 | </articleinfo> |
| 34 | |
| 35 | <section id='welcome'> |
| 36 | <title>Welcome!</title> |
| 37 | <para> |
| 38 | Welcome to the Yocto Project! |
| 39 | The Yocto Project is an open-source collaboration project whose |
| 40 | focus is developers of embedded Linux systems. |
| 41 | Among other things, the Yocto Project uses a build host based |
| 42 | on the OpenEmbedded (OE) project, which uses the |
| 43 | <ulink url='&YOCTO_DOCS_DEV_URL;#bitbake-term'>BitBake</ulink> |
| 44 | tool, to construct complete Linux images. |
| 45 | The BitBake and OE components are combined together to form |
| 46 | a reference build host, historically known as |
| 47 | <ulink url='&YOCTO_DOCS_DEV_URL;#poky'>Poky</ulink>. |
| 48 | </para> |
| 49 | |
| 50 | <para> |
| 51 | If you do not have a system that runs Linux and you want to give |
| 52 | the Yocto Project a test run, you might consider using the Yocto |
| 53 | Project Build Appliance. |
| 54 | The Build Appliance allows you to build and boot a custom embedded |
| 55 | Linux image with the Yocto Project using a non-Linux development |
| 56 | system. |
| 57 | See the |
| 58 | <ulink url='https://www.yoctoproject.org/tools-resources/projects/build-appliance'>Yocto Project Build Appliance</ulink> |
| 59 | for more information. |
| 60 | </para> |
| 61 | |
| 62 | <para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 63 | This quick start is written so that you can quickly get a |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 64 | build host set up to use the Yocto Project and then build some |
| 65 | Linux images. |
| 66 | Rather than go into great detail about the Yocto Project and its |
| 67 | many capabilities, this quick start provides the minimal |
| 68 | information you need to try out the Yocto Project using a |
| 69 | supported Linux build host. |
| 70 | Reading and using the quick start should result in you having a |
| 71 | basic understanding of what the Yocto Project is and how to use |
| 72 | some of its core components. |
| 73 | You will also have worked through steps to produce two images: |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 74 | one that is suitable for emulation and one that boots on actual |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 75 | hardware. |
| 76 | The examples highlight the ease with which you can use the |
| 77 | Yocto Project to create images for multiple types of hardware. |
| 78 | </para> |
| 79 | |
| 80 | <para> |
| 81 | For more detailed information on the Yocto Project, you can |
| 82 | reference these resources: |
| 83 | <itemizedlist> |
| 84 | <listitem><para><emphasis>Website:</emphasis> |
| 85 | The |
| 86 | <ulink url='&YOCTO_HOME_URL;'>Yocto Project Website</ulink> |
| 87 | provides the latest builds, breaking news, full development |
| 88 | documentation, and access to a rich Yocto Project |
| 89 | Development Community into which you can tap. |
| 90 | </para></listitem> |
| 91 | <listitem><para><emphasis>FAQs:</emphasis> |
| 92 | Lists commonly asked Yocto Project questions and answers. |
| 93 | You can find two FAQs: |
| 94 | <ulink url='&YOCTO_WIKI_URL;/wiki/FAQ'>Yocto Project FAQ</ulink> |
| 95 | on a wiki, and the |
| 96 | "<ulink url='&YOCTO_DOCS_REF_URL;#faq'>FAQ</ulink>" |
| 97 | chapter in the Yocto Project Reference Manual. |
| 98 | </para></listitem> |
| 99 | <listitem><para><emphasis>Developer Screencast:</emphasis> |
| 100 | The |
| 101 | <ulink url='http://vimeo.com/36450321'>Getting Started with the Yocto Project - New Developer Screencast Tutorial</ulink> |
| 102 | provides a 30-minute video created for users unfamiliar |
| 103 | with the Yocto Project but familiar with Linux build |
| 104 | hosts. |
| 105 | While this screencast is somewhat dated, the introductory |
| 106 | and fundamental concepts are useful for the beginner. |
| 107 | </para></listitem> |
| 108 | </itemizedlist> |
| 109 | </para> |
| 110 | </section> |
| 111 | |
| 112 | <section id='yp-intro'> |
| 113 | <title>Introducing the Yocto Project Development Environment</title> |
| 114 | |
| 115 | <para> |
| 116 | The Yocto Project through the OpenEmbedded build system provides an |
| 117 | open source development environment targeting the ARM, MIPS, |
| 118 | PowerPC, and x86 architectures for a variety of platforms |
| 119 | including x86-64 and emulated ones. |
| 120 | You can use components from the Yocto Project to design, develop, |
| 121 | build, debug, simulate, and test the complete software stack using |
| 122 | Linux, the X Window System, GTK+ frameworks, and Qt frameworks. |
| 123 | </para> |
| 124 | |
| 125 | <mediaobject> |
| 126 | <imageobject> |
| 127 | <imagedata fileref="figures/yocto-environment.png" |
| 128 | format="PNG" align='center' scalefit='1' width="100%"/> |
| 129 | </imageobject> |
| 130 | <caption> |
| 131 | <para>The Yocto Project Development Environment</para> |
| 132 | </caption> |
| 133 | </mediaobject> |
| 134 | |
| 135 | <para> |
| 136 | Here are some highlights for the Yocto Project: |
| 137 | </para> |
| 138 | |
| 139 | <itemizedlist> |
| 140 | <listitem><para> |
| 141 | Provides a recent Linux kernel along with a set of system |
| 142 | commands and libraries suitable for the embedded |
| 143 | environment. |
| 144 | </para></listitem> |
| 145 | <listitem><para> |
| 146 | Makes available system components such as X11, GTK+, Qt, |
| 147 | Clutter, and SDL (among others) so you can create a rich user |
| 148 | experience on devices that have display hardware. |
| 149 | For devices that do not have a display or where you wish to |
| 150 | use alternative UI frameworks, these components need not be |
| 151 | installed. |
| 152 | </para></listitem> |
| 153 | <listitem><para> |
| 154 | Creates a focused and stable core compatible with the |
| 155 | OpenEmbedded project with which you can easily and reliably |
| 156 | build and develop. |
| 157 | </para></listitem> |
| 158 | <listitem><para> |
| 159 | Fully supports a wide range of hardware and device emulation |
| 160 | through the Quick EMUlator (QEMU). |
| 161 | </para></listitem> |
| 162 | <listitem><para> |
| 163 | Provides a layer mechanism that allows you to easily extend |
| 164 | the system, make customizations, and keep them organized. |
| 165 | </para></listitem> |
| 166 | </itemizedlist> |
| 167 | |
| 168 | <para> |
| 169 | You can use the Yocto Project to generate images for many kinds |
| 170 | of devices. |
| 171 | As mentioned earlier, the Yocto Project supports creation of |
| 172 | reference images that you can boot within and emulate using QEMU. |
| 173 | The standard example machines target QEMU full-system |
| 174 | emulation for 32-bit and 64-bit variants of x86, ARM, MIPS, and |
| 175 | PowerPC architectures. |
| 176 | Beyond emulation, you can use the layer mechanism to extend |
| 177 | support to just about any platform that Linux can run on and that |
| 178 | a toolchain can target. |
| 179 | </para> |
| 180 | |
| 181 | <para> |
| 182 | Another Yocto Project feature is the Sato reference User |
| 183 | Interface. |
| 184 | This optional UI that is based on GTK+ is intended for devices with |
| 185 | restricted screen sizes and is included as part of the |
| 186 | OpenEmbedded Core layer so that developers can test parts of the |
| 187 | software stack. |
| 188 | </para> |
| 189 | </section> |
| 190 | |
| 191 | <section id='yp-resources'> |
| 192 | <title>Setting Up to Use the Yocto Project</title> |
| 193 | |
| 194 | <para> |
| 195 | The following list shows what you need in order to use a |
| 196 | Linux-based build host to use the Yocto Project to build images: |
| 197 | </para> |
| 198 | |
| 199 | <itemizedlist> |
| 200 | <listitem><para><emphasis>Build Host</emphasis> |
| 201 | A build host with a minimum of 50 Gbytes of free disk |
| 202 | space that is running a supported Linux distribution (i.e. |
| 203 | recent releases of Fedora, openSUSE, CentOS, Debian, or |
| 204 | Ubuntu). |
| 205 | </para></listitem> |
| 206 | <listitem><para><emphasis>Build Host Packages</emphasis> |
| 207 | Appropriate packages installed on the build host. |
| 208 | </para></listitem> |
| 209 | <listitem><para><emphasis>The Yocto Project</emphasis> |
| 210 | A release of the Yocto Project. |
| 211 | </para></listitem> |
| 212 | </itemizedlist> |
| 213 | |
| 214 | <section id='the-linux-distro'> |
| 215 | <title>The Linux Distribution</title> |
| 216 | |
| 217 | <para> |
| 218 | The Yocto Project team verifies each release against recent |
| 219 | versions of the most popular Linux distributions that |
| 220 | provide stable releases. |
| 221 | In general, if you have the current release minus one of the |
| 222 | following distributions, you should have no problems. |
| 223 | <itemizedlist> |
| 224 | <listitem><para> |
| 225 | Ubuntu |
| 226 | </para></listitem> |
| 227 | <listitem><para> |
| 228 | Fedora |
| 229 | </para></listitem> |
| 230 | <listitem><para> |
| 231 | openSUSE |
| 232 | </para></listitem> |
| 233 | <listitem><para> |
| 234 | CentOS |
| 235 | </para></listitem> |
| 236 | <listitem><para> |
| 237 | Debian |
| 238 | </para></listitem> |
| 239 | </itemizedlist> |
| 240 | For a more detailed list of distributions that support the |
| 241 | Yocto Project, see the |
| 242 | "<ulink url='&YOCTO_DOCS_REF_URL;#detailed-supported-distros'>Supported Linux Distributions</ulink>" |
| 243 | section in the Yocto Project Reference Manual. |
| 244 | </para> |
| 245 | |
| 246 | <para> |
| 247 | The OpenEmbedded build system should be able to run on any |
| 248 | modern distribution that has the following versions for |
| 249 | Git, tar, and Python. |
| 250 | <itemizedlist> |
| 251 | <listitem><para> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 252 | Git 1.8.3.1 or greater |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 253 | </para></listitem> |
| 254 | <listitem><para> |
| 255 | tar 1.24 or greater |
| 256 | </para></listitem> |
| 257 | <listitem><para> |
| 258 | Python 2.7.3 or greater excluding Python |
| 259 | 3.x, which is not supported. |
| 260 | </para></listitem> |
| 261 | </itemizedlist> |
| 262 | If your build host does not meet any of these three listed |
| 263 | version requirements, you can take steps to prepare the |
| 264 | system so that you can still use the Yocto Project. |
| 265 | See the |
| 266 | "<ulink url='&YOCTO_DOCS_REF_URL;#required-git-tar-and-python-versions'>Required Git, tar, and Python Versions</ulink>" |
| 267 | section in the Yocto Project Reference Manual for information. |
| 268 | </para> |
| 269 | </section> |
| 270 | |
| 271 | <section id='packages'> |
| 272 | <title>The Build Host Packages</title> |
| 273 | |
| 274 | <para> |
| 275 | Required build host packages vary depending on your |
| 276 | build machine and what you want to do with the Yocto Project. |
| 277 | For example, if you want to build an image that can run |
| 278 | on QEMU in graphical mode (a minimal, basic build |
| 279 | requirement), then the build host package requirements |
| 280 | are different than if you want to build an image on a headless |
| 281 | system or build out the Yocto Project documentation set. |
| 282 | </para> |
| 283 | |
| 284 | <para> |
| 285 | Collectively, the number of required packages is large |
| 286 | if you want to be able to cover all cases. |
| 287 | <note> |
| 288 | In general, you need to have root access and then install |
| 289 | the required packages. |
| 290 | Thus, the commands in the following section may or may |
| 291 | not work depending on whether or not your Linux |
| 292 | distribution has <filename>sudo</filename> installed. |
| 293 | </note> |
| 294 | </para> |
| 295 | |
| 296 | <para> |
| 297 | The following list shows the required packages needed to build |
| 298 | an image that runs on QEMU in graphical mode (e.g. essential |
| 299 | plus graphics support). |
| 300 | For lists of required packages for other scenarios, see the |
| 301 | "<ulink url='&YOCTO_DOCS_REF_URL;#required-packages-for-the-host-development-system'>Required Packages for the Host Development System</ulink>" |
| 302 | section in the Yocto Project Reference Manual. |
| 303 | <itemizedlist> |
| 304 | <listitem><para><emphasis>Ubuntu and Debian</emphasis> |
| 305 | <literallayout class='monospaced'> |
| 306 | $ sudo apt-get install &UBUNTU_HOST_PACKAGES_ESSENTIAL; libsdl1.2-dev xterm |
| 307 | </literallayout> |
| 308 | </para></listitem> |
| 309 | <listitem><para><emphasis>Fedora</emphasis> |
| 310 | <literallayout class='monospaced'> |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 311 | $ sudo dnf install &FEDORA_HOST_PACKAGES_ESSENTIAL; SDL-devel xterm |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 312 | </literallayout> |
| 313 | </para></listitem> |
| 314 | <listitem><para><emphasis>OpenSUSE</emphasis> |
| 315 | <literallayout class='monospaced'> |
| 316 | $ sudo zypper install &OPENSUSE_HOST_PACKAGES_ESSENTIAL; libSDL-devel xterm |
| 317 | </literallayout> |
| 318 | </para></listitem> |
| 319 | <listitem><para><emphasis>CentOS</emphasis> |
| 320 | <literallayout class='monospaced'> |
| 321 | $ sudo yum install &CENTOS_HOST_PACKAGES_ESSENTIAL; SDL-devel xterm |
| 322 | </literallayout> |
| 323 | <note> |
| 324 | CentOS 6.x users need to ensure that the required |
| 325 | versions of Git, tar and Python are available. |
| 326 | For details, See the |
| 327 | "<ulink url='&YOCTO_DOCS_REF_URL;#required-git-tar-and-python-versions'>Required Git, tar, and Python Versions</ulink>" |
| 328 | section in the Yocto Project Reference Manual for |
| 329 | information. |
| 330 | </note> |
| 331 | </para></listitem> |
| 332 | </itemizedlist> |
| 333 | </para> |
| 334 | </section> |
| 335 | |
| 336 | <section id='releases'> |
| 337 | <title>Yocto Project Release</title> |
| 338 | |
| 339 | <para> |
| 340 | The last requirement you need to meet before using the |
| 341 | Yocto Project is getting a Yocto Project release. |
| 342 | It is recommended that you get the latest Yocto Project release |
| 343 | by setting up (cloning in |
| 344 | <ulink url='&YOCTO_DOCS_DEV_URL;#git'>Git</ulink> terms) a |
| 345 | local copy of the <filename>poky</filename> Git repository on |
| 346 | your build host and then checking out the latest release. |
| 347 | Doing so allows you to easily update to newer Yocto Project |
| 348 | releases as well as contribute back to the Yocto Project. |
| 349 | </para> |
| 350 | |
| 351 | <para> |
| 352 | Here is an example from an Ubuntu build host that clones the |
| 353 | <filename>poky</filename> repository and then checks out the |
| 354 | latest Yocto Project Release (i.e. &DISTRO;): |
| 355 | <literallayout class='monospaced'> |
| 356 | $ git clone git://git.yoctoproject.org/poky |
| 357 | Cloning into 'poky'... |
| 358 | remote: Counting objects: 226790, done. |
| 359 | remote: Compressing objects: 100% (57465/57465), done. |
| 360 | remote: Total 226790 (delta 165212), reused 225887 (delta 164327) |
| 361 | Receiving objects: 100% (226790/226790), 100.98 MiB | 263 KiB/s, done. |
| 362 | Resolving deltas: 100% (165212/165212), done. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 363 | $ git checkout &DISTRO_NAME_NO_CAP; |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 364 | </literallayout> |
| 365 | You can also get the Yocto Project Files by downloading |
| 366 | Yocto Project releases from the |
| 367 | <ulink url="&YOCTO_HOME_URL;">Yocto Project website</ulink>. |
| 368 | </para> |
| 369 | |
| 370 | <para> |
| 371 | For more information on getting set up with the Yocto Project |
| 372 | release, see the |
| 373 | "<ulink url='&YOCTO_DOCS_DEV_URL;#local-yp-release'>Yocto Project Release</ulink>" |
| 374 | item in the Yocto Project Development Manual. |
| 375 | </para> |
| 376 | </section> |
| 377 | </section> |
| 378 | |
| 379 | <section id='qs-building-images'> |
| 380 | <title>Building Images</title> |
| 381 | |
| 382 | <para> |
| 383 | Now that you have your system requirements in order, you can give |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 384 | Yocto Project a try. |
| 385 | You can try out Yocto Project using either the command-line |
| 386 | interface or using Toaster, which uses a graphical user |
| 387 | interface. |
| 388 | If you want to try out the Yocto Project using a GUI, see the |
| 389 | <ulink url='&YOCTO_DOCS_TOAST_URL;'>Toaster User Manual</ulink> |
| 390 | for information on how to install and set up Toaster. |
| 391 | </para> |
| 392 | |
| 393 | <para> |
| 394 | You can try out the Yocto Project using the command-line interface |
| 395 | by finishing this quick start, which presents steps that let you |
| 396 | do the following: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 397 | <itemizedlist> |
| 398 | <listitem><para> |
| 399 | Build a <filename>qemux86</filename> reference image |
| 400 | and run it in the QEMU emulator. |
| 401 | </para></listitem> |
| 402 | <listitem><para> |
| 403 | Easily change configurations so that you can quickly |
| 404 | create a second image, which would be for MinnowBoard |
| 405 | MAX-compatible boards. |
| 406 | </para></listitem> |
| 407 | </itemizedlist> |
| 408 | <note> |
| 409 | The steps in this section do not provide detail, but rather |
| 410 | provide minimal, working commands and examples designed to |
| 411 | just get you started. |
| 412 | For more details, see the appropriate manuals in the |
| 413 | <ulink url='&YOCTO_HOME_URL;/documentation'>Yocto Project manual set</ulink>. |
| 414 | </note> |
| 415 | </para> |
| 416 | |
| 417 | <para> |
| 418 | Use the following commands to build your image. |
| 419 | The OpenEmbedded build system creates an entire Linux |
| 420 | distribution, including the toolchain, from source. |
| 421 | <note><title>Note about Network Proxies</title> |
| 422 | <para> |
| 423 | By default, the build process searches for source code |
| 424 | using a pre-determined order through a set of |
| 425 | locations. |
| 426 | If you are working behind a firewall and your build |
| 427 | host is not set up for proxies, you could encounter |
| 428 | problems with the build process when fetching source |
| 429 | code (e.g. fetcher failures or Git failures). |
| 430 | </para> |
| 431 | |
| 432 | <para> |
| 433 | If you do not know your proxy settings, consult your |
| 434 | local network infrastructure resources and get that |
| 435 | information. |
| 436 | A good starting point could also be to check your web |
| 437 | browser settings. |
| 438 | Finally, you can find more information on using the |
| 439 | Yocto Project behind a firewall in the Yocto Project |
| 440 | Reference Manual |
| 441 | <ulink url='&YOCTO_DOCS_REF_URL;#how-does-the-yocto-project-obtain-source-code-and-will-it-work-behind-my-firewall-or-proxy-server'>FAQ</ulink> |
| 442 | and on the |
| 443 | "<ulink url='https://wiki.yoctoproject.org/wiki/Working_Behind_a_Network_Proxy'>Working Behind a Network Proxy</ulink>" |
| 444 | wiki page. |
| 445 | </para> |
| 446 | </note> |
| 447 | </para> |
| 448 | |
| 449 | <para> |
| 450 | <orderedlist> |
| 451 | <listitem><para><emphasis>Be Sure Your Build Host is Set Up:</emphasis> |
| 452 | The steps to build an image in this section depend on |
| 453 | your build host being properly set up. |
| 454 | Be sure you have worked through the requirements |
| 455 | described in the |
| 456 | "<link linkend='yp-resources'>Setting Up to Use the Yocto Project</link>" |
| 457 | section. |
| 458 | </para></listitem> |
| 459 | <listitem><para><emphasis>Check Out Your Branch:</emphasis> |
| 460 | Be sure you are in the |
| 461 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink> |
| 462 | (e.g. <filename>poky</filename>) and then check out |
| 463 | the branch associated with the latest Yocto Project |
| 464 | Release: |
| 465 | <literallayout class='monospaced'> |
| 466 | $ cd ~/poky |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 467 | $ git checkout -b &DISTRO_NAME_NO_CAP; origin/&DISTRO_NAME_NO_CAP; |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 468 | </literallayout> |
| 469 | Git's <filename>checkout</filename> command checks out |
| 470 | the current Yocto Project release into a local branch |
| 471 | whose name matches the release (i.e. |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 472 | <filename>&DISTRO_NAME_NO_CAP;</filename>). |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 473 | The local branch tracks the upstream branch of the |
| 474 | same name. |
| 475 | Creating your own branch based on the released |
| 476 | branch ensures you are using the latest files for |
| 477 | that release. |
| 478 | </para></listitem> |
| 479 | <listitem><para><emphasis>Initialize the Build Environment:</emphasis> |
| 480 | Run the |
| 481 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink> |
| 482 | environment setup script to define the OpenEmbedded |
| 483 | build environment on your build host. |
| 484 | <literallayout class='monospaced'> |
| 485 | $ source &OE_INIT_FILE; |
| 486 | </literallayout> |
| 487 | Among other things, the script creates the |
| 488 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>, |
| 489 | which is <filename>build</filename> in this case |
| 490 | and is located in the |
| 491 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>. |
| 492 | After the script runs, your current working directory |
| 493 | is set to the Build Directory. |
| 494 | Later, when the build completes, the Build Directory |
| 495 | contains all the files created during the build. |
| 496 | <note> |
| 497 | For information on running a memory-resident |
| 498 | <ulink url='&YOCTO_DOCS_REF_URL;#usingpoky-components-bitbake'>BitBake</ulink>, |
| 499 | see the |
| 500 | <ulink url='&YOCTO_DOCS_REF_URL;#structure-memres-core-script'><filename>oe-init-build-env-memres</filename></ulink> |
| 501 | setup script. |
| 502 | </note> |
| 503 | </para></listitem> |
| 504 | <listitem><para><emphasis>Examine Your Local Configuration File:</emphasis> |
| 505 | When you set up the build environment, a local |
| 506 | configuration file named |
| 507 | <filename>local.conf</filename> becomes available in |
| 508 | a <filename>conf</filename> subdirectory of the |
| 509 | Build Directory. |
| 510 | Before using BitBake to start the build, you can |
| 511 | look at this file and be sure your general |
| 512 | configurations are how you want them: |
| 513 | <itemizedlist> |
| 514 | <listitem><para> |
| 515 | To help conserve disk space during builds, |
| 516 | you can add the following statement to your |
| 517 | project's configuration file, which for this |
| 518 | example is |
| 519 | <filename>poky/build/conf/local.conf</filename>. |
| 520 | Adding this statement deletes the work |
| 521 | directory used for building a recipe once the |
| 522 | recipe is built. |
| 523 | <literallayout class='monospaced'> |
| 524 | INHERIT += "rm_work" |
| 525 | </literallayout> |
| 526 | </para></listitem> |
| 527 | <listitem><para> |
| 528 | By default, the target machine for the build is |
| 529 | <filename>qemux86</filename>, |
| 530 | which produces an image that can be used in |
| 531 | the QEMU emulator and is targeted at an |
| 532 | <trademark class='registered'>Intel</trademark> |
| 533 | 32-bit based architecture. |
| 534 | Further on in this example, this default is |
| 535 | easily changed through the |
| 536 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> |
| 537 | variable so that you can quickly |
| 538 | build an image for a different machine. |
| 539 | </para></listitem> |
| 540 | <listitem><para> |
| 541 | Another consideration before you build is the |
| 542 | package manager used when creating the image. |
| 543 | The default <filename>local.conf</filename> |
| 544 | file selects the RPM package manager. |
| 545 | You can control this configuration by using the |
| 546 | <filename><ulink url='&YOCTO_DOCS_REF_URL;#var-PACKAGE_CLASSES'><filename>PACKAGE_CLASSES</filename></ulink></filename> |
| 547 | variable.</para> |
| 548 | <para>Selection of the package manager is separate |
| 549 | from whether package management is used at runtime |
| 550 | in the target image.</para> |
| 551 | <para>For additional package manager selection |
| 552 | information, see the |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 553 | "<ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-package'><filename>package.bbclass</filename></ulink>" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 554 | section in the Yocto Project Reference Manual. |
| 555 | </para></listitem> |
| 556 | </itemizedlist> |
| 557 | </para></listitem> |
| 558 | <listitem><para><emphasis>Start the Build:</emphasis> |
| 559 | Continue with the following command to build an OS image |
| 560 | for the target, which is |
| 561 | <filename>core-image-sato</filename> in this example: |
| 562 | <note> |
| 563 | Depending on the number of processors and cores, the |
| 564 | amount of RAM, the speed of your Internet connection |
| 565 | and other factors, the build process could take several |
| 566 | hours the first time you run it. |
| 567 | Subsequent builds run much faster since parts of the |
| 568 | build are cached. |
| 569 | </note> |
| 570 | <literallayout class='monospaced'> |
| 571 | $ bitbake core-image-sato |
| 572 | </literallayout> |
| 573 | For information on using the |
| 574 | <filename>bitbake</filename> command, see the |
| 575 | "<ulink url='&YOCTO_DOCS_REF_URL;#usingpoky-components-bitbake'>BitBake</ulink>" |
| 576 | section in the Yocto Project Reference Manual, or see the |
| 577 | "<ulink url='&YOCTO_DOCS_BB_URL;#bitbake-user-manual-command'>BitBake Command</ulink>" |
| 578 | section in the BitBake User Manual. |
| 579 | For information on other targets, see the |
| 580 | "<ulink url='&YOCTO_DOCS_REF_URL;#ref-images'>Images</ulink>" |
| 581 | chapter in the Yocto Project Reference Manual. |
| 582 | </para></listitem> |
| 583 | <listitem><para><emphasis>Simulate Your Image Using QEMU:</emphasis> |
| 584 | Once this particular image is built, you can start QEMU |
| 585 | and run the image: |
| 586 | <literallayout class='monospaced'> |
| 587 | $ runqemu qemux86 |
| 588 | </literallayout> |
| 589 | If you want to learn more about running QEMU, see the |
| 590 | "<ulink url="&YOCTO_DOCS_DEV_URL;#dev-manual-qemu">Using the Quick EMUlator (QEMU)</ulink>" |
| 591 | chapter in the Yocto Project Development Manual. |
| 592 | </para></listitem> |
| 593 | <listitem><para><emphasis>Exit QEMU:</emphasis> |
| 594 | Exit QEMU by either clicking on the shutdown icon or by |
| 595 | opening a terminal, typing |
| 596 | <filename>poweroff</filename>, and then pressing "Enter". |
| 597 | </para></listitem> |
| 598 | </orderedlist> |
| 599 | </para> |
| 600 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 601 | <para id='qs-minnowboard-example'> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 602 | The following steps show how easy it is to set up to build an |
| 603 | image for a new machine. |
| 604 | These steps build an image for the MinnowBoard MAX, which is |
| 605 | supported by the Yocto Project and the |
| 606 | <filename>meta-intel</filename> <filename>intel-corei7-64</filename> |
| 607 | and <filename>intel-core2-32</filename> Board Support Packages |
| 608 | (BSPs). |
| 609 | <note> |
| 610 | The MinnowBoard MAX ships with 64-bit firmware. |
| 611 | If you want to use the board in 32-bit mode, you must |
| 612 | download the |
| 613 | <ulink url='http://firmware.intel.com/projects/minnowboard-max'>32-bit firmware</ulink>. |
| 614 | </note> |
| 615 | </para> |
| 616 | |
| 617 | <para> |
| 618 | <orderedlist> |
| 619 | <listitem><para><emphasis>Create a Local Copy of the |
| 620 | <filename>meta-intel</filename> Repository:</emphasis> |
| 621 | Building an image for the MinnowBoard MAX requires the |
| 622 | <filename>meta-intel</filename> layer. |
| 623 | Use the <filename>git clone</filename> command to create |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 624 | a local copy of the repository inside your |
| 625 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>, |
| 626 | which is <filename>poky</filename> in this example: |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 627 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 628 | $ cd $HOME/poky |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 629 | $ git clone git://git.yoctoproject.org/meta-intel |
| 630 | Cloning into 'meta-intel'... |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 631 | remote: Counting objects: 11988, done. |
| 632 | remote: Compressing objects: 100% (3884/3884), done. |
| 633 | Receiving objects: 100% (11988/11988), 2.93 MiB | 2.51 MiB/s, done. |
| 634 | remote: Total 11988 (delta 6881), reused 11752 (delta 6645) |
| 635 | Resolving deltas: 100% (6881/6881), done. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 636 | Checking connectivity... done. |
| 637 | </literallayout> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 638 | By default when you clone a Git repository, the |
| 639 | "master" branch is checked out. |
| 640 | Before you build your image that uses the |
| 641 | <filename>meta-intel</filename> layer, you must be |
| 642 | sure that both repositories |
| 643 | (<filename>meta-intel</filename> and |
| 644 | <filename>poky</filename>) are using the same releases. |
| 645 | Consequently, you need to checkout out the |
| 646 | "<filename>&DISTRO_NAME_NO_CAP;</filename>" release after |
| 647 | cloning <filename>meta-intel</filename>: |
| 648 | <literallayout class='monospaced'> |
| 649 | $ cd $HOME/poky/meta-intel |
| 650 | $ git checkout &DISTRO_NAME_NO_CAP; |
| 651 | Branch &DISTRO_NAME_NO_CAP; set up to track remote branch &DISTRO_NAME_NO_CAP; from origin. |
| 652 | Switched to a new branch '&DISTRO_NAME_NO_CAP;' |
| 653 | </literallayout> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 654 | </para></listitem> |
| 655 | <listitem><para><emphasis>Configure the Build:</emphasis> |
| 656 | To configure the build, you edit the |
| 657 | <filename>bblayers.conf</filename> and |
| 658 | <filename>local.conf</filename> files, both of which are |
| 659 | located in the <filename>build/conf</filename> directory. |
| 660 | </para> |
| 661 | |
| 662 | <para>Here is a quick way to make the edits. |
| 663 | The first command uses the |
| 664 | <filename>bitbake-layers add-layer</filename> command |
| 665 | to add the <filename>meta-intel</filename> |
| 666 | layer, which contains the <filename>intel-core*</filename> |
| 667 | BSPs to the build. |
| 668 | The second command selects the BSP by setting the |
| 669 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> |
| 670 | variable. |
| 671 | <literallayout class='monospaced'> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 672 | $ cd $HOME/poky/build |
| 673 | $ bitbake-layers add-layer "$HOME/poky/meta-intel" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 674 | $ echo 'MACHINE = "intel-corei7-64"' >> conf/local.conf |
| 675 | </literallayout> |
| 676 | <note><title>Notes</title> |
| 677 | <para> |
| 678 | If you want a 64-bit build, use the following: |
| 679 | <literallayout class='monospaced'> |
| 680 | $ echo 'MACHINE = "intel-corei7-64"' >> conf/local.conf |
| 681 | </literallayout> |
| 682 | </para> |
| 683 | |
| 684 | <para> |
| 685 | If you want 32-bit images, use the following: |
| 686 | <literallayout class='monospaced'> |
| 687 | $ echo 'MACHINE = "intel-core2-32"' >> conf/local.conf |
| 688 | </literallayout> |
| 689 | </para> |
| 690 | </note> |
| 691 | </para></listitem> |
| 692 | <listitem><para><emphasis>Build a Minimal Image for MinnowBoard MAX:</emphasis> |
| 693 | Use the following command to build the minimal image for |
| 694 | MinnowBoard MAX. |
| 695 | Because configuration changes are minimal to set up for |
| 696 | this second build, the OpenEmbedded build system can |
| 697 | re-use files from previous builds as much as possible. |
| 698 | Re-using files means this second build will be much faster |
| 699 | than an initial build. |
| 700 | <literallayout class='monospaced'> |
| 701 | $ bitbake core-image-minimal |
| 702 | </literallayout> |
| 703 | Once the build completes, the resulting basic console image |
| 704 | is located in the Build Directory here: |
| 705 | <literallayout class='monospaced'> |
| 706 | tmp/deploy/images/intel-corei7-64/core-image-minimal-intel-corei7-64.hddimg |
| 707 | </literallayout> |
| 708 | </para></listitem> |
| 709 | <listitem><para><emphasis>Write the Image:</emphasis> |
| 710 | You can write the image to a USB key, SATA drive, or SD |
| 711 | card by using the <filename>mkefidisk.sh</filename> script, |
| 712 | which is included in the <filename>poky</filename> |
| 713 | repository at |
| 714 | <filename>scripts/contrib/mkefidisk.sh</filename>: |
| 715 | <literallayout class='monospaced'> |
| 716 | $ sudo $HOME/source/poky/scripts/contrib/mkefidisk.sh <replaceable>HOST_DEVICE</replaceable> \ |
| 717 | tmp/deploy/images/intel-corei7-64/core-image-minimal-intel-corei7-64.hddimg <replaceable>TARGET_DEVICE</replaceable> |
| 718 | </literallayout> |
| 719 | In the previous command, |
| 720 | <replaceable>HOST_DEVICE</replaceable> is the device node |
| 721 | on the build host (e.g. <filename>/dev/sdc</filename> or |
| 722 | <filename>/dev/mmcblk0</filename>). |
| 723 | <replaceable>TARGET_DEVICE</replaceable> is the name of the |
| 724 | device as the MinnowBoard MAX sees it (e.g. |
| 725 | <filename>/dev/sda</filename> or |
| 726 | <filename>/dev/mmcblk0</filename>). |
| 727 | </para></listitem> |
| 728 | <listitem><para><emphasis>Boot the Hardware:</emphasis> |
| 729 | With the boot device provisioned, you can insert the |
| 730 | media into the MinnowBoard MAX and boot the hardware. |
| 731 | The board should automatically detect the media and boot to |
| 732 | the bootloader and subsequently the operating system. |
| 733 | </para> |
| 734 | |
| 735 | <para>If the board does not boot automatically, you can |
| 736 | boot it manually from the EFI shell as follows: |
| 737 | <literallayout class='monospaced'> |
| 738 | Shell> connect -r |
| 739 | Shell> map -r |
| 740 | Shell> fs0: |
| 741 | Shell> bootx64 |
| 742 | </literallayout> |
| 743 | <note> |
| 744 | For a 32-bit image use the following: |
| 745 | <literallayout class='monospaced'> |
| 746 | Shell> bootia32 |
| 747 | </literallayout> |
| 748 | </note> |
| 749 | </para></listitem> |
| 750 | </orderedlist> |
| 751 | </para> |
| 752 | </section> |
| 753 | |
| 754 | <section id='qs-next-steps'> |
| 755 | <title>Next Steps</title> |
| 756 | |
| 757 | <para> |
| 758 | If you completed all the steps in the previous section then |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 759 | congratulations! |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 760 | What now? |
| 761 | </para> |
| 762 | |
| 763 | <para> |
| 764 | Depending on what you primary interests are with the Yocto Project, |
| 765 | you could consider any of the following: |
| 766 | <itemizedlist> |
| 767 | <listitem><para><emphasis>Visit the Yocto Project Web Site:</emphasis> |
| 768 | The official |
| 769 | <ulink url='&YOCTO_HOME_URL;'>Yocto Project</ulink> |
| 770 | web site contains information on the entire project. |
| 771 | Visiting this site is a good way to familiarize yourself |
| 772 | with the overall project. |
| 773 | </para></listitem> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 774 | <listitem><para><emphasis>Look Through the Yocto Project Development Manual:</emphasis> |
| 775 | The |
| 776 | <ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-intro'>Yocto Project Development Manual</ulink> |
| 777 | is a great place to get a feel for how to use the Yocto |
| 778 | Project. |
| 779 | The manual contains conceptual and procedural information |
| 780 | that covers |
| 781 | <ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-model'>common development models</ulink> |
| 782 | and introduces |
| 783 | <ulink url='&YOCTO_DOCS_DEV_URL;#dev-manual-newbie'>the Yocto Project open source development environment</ulink>. |
| 784 | The manual also contains several targeted sections that |
| 785 | cover specific |
| 786 | <ulink url='&YOCTO_DOCS_DEV_URL;#extendpoky'>common tasks</ulink> |
| 787 | such as understanding and creating layers, customizing |
| 788 | images, writing new recipes, working with libraries, and |
| 789 | configuring and patching the kernel. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 790 | </para></listitem> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 791 | <listitem><para><emphasis>Look Through the Yocto Project Software Development Kit (SDK) Developer's Guide:</emphasis> |
| 792 | The |
| 793 | <ulink url='&YOCTO_DOCS_SDK_URL;#sdk-intro'>Yocto Project Software Development Kit (SDK) Developer's Guide</ulink> |
| 794 | describes how to use both the |
| 795 | <ulink url='&YOCTO_DOCS_SDK_URL;#sdk-using-the-standard-sdk'>standard SDK</ulink> |
| 796 | and the |
| 797 | <ulink url='&YOCTO_DOCS_SDK_URL;#sdk-extensible'>extensible SDK</ulink>, |
| 798 | which are used primarily for application development. |
| 799 | This manual also provides an example workflow that uses |
| 800 | the popular <trademark class='trade'>Eclipse</trademark> |
| 801 | development environment. |
| 802 | See the |
| 803 | "<ulink url='&YOCTO_DOCS_SDK_URL;#workflow-using-eclipse'>Workflow using Eclipseâ„¢</ulink>" |
| 804 | section. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 805 | </para></listitem> |
| 806 | <listitem><para><emphasis>Learn About Board Support Packages (BSPs):</emphasis> |
| 807 | If you want to learn about BSPs, see the |
| 808 | <ulink url='&YOCTO_DOCS_BSP_URL;#bsp'>Yocto Project Board Support Packages (BSP) Developer's Guide</ulink>. |
| 809 | </para></listitem> |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 810 | <listitem><para><emphasis>Learn About Toaster:</emphasis> |
| 811 | Toaster is a web interface to the Yocto Project's |
| 812 | OpenEmbedded build system. |
| 813 | If you are interested in using this type of interface to |
| 814 | create images, see the |
| 815 | <ulink url='&YOCTO_DOCS_TOAST_URL;#toaster-manual-intro'>Toaster User Manual</ulink>. |
| 816 | </para></listitem> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 817 | <listitem><para><emphasis>Have Available the Yocto Project Reference Manual</emphasis> |
| 818 | The |
| 819 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-manual-intro'>Yocto Project Reference Manual</ulink>, |
| 820 | unlike the rest of the Yocto Project manual set, is |
| 821 | comprised of material suited for reference rather than |
| 822 | procedures. |
| 823 | You can get |
| 824 | <ulink url='&YOCTO_DOCS_REF_URL;#usingpoky'>build details</ulink>, |
| 825 | a |
| 826 | <ulink url='&YOCTO_DOCS_REF_URL;#closer-look'>closer look</ulink> |
| 827 | at how the pieces of the Yocto Project development |
| 828 | environment work together, information on various |
| 829 | <ulink url='&YOCTO_DOCS_REF_URL;#technical-details'>technical details</ulink>, |
| 830 | guidance on |
| 831 | <ulink url='&YOCTO_DOCS_REF_URL;#migration'>migrating to a newer Yocto Project release</ulink>, |
| 832 | reference material on the |
| 833 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-structure'>directory structure</ulink>, |
| 834 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes'>classes</ulink>, |
| 835 | and |
| 836 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-tasks'>tasks</ulink>. |
| 837 | The Yocto Project Reference Manual also contains a fairly |
| 838 | comprehensive |
| 839 | <ulink url='&YOCTO_DOCS_REF_URL;#ref-variables-glossary'>glossary of variables</ulink> |
| 840 | used within the Yocto Project. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 841 | </para></listitem> |
| 842 | </itemizedlist> |
| 843 | </para> |
| 844 | </section> |
| 845 | </article> |
| 846 | <!-- |
| 847 | vim: expandtab tw=80 ts=4 |
| 848 | --> |