Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | <!DOCTYPE chapter 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 | <chapter id='toaster-manual-reference'> |
| 6 | |
| 7 | <title>Concepts and Reference</title> |
| 8 | |
| 9 | <para> |
| 10 | In order to configure and use Toaster, you should understand some |
| 11 | concepts and have some basic command reference material available. |
| 12 | This final chapter provides conceptual information on layer sources, |
| 13 | releases, and JSON configuration files. |
| 14 | Also provided is a quick look at some useful |
| 15 | <filename>manage.py</filename> commands that are Toaster-specific. |
| 16 | Information on <filename>manage.py</filename> commands does exist |
| 17 | across the Web and the information in this manual by no means |
| 18 | attempts to provide a command comprehensive reference. |
| 19 | </para> |
| 20 | |
| 21 | <section id='layer-source'> |
| 22 | <title>Layer Source</title> |
| 23 | |
| 24 | <para> |
| 25 | In general, a "layer source" is a source of information about |
| 26 | existing layers. |
| 27 | In particular, we are concerned with layers that you can use |
| 28 | with the Yocto Project and Toaster. |
| 29 | This chapter describes a particular type of layer source called |
| 30 | a "layer index." |
| 31 | </para> |
| 32 | |
| 33 | <para> |
| 34 | A layer index is a web application that contains information |
| 35 | about a set of custom layers. |
| 36 | A good example of an existing layer index is the |
| 37 | OpenEmbedded Metadata Index. |
| 38 | A public instance of this layer index exists at |
| 39 | <ulink url='http://layers.openembedded.org'></ulink>. |
| 40 | You can find the code for this layer index's web application at |
| 41 | <ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/'></ulink>. |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | When you tie a layer source into Toaster, it can query the layer |
| 46 | source through a |
| 47 | <ulink url='http://en.wikipedia.org/wiki/Representational_state_transfer'>REST</ulink> |
| 48 | API, store the information about the layers in the Toaster |
| 49 | database, and then show the information to users. |
| 50 | Users are then able to view that information and build layers |
| 51 | from Toaster itself without worrying about cloning or editing |
| 52 | the BitBake layers configuration file |
| 53 | <filename>bblayers.conf</filename>. |
| 54 | </para> |
| 55 | |
| 56 | <para> |
| 57 | Tying a layer source into Toaster is convenient when you have |
| 58 | many custom layers that need to be built on a regular basis by |
| 59 | a community of developers. |
| 60 | In fact, Toaster comes pre-configured with the OpenEmbedded |
| 61 | Metadata Index. |
| 62 | <note> |
| 63 | You do not have to use a layer source to use Toaster. |
| 64 | Tying into a layer source is optional. |
| 65 | </note> |
| 66 | </para> |
| 67 | |
| 68 | <section id='layer-source-using-with-toaster'> |
| 69 | <title>Setting Up and Using a Layer Source</title> |
| 70 | |
| 71 | <para> |
| 72 | To use your own layer source, you need to set up the layer |
| 73 | source and then tie it into Toaster. |
| 74 | This section describes how to tie into a layer index in a manner |
| 75 | similar to the way Toaster ties into the OpenEmbedded Metadata |
| 76 | Index. |
| 77 | </para> |
| 78 | |
| 79 | <section id='understanding-your-layers'> |
| 80 | <title>Understanding Your Layers</title> |
| 81 | |
| 82 | <para> |
| 83 | The obvious first step for using a layer index is to have |
| 84 | several custom layers that developers build and access using |
| 85 | the Yocto Project on a regular basis. |
| 86 | This set of layers needs to exist and you need to be |
| 87 | familiar with where they reside. |
| 88 | You will need that information when you set up the |
| 89 | code for the web application that "hooks" into your set of |
| 90 | layers. |
| 91 | </para> |
| 92 | |
| 93 | <para> |
| 94 | For general information on layers, see the |
| 95 | "<ulink url='&YOCTO_DOCS_BSP_URL;#bsp-layers'>BSP Layers</ulink>" |
| 96 | and |
| 97 | "<ulink url='&YOCTO_DOCS_BSP_URL;#using-the-yocto-projects-bsp-tools'>Using the Yocto Project's BSP Tools</ulink>" |
| 98 | sections in the Yocto Project Board Support Package (BSP) |
| 99 | Developer's Guide. |
| 100 | </para> |
| 101 | </section> |
| 102 | |
| 103 | <section id='configuring-toaster-to-hook-into-your-layer-source'> |
| 104 | <title>Configuring Toaster to Hook Into Your Layer Index</title> |
| 105 | |
| 106 | <para> |
| 107 | If you want Toaster to use your layer index, you must host |
| 108 | the web application in a server to which Toaster can |
| 109 | connect. |
| 110 | You also need to give Toaster the information about your |
| 111 | layer index. |
| 112 | In other words, you have to configure Toaster to use your |
| 113 | layer index. |
| 114 | This section describes two methods by which you can |
| 115 | configure and use your layer index. |
| 116 | </para> |
| 117 | |
| 118 | <para> |
| 119 | In the previous section, the code for the OpenEmbedded |
| 120 | Metadata Index (i.e. |
| 121 | <ulink url='http://layers.openembedded.org'></ulink>) was |
| 122 | referenced. |
| 123 | You can use this code, which is at |
| 124 | <ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/'></ulink>, |
| 125 | as a base to create your own layer index. |
| 126 | </para> |
| 127 | |
| 128 | <section id='use-the-administration-interface'> |
| 129 | <title>Use the Administration Interface</title> |
| 130 | |
| 131 | <para> |
| 132 | Access the administration interface through a |
| 133 | browser by entering the URL of your Toaster instance and |
| 134 | adding "<filename>/admin</filename>" to the end of the |
| 135 | URL. |
| 136 | As an example, if you are running Toaster locally, use |
| 137 | the following URL: |
| 138 | <literallayout class='monospaced'> |
| 139 | http://127.0.0.1:8000/admin |
| 140 | </literallayout> |
| 141 | </para> |
| 142 | |
| 143 | <para> |
| 144 | The administration interface has a "Layer sources" |
| 145 | section that includes an "Add layer source" button. |
| 146 | Click that button and provide the required information. |
| 147 | Make sure you select "layerindex" as the layer source type. |
| 148 | </para> |
| 149 | </section> |
| 150 | |
| 151 | <section id='select-the-toasterconf-json-file'> |
| 152 | <title>Use the <filename>toasterconf.json</filename> File</title> |
| 153 | |
| 154 | <para> |
| 155 | If you do not want to use the Administration |
| 156 | Interface, you can edit the |
| 157 | <link linkend='toaster-json-files'><filename>toasterconf.json</filename></link> |
| 158 | file and reload it to Toaster. |
| 159 | </para> |
| 160 | |
| 161 | <para> |
| 162 | When you set up Toaster in Build Mode, you are prompted |
| 163 | to select a Toaster configuration file. |
| 164 | This configuration file is used to set up the initial |
| 165 | configuration values within the Toaster database |
| 166 | including the layer sources. |
| 167 | Three versions of the configuration file exist: |
| 168 | <itemizedlist> |
| 169 | <listitem><para> |
| 170 | The first version of the file is found in the |
| 171 | <filename>conf</filename> directory of the |
| 172 | <filename>meta-yocto</filename> layer |
| 173 | (i.e. |
| 174 | <filename>meta-yocto/conf/toasterconf.json</filename>). |
| 175 | This version contains the default Yocto Project |
| 176 | configuration for Toaster. |
| 177 | You are prompted to select this file during the |
| 178 | Toaster set up process if you had cloned the |
| 179 | <filename>poky</filename> repository (i.e. |
| 180 | <filename>git://git.yoctoproject.org/poky</filename>). |
| 181 | </para></listitem> |
| 182 | <listitem><para> |
| 183 | The second version of the file is in the |
| 184 | <filename>conf</filename> directory of the |
| 185 | <filename>openembedded-core</filename> layer |
| 186 | (i.e. <filename>meta/conf/toasterconf.json</filename>). |
| 187 | This version contains the default OpenEmbedded |
| 188 | configuration for Toaster. |
| 189 | You are prompted to select this file during the |
| 190 | Toaster set up process if you had cloned the |
| 191 | <filename>openembedded-core</filename> repository |
| 192 | (i.e. |
| 193 | <filename>git://git.openembedded.org/openembedded-core</filename>). |
| 194 | </para></listitem> |
| 195 | <listitem><para> |
| 196 | The third version is a sample configuration |
| 197 | useful for when you want to set up a hosted |
| 198 | service in Build Mode. |
| 199 | You can find this version on the |
| 200 | <ulink url='https://wiki.yoctoproject.org/wiki/File:Toasterconf.json.txt.patch'>File:Toasterconf.json.txt.patch</ulink> |
| 201 | wiki page. |
| 202 | </para></listitem> |
| 203 | </itemizedlist> |
| 204 | </para> |
| 205 | </section> |
| 206 | |
| 207 | <section id='edit-the-configuration-file'> |
| 208 | <title>Edit the Configuration File</title> |
| 209 | |
| 210 | <para> |
| 211 | Edit the version of the |
| 212 | <filename>toasterconf.json</filename> file you |
| 213 | used to set up your Toaster instance. |
| 214 | In the file, you will find a section for layer sources |
| 215 | such as the following: |
| 216 | <literallayout class='monospaced'> |
| 217 | "layersources": [ |
| 218 | { |
| 219 | "name": "Local Yocto Project", |
| 220 | "sourcetype": "local", |
| 221 | "apiurl": "../../", |
| 222 | "branches": ["HEAD", "master", "fido", "dizzy"], |
| 223 | "layers": [ |
| 224 | { |
| 225 | "name": "openembedded-core", |
| 226 | "local_path": "meta", |
| 227 | "vcs_url": "remote:origin", |
| 228 | "dirpath": "meta" |
| 229 | }, |
| 230 | { |
| 231 | "name": "meta-yocto", |
| 232 | "local_path": "meta-yocto", |
| 233 | "vcs_url": "remote:origin", |
| 234 | "dirpath": "meta-yocto" |
| 235 | }, |
| 236 | { |
| 237 | "name": "meta-yocto-bsp", |
| 238 | "local_path": "meta-yocto-bsp", |
| 239 | "vcs_url": "remote:origin", |
| 240 | "dirpath": "meta-yocto-bsp" |
| 241 | } |
| 242 | |
| 243 | ] |
| 244 | }, |
| 245 | { |
| 246 | "name": "OpenEmbedded", |
| 247 | "sourcetype": "layerindex", |
| 248 | "apiurl": "http://layers.openembedded.org/layerindex/api/", |
| 249 | "branches": ["master", "fido", "dizzy"] |
| 250 | }, |
| 251 | { |
| 252 | "name": "Imported layers", |
| 253 | "sourcetype": "imported", |
| 254 | "apiurl": "", |
| 255 | "branches": ["master", "fido", "dizzy", "HEAD"] |
| 256 | |
| 257 | } |
| 258 | ], |
| 259 | </literallayout> |
| 260 | You should add your own layer source to this section by |
| 261 | following the same format used for the "OpenEmbedded" |
| 262 | layer source shown above. |
| 263 | </para> |
| 264 | |
| 265 | <para> |
| 266 | Give your layer source a name, provide the URL of your |
| 267 | layer source API, use the source type "layerindex", and |
| 268 | indicate which branches from your layer source you want |
| 269 | to make available through Toaster. |
| 270 | For example, the OpenEmbedded layer source makes |
| 271 | available only its "master", "fido", and "dizzy" |
| 272 | branches. |
| 273 | </para> |
| 274 | |
| 275 | <para> |
| 276 | The branches must match the branch you |
| 277 | set when configuring your releases. |
| 278 | For example, if you configure one release in Toaster |
| 279 | by setting its branch to "branch-one" and you configure |
| 280 | another release in Toaster by setting its branch to |
| 281 | "branch-two", the branches in your layer source should |
| 282 | be "branch-one" and "branch-two" as well. |
| 283 | Doing so creates a connection between the releases |
| 284 | and the layer information from your layer source. |
| 285 | Thus, when users create a project with a given |
| 286 | release, they will see the appropriate layers from |
| 287 | your layer source. |
| 288 | This connection ensures that only layers that are |
| 289 | compatible with the selected project release can be |
| 290 | selected for building. |
| 291 | </para> |
| 292 | |
| 293 | <para> |
| 294 | Once you have added this information to the |
| 295 | <filename>toasterconf.json</filename> file, save your |
| 296 | changes. |
| 297 | </para> |
| 298 | |
| 299 | <para> |
| 300 | In a terminal window, navigate to the directory that |
| 301 | contains the Toaster database, which by default is the |
| 302 | root of the Yocto Project |
| 303 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>. |
| 304 | Once you are located in that directory, run the |
| 305 | "<filename>loadconf</filename>" command, which takes as |
| 306 | an argument the full path to the |
| 307 | <filename>toasterconf.json</filename> file you just edited. |
| 308 | For example, if you cloned the |
| 309 | <filename>poky</filename> repository and you edited the |
| 310 | <filename>meta-yocto/conf/toasterconf.json</filename> file, |
| 311 | you would type something like the following: |
| 312 | <literallayout class='monospaced'> |
| 313 | $ bitbake/lib/toaster/manage.py loadconf /home/scottrif/poky/meta-yocto/conf/toasterconf.json |
| 314 | </literallayout> |
| 315 | After entering this command, you need to update the |
| 316 | Toaster database with the information coming from your |
| 317 | new layer source. |
| 318 | To do that, you should run the |
| 319 | "<filename>lsupdates</filename>" command from the directory |
| 320 | that contains the Toaster database. |
| 321 | Here is an example: |
| 322 | <literallayout class='monospaced'> |
| 323 | $ bitbake/lib/toaster/manage.py lsupdates |
| 324 | </literallayout> |
| 325 | If Toaster can reach the API URL, you should see a message |
| 326 | telling you that Toaster is updating the layer source |
| 327 | information. |
| 328 | </para> |
| 329 | |
| 330 | <para> |
| 331 | Once the information has been updated, verify the new layer |
| 332 | information is available by using the Toaster web interface. |
| 333 | To do that, visit the "All compatible layers" page inside a |
| 334 | Toaster project. |
| 335 | The layers from your layer source should be listed there. |
| 336 | </para> |
| 337 | </section> |
| 338 | </section> |
| 339 | </section> |
| 340 | </section> |
| 341 | |
| 342 | <section id='toaster-releases'> |
| 343 | <title>Releases</title> |
| 344 | |
| 345 | <para> |
| 346 | When you create a Toaster project using the web interface, |
| 347 | you are asked to choose a "Release." |
| 348 | In the context of Toaster, the term "Release" refers to a set of |
| 349 | layers and a BitBake version the OpenEmbedded build system uses |
| 350 | to build something. |
| 351 | As shipped, Toaster is pre-configured with releases that |
| 352 | correspond to Yocto Project release branches. |
| 353 | However, you can modify, delete, and create new releases |
| 354 | according to your needs. |
| 355 | This section provides some background information on releases. |
| 356 | </para> |
| 357 | |
| 358 | <section id='toaster-releases-supported'> |
| 359 | <title>Pre-Configured Releases</title> |
| 360 | |
| 361 | <para> |
| 362 | As shipped, Toaster is configured to use a specific set of |
| 363 | releases. |
| 364 | Of course, you can always configure Toaster to use any |
| 365 | release. |
| 366 | For example, you might want your project to build against a |
| 367 | specific commit of any of the "out-of-the-box" releases. |
| 368 | Or, you might want your project to build against different |
| 369 | revisions of OpenEmbedded and BitBake. |
| 370 | </para> |
| 371 | |
| 372 | <para> |
| 373 | As shipped, Toaster is configured to work with the following |
| 374 | releases: |
| 375 | <itemizedlist> |
| 376 | <listitem><para><emphasis>Yocto Project 1.7 "Dizzy" or OpenEmbedded "Dizzy":</emphasis> |
| 377 | This release causes your Toaster projects to |
| 378 | build against the head of the dizzy branch at |
| 379 | <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/log/?h=dizzy'></ulink> |
| 380 | or |
| 381 | <ulink url='http://git.openembedded.org/openembedded-core/commit/?h=dizzy'></ulink>. |
| 382 | </para></listitem> |
| 383 | <listitem><para><emphasis>Yocto Project 1.8 "Fido" or OpenEmbedded "Fido":</emphasis> |
| 384 | This release causes your Toaster projects to |
| 385 | build against the head of the fido branch at |
| 386 | <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/log/?h=fido'></ulink> |
| 387 | or |
| 388 | <ulink url='http://git.openembedded.org/openembedded-core/commit/?h=fido'></ulink>. |
| 389 | </para></listitem> |
| 390 | <listitem><para><emphasis>Yocto Project "Master" or OpenEmbedded "Master":</emphasis> |
| 391 | This release causes your Toaster Projects to |
| 392 | build against the head of the master branch, which is |
| 393 | where active development takes place, at |
| 394 | <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/log/'></ulink> |
| 395 | or |
| 396 | <ulink url='http://git.openembedded.org/openembedded-core/log/'></ulink>. |
| 397 | </para></listitem> |
| 398 | <listitem><para><emphasis>Local Yocto Project or Local OpenEmbedded:</emphasis> |
| 399 | This release causes your Toaster Projects to |
| 400 | build against the head of the <filename>poky</filename> |
| 401 | or <filename>openembedded-core</filename> clone you |
| 402 | have local to the machine running Toaster. |
| 403 | </para></listitem> |
| 404 | </itemizedlist> |
| 405 | </para> |
| 406 | </section> |
| 407 | |
| 408 | <section id='toaster-releases-comprised-of'> |
| 409 | <title>What Makes Up a Release?</title> |
| 410 | |
| 411 | <para> |
| 412 | A release consists of the following: |
| 413 | <itemizedlist> |
| 414 | <listitem><para><emphasis>Name:</emphasis> |
| 415 | The name of the release (<filename>name</filename>). |
| 416 | This release name never appears in the the Toaster |
| 417 | web interface. |
| 418 | Consequently, a user never sees the release name. |
| 419 | </para></listitem> |
| 420 | <listitem><para><emphasis>Description:</emphasis> |
| 421 | The textual description of the release |
| 422 | (<filename>description</filename>). |
| 423 | This description is what users encounter when creating |
| 424 | projects with the Toaster web interface. |
| 425 | When you configure your release, be sure to use |
| 426 | a description that sufficiently describes and is |
| 427 | understandable. |
| 428 | If Toaster has more than one release configured, the |
| 429 | release descriptions appear listed in a drop down menu |
| 430 | when a user creates a new project. |
| 431 | If Toaster has only one release configured, all |
| 432 | projects created using the web interface take that |
| 433 | release and the drop down menu does not display in the |
| 434 | Toaster web interface. |
| 435 | </para></listitem> |
| 436 | <listitem><para><emphasis>BitBake:</emphasis> |
| 437 | The Bitbake version (<filename>bitbake</filename>) |
| 438 | used to build layers set in the current release. |
| 439 | This version is described by a name, a Git URL, a |
| 440 | branch in the Git URL, and a directory path in the |
| 441 | Git repository. |
| 442 | As an example, consider the following snippet from |
| 443 | a Toaster JSON configuration file. |
| 444 | This BitBake version uses the master branch from the |
| 445 | OpenEmbedded repository: |
| 446 | <literallayout class='monospaced'> |
| 447 | "bitbake" : [ |
| 448 | { |
| 449 | "name": "master", |
| 450 | "giturl": "git://git.openembedded.org/bitbake", |
| 451 | "branch": "master", |
| 452 | "dirpath": "" |
| 453 | } |
| 454 | ] |
| 455 | </literallayout> |
| 456 | Here is more detail on each of the items that comprise |
| 457 | the BitBake version: |
| 458 | <itemizedlist> |
| 459 | <listitem><para><emphasis>Name:</emphasis> |
| 460 | A string |
| 461 | (<filename>name</filename>) used to refer to |
| 462 | the version of BitBake you are using with |
| 463 | Toaster. |
| 464 | This name is never exposed through Toaster. |
| 465 | </para></listitem> |
| 466 | <listitem><para><emphasis>Git URL:</emphasis> |
| 467 | The URL (<filename>giturl</filename>) |
| 468 | for the BitBake Git repository cloned |
| 469 | for Toaster projects. |
| 470 | </para></listitem> |
| 471 | <listitem><para><emphasis>Branch:</emphasis> |
| 472 | The Git branch, or revision, |
| 473 | (<filename>branch</filename>) of the BitBake |
| 474 | repository used with Toaster. |
| 475 | </para></listitem> |
| 476 | <listitem><para><emphasis>Directory Path:</emphasis> |
| 477 | The sub-directory of the BitBake repository |
| 478 | (<filename>dirpath</filename>). |
| 479 | If the Git URL includes more than one |
| 480 | repository, you need to set this directory. |
| 481 | If the URL does not include more than a single |
| 482 | repository, you can set |
| 483 | <filename>dirpath</filename> to a null string |
| 484 | (i.e. ""). |
| 485 | </para></listitem> |
| 486 | </itemizedlist> |
| 487 | </para></listitem> |
| 488 | <listitem><para><emphasis>Branch:</emphasis> |
| 489 | The branch for the layer source |
| 490 | (<filename>branch</filename>) used with the release. |
| 491 | For example, for the OpenEmbedded layer source, the |
| 492 | "master", "fido", and "dizzy" branches are available. |
| 493 | </para></listitem> |
| 494 | <listitem><para><emphasis>Default Layers:</emphasis> |
| 495 | The set of default layers |
| 496 | (<filename>defaultlayers</filename>) automatically |
| 497 | added to the project configuration when a project is |
| 498 | created. |
| 499 | </para></listitem> |
| 500 | <listitem><para><emphasis>Layer Source Priorities</emphasis> |
| 501 | A specification of |
| 502 | <link linkend='layer-source'>layer source</link> |
| 503 | priorities (<filename>layersourcepriority</filename>). |
| 504 | In order for Toaster to work as intended, the |
| 505 | "Imported layers" layer source should have the highest |
| 506 | priority, which means that layers manually imported by |
| 507 | users with the "Import layer" functionality will |
| 508 | always be visible and available for selection. |
| 509 | </para></listitem> |
| 510 | <listitem><para><emphasis>Help Text:</emphasis> |
| 511 | Help text (<filename>helptext</filename>) that explains |
| 512 | what the release does when selected. |
| 513 | This help text appears below the release drop-down |
| 514 | menu when you create a Toaster project. |
| 515 | The help text should assist users in making the correct |
| 516 | decision regarding the release to use for a given |
| 517 | project. |
| 518 | </para></listitem> |
| 519 | </itemizedlist> |
| 520 | </para> |
| 521 | |
| 522 | <para> |
| 523 | To summarize what comprises a release, consider the following |
| 524 | example from a Toaster JSON file. |
| 525 | The configuration names the release "master" and uses the |
| 526 | "master" branch provided by the layer source of type |
| 527 | "layerindex", which is called "OpenEmbedded", and sets |
| 528 | the <filename>openembedded-core</filename> layer as the one |
| 529 | to be added by default to any projects created in Toaster. |
| 530 | The BitBake version used would be defined as shown earlier |
| 531 | in the previous list: |
| 532 | <literallayout class='monospaced'> |
| 533 | "releases": [ |
| 534 | { |
| 535 | "name": "master", |
| 536 | "description": "OpenEmbedded master", |
| 537 | "bitbake": "master", |
| 538 | "branch": "master", |
| 539 | "defaultlayers": [ "openembedded-core" ], |
| 540 | "layersourcepriority": { "Imported layers": 99, "Local OpenEmbedded" : 10, "OpenEmbedded" : 0 }, |
| 541 | "helptext": "Toaster will run your builds using the OpenEmbedded master branch, where active development takes place. This is not a stable branch, so your builds might not work as expected." |
| 542 | } |
| 543 | ] |
| 544 | </literallayout> |
| 545 | </para> |
| 546 | </section> |
| 547 | </section> |
| 548 | |
| 549 | <section id='toaster-json-files'> |
| 550 | <title>JSON Files</title> |
| 551 | |
| 552 | <para> |
| 553 | If you are going to be using Toaster in Build Mode, it must |
| 554 | be initially configured before use. |
| 555 | Configuration customizes layer source settings and Toaster defaults |
| 556 | for all users and is performed by the person responsible for |
| 557 | Toaster Configuration (i.e the Toaster Administrator). |
| 558 | The Toaster Administrator performs this configuration through the |
| 559 | Django administration interface. |
| 560 | </para> |
| 561 | |
| 562 | <para> |
| 563 | To make it easier to initially start Toaster, you can import a |
| 564 | pre-defined configuration file using the |
| 565 | <link linkend='toaster-command-loadconf'><filename>loadconf</filename></link> |
| 566 | command. |
| 567 | <note> |
| 568 | The configuration file is a JSON-formatted text file with |
| 569 | specific fields that Toaster recognizes. |
| 570 | It is not a data dump from the database, so it cannot be |
| 571 | loaded directly in the database. |
| 572 | </note> |
| 573 | </para> |
| 574 | |
| 575 | <para> |
| 576 | By convention, the supplied configuration files are named |
| 577 | <filename>toasterconf.json</filename>. |
| 578 | The Toaster Administrator can customize the file prior to loading |
| 579 | it into Toaster. |
| 580 | When you set up Toaster locally to run in Build Mode, the system |
| 581 | startup script actively looks for compatible configuration files |
| 582 | and prompts you to select a file to load if it detects that the |
| 583 | database has not been configured. |
| 584 | </para> |
| 585 | |
| 586 | <section id='json-file-choices'> |
| 587 | <title>Configuration File Choices</title> |
| 588 | |
| 589 | <para> |
| 590 | Three versions of the configuration file exist: |
| 591 | <itemizedlist> |
| 592 | <listitem><para> |
| 593 | The |
| 594 | <filename>meta-yocto/conf/toasterconf.json</filename> |
| 595 | in the <filename>conf</filename> directory of the |
| 596 | Yocto Project's <filename>meta-yocto</filename> layer. |
| 597 | This version contains the default Yocto Project |
| 598 | configuration for Toaster. |
| 599 | You are prompted to select this file during the Toaster |
| 600 | set up process if you cloned the |
| 601 | <filename>poky</filename> repository (i.e. |
| 602 | <filename>&YOCTO_GIT_URL;/poky</filename>). |
| 603 | </para></listitem> |
| 604 | <listitem><para> |
| 605 | The <filename>meta/conf/toasterconf.json</filename> |
| 606 | in the <filename>conf</filename> directory of the |
| 607 | OpenEmbedded's <filename>openembedded-core</filename> |
| 608 | layer. |
| 609 | This version contains the default OpenEmbedded |
| 610 | configuration for Toaster. |
| 611 | You are prompted to select this file during the Toaster |
| 612 | set up process if you had cloned the |
| 613 | <filename>openembedded-core</filename> repository (i.e. |
| 614 | <filename>git://git.openembedded.org/openembedded-core</filename>). |
| 615 | </para></listitem> |
| 616 | <listitem><para> |
| 617 | The <filename>Toasterconf.json.txt.patch</filename> |
| 618 | located on the |
| 619 | <ulink url='https://wiki.yoctoproject.org/wiki/File:Toasterconf.json.txt.patch'>File:Toasterconf.json.txt.patch</ulink> |
| 620 | wiki page. |
| 621 | This version of the file is useful as a sample |
| 622 | configuration for when you want to set up Toaster as a |
| 623 | hosted service in Build Mode. |
| 624 | </para></listitem> |
| 625 | </itemizedlist> |
| 626 | </para> |
| 627 | </section> |
| 628 | |
| 629 | <section id='json-structure'> |
| 630 | <title>File Structure</title> |
| 631 | |
| 632 | <para> |
| 633 | The <filename>toasterconf.json</filename> file consists of |
| 634 | easily readable areas: configuration, layer sources, BitBake, |
| 635 | default release, and releases. |
| 636 | </para> |
| 637 | |
| 638 | <section id='json-config-area'> |
| 639 | <title>Configuration Area</title> |
| 640 | |
| 641 | <para> |
| 642 | This area of the JSON file sets which variables are exposed |
| 643 | to users through the Toaster web interface. |
| 644 | Users can easily edit these variables. |
| 645 | </para> |
| 646 | |
| 647 | <para> |
| 648 | The variables you set here are displayed in the |
| 649 | "Configuration variables" page in Toaster. |
| 650 | Minimally, you should set the |
| 651 | <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> |
| 652 | variable, which appears to users as part of the project |
| 653 | page in Toaster. |
| 654 | </para> |
| 655 | |
| 656 | <para> |
| 657 | Here is the default <filename>config</filename> area: |
| 658 | <literallayout class='monospaced'> |
| 659 | "config": { |
| 660 | "MACHINE" : "qemux86", |
| 661 | "DISTRO" : "poky", |
| 662 | "IMAGE_FSTYPES": "ext3 jffs2 tar.bz2", |
| 663 | "IMAGE_INSTALL_append": "", |
| 664 | "PACKAGE_CLASSES": "package_rpm", |
| 665 | "SDKMACHINE" : "x86_64" |
| 666 | }, |
| 667 | </literallayout> |
| 668 | </para> |
| 669 | </section> |
| 670 | |
| 671 | <section id='json-layersources-area'> |
| 672 | <title>Layer Sources Area</title> |
| 673 | |
| 674 | <para> |
| 675 | This area of the JSON file defines the |
| 676 | <link linkend='layer-source'>layer sources</link> |
| 677 | Toaster uses. |
| 678 | Toaster reads layer information from layer sources. |
| 679 | Three types of layer sources exist that Toaster |
| 680 | recognizes: Local, LayerIndex, and Imported. |
| 681 | </para> |
| 682 | |
| 683 | <para> |
| 684 | The Local layer source reads layers from Git clones |
| 685 | available on your local drive. |
| 686 | Using a local layer source enables you to easily test |
| 687 | Toaster. |
| 688 | <note> |
| 689 | If you are setting up a hosted version of Toaster, |
| 690 | it does not make sense to have a local layer source. |
| 691 | </note> |
| 692 | </para> |
| 693 | |
| 694 | <para> |
| 695 | The LayerIndex layer source uses a REST API exposed by |
| 696 | instances of the Layer Index application (e.g the public |
| 697 | <ulink url='http://layers.openembedded.org/'></ulink>) |
| 698 | to read layer data. |
| 699 | </para> |
| 700 | |
| 701 | <para> |
| 702 | The Imported layer source is reserved for layer data |
| 703 | manually introduced by the user or Toaster Administrator |
| 704 | through the GUI. |
| 705 | This layer source lets users import their own layers |
| 706 | and build them with Toaster. |
| 707 | You should not remove the imported layer source. |
| 708 | </para> |
| 709 | |
| 710 | <para> |
| 711 | Here is the default <filename>layersources</filename> area: |
| 712 | <literallayout class='monospaced'> |
| 713 | "layersources": [ |
| 714 | { |
| 715 | "name": "Local Yocto Project", |
| 716 | "sourcetype": "local", |
| 717 | "apiurl": "../../", |
| 718 | "branches": ["HEAD", "master", "fido", "dizzy"], |
| 719 | "layers": [ |
| 720 | { |
| 721 | "name": "openembedded-core", |
| 722 | "local_path": "meta", |
| 723 | "vcs_url": "remote:origin", |
| 724 | "dirpath": "meta" |
| 725 | }, |
| 726 | { |
| 727 | "name": "meta-yocto", |
| 728 | "local_path": "meta-yocto", |
| 729 | "vcs_url": "remote:origin", |
| 730 | "dirpath": "meta-yocto" |
| 731 | }, |
| 732 | { |
| 733 | "name": "meta-yocto-bsp", |
| 734 | "local_path": "meta-yocto-bsp", |
| 735 | "vcs_url": "remote:origin", |
| 736 | "dirpath": "meta-yocto-bsp" |
| 737 | } |
| 738 | |
| 739 | ] |
| 740 | }, |
| 741 | { |
| 742 | "name": "OpenEmbedded", |
| 743 | "sourcetype": "layerindex", |
| 744 | "apiurl": "http://layers.openembedded.org/layerindex/api/", |
| 745 | "branches": ["master", "fido", "dizzy"] |
| 746 | }, |
| 747 | { |
| 748 | "name": "Imported layers", |
| 749 | "sourcetype": "imported", |
| 750 | "apiurl": "", |
| 751 | "branches": ["master", "fido", "dizzy", "HEAD"] |
| 752 | |
| 753 | } |
| 754 | ], |
| 755 | </literallayout> |
| 756 | </para> |
| 757 | </section> |
| 758 | |
| 759 | <section id='json-bitbake-area'> |
| 760 | <title>BitBake Area</title> |
| 761 | |
| 762 | <para> |
| 763 | This area of the JSON file defines the version of |
| 764 | BitBake Toaster uses. |
| 765 | As shipped, Toaster is configured to recognize four |
| 766 | versions of BitBake: master, fido, dizzy, and HEAD. |
| 767 | <note> |
| 768 | HEAD is a special option that builds whatever is |
| 769 | available on disk, without checking out any remote |
| 770 | Git repositories. |
| 771 | </note> |
| 772 | </para> |
| 773 | |
| 774 | <para> |
| 775 | Here is the default <filename>bitbake</filename> area: |
| 776 | <literallayout class='monospaced'> |
| 777 | "bitbake" : [ |
| 778 | { |
| 779 | "name": "master", |
| 780 | "giturl": "remote:origin", |
| 781 | "branch": "master", |
| 782 | "dirpath": "bitbake" |
| 783 | }, |
| 784 | { |
| 785 | "name": "fido", |
| 786 | "giturl": "remote:origin", |
| 787 | "branch": "fido", |
| 788 | "dirpath": "bitbake" |
| 789 | }, |
| 790 | { |
| 791 | "name": "dizzy", |
| 792 | "giturl": "remote:origin", |
| 793 | "branch": "dizzy", |
| 794 | "dirpath": "bitbake" |
| 795 | }, |
| 796 | { |
| 797 | "name": "HEAD", |
| 798 | "giturl": "remote:origin", |
| 799 | "branch": "HEAD", |
| 800 | "dirpath": "bitbake" |
| 801 | } |
| 802 | ], |
| 803 | </literallayout> |
| 804 | </para> |
| 805 | </section> |
| 806 | |
| 807 | <section id='json-default-area'> |
| 808 | <title>Default Area</title> |
| 809 | |
| 810 | <para> |
| 811 | This area of the JSON file establishes a default |
| 812 | release used by Toaster. |
| 813 | As shipped, Toaster uses the "master" release. |
| 814 | </para> |
| 815 | |
| 816 | <para> |
| 817 | Here is the statement in the JSON file that establishes |
| 818 | the default release: |
| 819 | <literallayout class='monospaced'> |
| 820 | "defaultrelease": "master", |
| 821 | </literallayout> |
| 822 | </para> |
| 823 | </section> |
| 824 | |
| 825 | <section id='json-releases-area'> |
| 826 | <title>Releases Area</title> |
| 827 | |
| 828 | <para> |
| 829 | This area of the JSON file defines the versions of the |
| 830 | OpenEmbedded build system Toaster recognizes. |
| 831 | As shipped, Toaster is configured to work with the four |
| 832 | releases described in the |
| 833 | "<link linkend='toaster-releases-supported'>Pre-Configured Releases</link>" |
| 834 | section. |
| 835 | </para> |
| 836 | |
| 837 | <para> |
| 838 | Here is the default <filename>releases</filename> area: |
| 839 | <literallayout class='monospaced'> |
| 840 | "releases": [ |
| 841 | { |
| 842 | "name": "master", |
| 843 | "description": "Yocto Project master", |
| 844 | "bitbake": "master", |
| 845 | "branch": "master", |
| 846 | "defaultlayers": [ "openembedded-core", "meta-yocto", "meta-yocto-bsp"], |
| 847 | "layersourcepriority": { "Imported layers": 99, "Local Yocto Project" : 10, "OpenEmbedded" : 0 }, |
| 848 | "helptext": "Toaster will run your builds using the tip of the <a href=\"http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/\">Yocto Project master branch</a>, where active development takes place. This is not a stable branch, so your builds might not work as expected." |
| 849 | }, |
| 850 | { |
| 851 | "name": "fido", |
| 852 | "description": "Yocto Project 1.8 Fido", |
| 853 | "bitbake": "fido", |
| 854 | "branch": "fido", |
| 855 | "defaultlayers": [ "openembedded-core", "meta-yocto", "meta-yocto-bsp"], |
| 856 | "layersourcepriority": { "Imported layers": 99, "Local Yocto Project" : 10, "OpenEmbedded" : 0 }, |
| 857 | "helptext": "Toaster will run your builds with the tip of the <a href=\"http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?h=fido\">Yocto Project 1.8 \"Fido\"</a> branch." |
| 858 | }, |
| 859 | { |
| 860 | "name": "dizzy", |
| 861 | "description": "Yocto Project 1.7 Dizzy", |
| 862 | "bitbake": "dizzy", |
| 863 | "branch": "dizzy", |
| 864 | "defaultlayers": [ "openembedded-core", "meta-yocto", "meta-yocto-bsp"], |
| 865 | "layersourcepriority": { "Imported layers": 99, "Local Yocto Project" : 10, "OpenEmbedded" : 0 }, |
| 866 | "helptext": "Toaster will run your builds with the tip of the <a href=\"http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?h=dizzy\">Yocto Project 1.7 \"Dizzy\"</a> branch." |
| 867 | }, |
| 868 | { |
| 869 | "name": "local", |
| 870 | "description": "Local Yocto Project", |
| 871 | "bitbake": "HEAD", |
| 872 | "branch": "HEAD", |
| 873 | "defaultlayers": [ "openembedded-core", "meta-yocto", "meta-yocto-bsp"], |
| 874 | "layersourcepriority": { "Imported layers": 99, "Local Yocto Project" : 10, "OpenEmbedded" : 0 }, |
| 875 | "helptext": "Toaster will run your builds with the version of the Yocto Project you have cloned or downloaded to your computer." |
| 876 | } |
| 877 | ] |
| 878 | </literallayout> |
| 879 | </para> |
| 880 | </section> |
| 881 | </section> |
| 882 | </section> |
| 883 | |
| 884 | <section id='toaster-useful-commands'> |
| 885 | <title>Useful Commands</title> |
| 886 | |
| 887 | <para> |
| 888 | In addition to the web user interface and the scripts that start |
| 889 | and stop Toaster, command-line commands exist through the |
| 890 | <filename>manage.py</filename> management script. |
| 891 | You can find general documentation on |
| 892 | <filename>manage.py</filename> at the |
| 893 | <ulink url='https://docs.djangoproject.com/en/1.7/topics/settings/'>Django</ulink> |
| 894 | site. |
| 895 | However, several <filename>manage.py</filename> commands have been |
| 896 | created that are specific to Toaster and are used to control |
| 897 | configuration and back-end tasks. |
| 898 | You can locate these commands in the |
| 899 | <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink> |
| 900 | (e.g. <filename>poky</filename>) at |
| 901 | <filename>bitbake/lib/manage.py</filename>. |
| 902 | This section documents those commands. |
| 903 | <note> |
| 904 | <para> |
| 905 | When using <filename>manage.py</filename> commands given |
| 906 | a default configuration, you must be sure that your |
| 907 | working directory is set to the |
| 908 | <ulink url='&YOCTO_DOCS_DEV_URL;#build-directory'>Build Directory</ulink>. |
| 909 | Using <filename>manage.py</filename> commands from the |
| 910 | Build Directory allows Toaster to find the |
| 911 | <filename>toaster.sqlite</filename> file, which is located |
| 912 | in the Build Directory. |
| 913 | </para> |
| 914 | |
| 915 | <para> |
| 916 | For non-default database configurations, it is possible |
| 917 | that you can use <filename>manage.py</filename> commands |
| 918 | from a directory other than the Build directory. |
| 919 | To do so, the |
| 920 | <filename>toastermain/settings.py</filename> file must be |
| 921 | configured to point to the correct database backend. |
| 922 | </para> |
| 923 | </note> |
| 924 | </para> |
| 925 | |
| 926 | <section id='toaster-command-buildslist'> |
| 927 | <title><filename>buildslist</filename></title> |
| 928 | |
| 929 | <para> |
| 930 | The <filename>buildslist</filename> command lists all builds |
| 931 | that Toaster has recorded. |
| 932 | Access the command as follows: |
| 933 | <literallayout class='monospaced'> |
| 934 | $ bitbake/lib/toaster/manage.py buildslist |
| 935 | </literallayout> |
| 936 | The command returns a list, which includes numeric |
| 937 | identifications, of the builds that Toaster has recorded in the |
| 938 | current database. |
| 939 | </para> |
| 940 | |
| 941 | <para> |
| 942 | You need to run the <filename>buildslist</filename> command |
| 943 | first to identify existing builds in the database before |
| 944 | using the |
| 945 | <link linkend='toaster-command-builddelete'><filename>builddelete</filename></link> |
| 946 | command. |
| 947 | Here is an example that assumes default repository and build |
| 948 | directory names: |
| 949 | <literallayout class='monospaced'> |
| 950 | $ cd ~/poky/build |
| 951 | $ python ../bitbake/lib/toaster/manage.py buildslist |
| 952 | </literallayout> |
| 953 | If your Toaster database had only one build, the above |
| 954 | <filename>buildslist</filename> command would return something |
| 955 | like the following: |
| 956 | <literallayout class='monospaced'> |
| 957 | 1: qemux86 poky core-image-minimal |
| 958 | </literallayout> |
| 959 | </para> |
| 960 | </section> |
| 961 | |
| 962 | <section id='toaster-command-builddelete'> |
| 963 | <title><filename>builddelete</filename></title> |
| 964 | |
| 965 | <para> |
| 966 | The <filename>builddelete</filename> command deletes data |
| 967 | associated with a build. |
| 968 | Access the command as follows: |
| 969 | <literallayout class='monospaced'> |
| 970 | $ bitbake/lib/toaster/manage.py builddelete <replaceable>build_id</replaceable> |
| 971 | </literallayout> |
| 972 | The command deletes all the build data for the specified |
| 973 | <replaceable>build_id</replaceable>. |
| 974 | This command is useful for removing old and unused data from |
| 975 | the database. |
| 976 | </para> |
| 977 | |
| 978 | <para> |
| 979 | Prior to running the <filename>builddelete</filename> |
| 980 | command, you need to get the ID associated with builds |
| 981 | by using the |
| 982 | <link linkend='toaster-command-buildslist'><filename>buildslist</filename></link> |
| 983 | command. |
| 984 | </para> |
| 985 | </section> |
| 986 | |
| 987 | <section id='toaster-command-perf'> |
| 988 | <title><filename>perf</filename></title> |
| 989 | |
| 990 | <para> |
| 991 | The <filename>perf</filename> command measures Toaster |
| 992 | performance. |
| 993 | Access the command as follows: |
| 994 | <literallayout class='monospaced'> |
| 995 | $ bitbake/lib/toaster/manage.py perf |
| 996 | </literallayout> |
| 997 | The command is a sanity check that returns page loading |
| 998 | times in order to identify performance problems. |
| 999 | </para> |
| 1000 | </section> |
| 1001 | |
| 1002 | <section id='toaster-command-checksettings'> |
| 1003 | <title><filename>checksettings</filename></title> |
| 1004 | |
| 1005 | <para> |
| 1006 | The <filename>checksettings</filename> command verifies |
| 1007 | existing Toaster settings. |
| 1008 | Access the command as follows: |
| 1009 | <literallayout class='monospaced'> |
| 1010 | $ bitbake/lib/toaster/manage.py checksettings |
| 1011 | </literallayout> |
| 1012 | In Build Mode, Toaster uses settings that are based on the |
| 1013 | database to configure the building tasks. |
| 1014 | The <filename>checksettings</filename> command verifies that |
| 1015 | the database settings are valid in the sense that they have |
| 1016 | the minimal information needed to start a build. |
| 1017 | </para> |
| 1018 | |
| 1019 | <para> |
| 1020 | In order for the <filename>checksettings</filename> command |
| 1021 | to work, the database must be correctly set up and not have |
| 1022 | existing data. |
| 1023 | To be sure the database is ready, you can run the following: |
| 1024 | <literallayout class='monospaced'> |
| 1025 | $ bitbake/lib/toaster/manage.py syncdb |
| 1026 | $ bitbake/lib/toaster/manage.py migrate orm |
| 1027 | $ bitbake/lib/toaster/manage.py migrate bldcontrol |
| 1028 | </literallayout> |
| 1029 | After running these commands, you can run the |
| 1030 | <filename>checksettings</filename> command. |
| 1031 | </para> |
| 1032 | </section> |
| 1033 | |
| 1034 | <section id='toaster-command-loadconf'> |
| 1035 | <title><filename>loadconf</filename></title> |
| 1036 | |
| 1037 | <para> |
| 1038 | The <filename>loadconf</filename> command loads an |
| 1039 | existing Toaster configuration file (JSON file). |
| 1040 | You must run this on a new database that does not have any |
| 1041 | data. |
| 1042 | Running this command on an existing database that has data |
| 1043 | results in errors. |
| 1044 | Access the command as follows: |
| 1045 | <literallayout class='monospaced'> |
| 1046 | $ bitbake/lib/toaster/manage.py loadconf <replaceable>filepath</replaceable> |
| 1047 | </literallayout> |
| 1048 | The <filename>loadconf</filename> command configures a database |
| 1049 | based on the supplied existing |
| 1050 | <filename>toasterconf.json</filename> file. |
| 1051 | For information on the <filename>toasterconf.json</filename>, |
| 1052 | see the |
| 1053 | "<link linkend='toaster-json-files'>JSON Files</link>" |
| 1054 | section. |
| 1055 | </para> |
| 1056 | </section> |
| 1057 | |
| 1058 | <section id='toaster-command-runbuilds'> |
| 1059 | <title><filename>runbuilds</filename></title> |
| 1060 | |
| 1061 | <para> |
| 1062 | The <filename>runbuilds</filename> command launches |
| 1063 | scheduled builds. |
| 1064 | Access the command as follows: |
| 1065 | <literallayout class='monospaced'> |
| 1066 | $ bitbake/lib/toaster/manage.py runbuilds |
| 1067 | </literallayout> |
| 1068 | The <filename>runbuilds</filename> command checks if |
| 1069 | scheduled builds exist in the database and then launches them |
| 1070 | per schedule. |
| 1071 | The command returns after the builds start but before they |
| 1072 | complete. |
| 1073 | The Toaster Logging Interface records and updates the database |
| 1074 | when the builds complete. |
| 1075 | </para> |
| 1076 | </section> |
| 1077 | </section> |
| 1078 | </chapter> |