123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648 |
- <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
- [<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
- <chapter id='toaster-manual-setup-and-use'>
- <title>Setting Up and Using Toaster</title>
- <section id='starting-toaster-for-local-development'>
- <title>Starting Toaster for Local Development</title>
- <para>
- Once you have set up the Yocto Project and installed the
- Toaster system dependencies as described in
- "<link linkend='toaster-manual-start'>Preparing to Use Toaster</link>",
- you are ready to start Toaster.
- </para>
- <para>
- If you want to configure and start your builds using the
- Toaster web interface
- (i.e. "<link linkend='toaster-build-mode'>Build Mode</link>"),
- navigate to the root of your
- <ulink url='&YOCTO_DOCS_DEV_URL;#source-directory'>Source Directory</ulink>
- (e.g. <filename>poky</filename>):
- <literallayout class='monospaced'>
- $ cd poky
- </literallayout>
- Next, start Toaster:
- <literallayout class='monospaced'>
- $ bitbake/bin/toaster
- </literallayout>
- Open your favourite browser and enter the following:
- <literallayout class='monospaced'>
- http://127.0.0.1:8000
- </literallayout>
- If you would rather configure and start your builds
- using the command line
- (i.e. <link linkend='toaster-analysis-mode'>Analysis Mode</link>),
- you can get Toaster to "listen"
- to your builds and collect information about them.
- To do that, navigate to the root of your Source Directory:
- <literallayout class='monospaced'>
- $ cd poky
- </literallayout>
- Once in that directory, source the build environment script:
- <literallayout class='monospaced'>
- $ source oe-init-build-env
- </literallayout>
- Next, from the build directory (e.g.
- <filename>poky/build</filename>), start Toaster using this
- command:
- <literallayout class='monospaced'>
- $ source ../bitbake/bin/toaster
- </literallayout>
- You can now run your builds from the command line, or with
- Toaster as explained in section
- "<link linkend='using-the-toaster-web-interface'>Using the Toaster Web Interface</link>".
- </para>
- <para>
- To access the Toaster web interface, open your favorite
- browser and enter the following:
- <literallayout class='monospaced'>
- http://127.0.0.1:8000
- </literallayout>
- </para>
- </section>
- <section id='setting-a-different-port'>
- <title>Setting a Different Port</title>
- <para>
- By default, Toaster starts on port 8000.
- You can use the <filename>WEBPORT</filename> parameter to
- set a different port.
- For example, either of the following commands sets the
- port to "8400":
- <literallayout class='monospaced'>
- $ bitbake/bin/toaster webport=8400
- </literallayout>
- or
- <literallayout class='monospaced'>
- $ source ../bitbake/bin/toaster webport=8400
- </literallayout>
- </para>
- </section>
- <section id='the-directory-for-cloning-layers'>
- <title>The Directory for Cloning Layers</title>
- <para>
- If you are running Toaster in
- <link linkend='toaster-build-mode'>Build Mode</link>,
- Toaster creates a <filename>_toaster_clones</filename>
- directory inside your Source Directory
- (i.e. <filename>poky</filename>).
- For example, suppose you use this command to start Toaster:
- <literallayout class='monospaced'>
- poky/bitbake/bin/toaster
- </literallayout>
- In this example, Toaster creates and uses the
- <filename>poky/_toaster_clones</filename>
- directory to clone any layers needed for your builds.
- </para>
- <para>
- Alternatively, if you would like all of your Toaster related
- files and directories to be in a particular location other than
- the default, you can set the <filename>TOASTER_DIR</filename>
- environment variable, which takes precedence over your current
- working directory.
- Setting this environment variable causes Toaster to create and use
- <filename>$TOASTER_DIR./_toaster_clones</filename>.
- </para>
- </section>
- <section id='toaster-the-build-directory'>
- <title>The Build Directory</title>
- <para>
- If you are running Toaster in
- <link linkend='toaster-build-mode'>Build Mode</link>,
- Toaster creates a build directory within your Source
- Directory (e.g. <filename>poky</filename>).
- For example, suppose you use this command to start Toaster:
- <literallayout class='monospaced'>
- poky/bitbake/bin/toaster
- </literallayout>
- In this example, Toaster creates and uses the
- <filename>poky/build</filename>
- directory to execute the builds.
- </para>
- <para>
- Alternatively, if you would like all of your Toaster related files
- and directories to be in a particular location, you can set
- the <filename>TOASTER_DIR</filename> environment variable,
- which takes precedence over your current working directory.
- Setting this environment variable causes Toaster to use
- <filename>$TOASTER_DIR./build</filename> as the build directory.
- </para>
- </section>
- <section id='toaster-creating-a-django-super-user'>
- <title>Creating a Django Superuser</title>
- <para>
- Toaster is built on the
- <ulink url='https://www.djangoproject.com/'>Django framework</ulink>.
- Django provides an administration interface you can use
- to edit Toaster configuration parameters.
- </para>
- <para>
- To access the Django administration interface, you must
- create a superuser by following these steps:
- <orderedlist>
- <listitem><para>
- If you used <filename>virtualenv</filename>, which is
- recommended, to set up the Toaster system dependencies,
- you need be sure the virtual environment is activated.
- To activate this environment, use the following:
- <literallayout class='monospaced'>
- $ source venv/bin/activate
- </literallayout>
- </para></listitem>
- <listitem><para>
- From the root of your checkout directory, invoke the
- following command from <filename>manage.py</filename>:
- <literallayout class='monospaced'>
- $ ./bitbake/lib/toaster/manage.py createsuperuser
- </literallayout>
- </para></listitem>
- <listitem><para>
- Django prompts you for the username, which you need to
- provide.
- </para></listitem>
- <listitem><para>
- Django prompts you for an email address, which is
- optional.
- </para></listitem>
- <listitem><para>
- Django prompts you for a password, which you must provide.
- </para></listitem>
- <listitem><para>
- Django prompts you to re-enter your password for verification.
- </para></listitem>
- </orderedlist>
- After completing these steps, the following confirmation message
- appears:
- <literallayout class='monospaced'>
- Superuser created successfully.
- </literallayout>
- </para>
- <para>
- Creating a superuser allows you to access the Django administration
- interface through a browser.
- The URL for this interface is the same as the URL used for the
- Toaster instance with "/admin" on the end.
- For example, if you are running Toaster locally, use the
- following URL:
- <literallayout class='monospaced'>
- http://127.0.0.1:8000/admin
- </literallayout>
- You can use the Django administration interface to set Toaster
- configuration parameters such as the build directory, layer sources,
- default variable values, and BitBake versions.
- </para>
- </section>
- <section id='toaster-setting-up-a-production-instance-of-toaster'>
- <title>Setting Up a Production Instance of Toaster</title>
- <para>
- You can use a production instance of Toaster to share the
- Toaster instance with remote users, multiple users, or both.
- The production instance is also the setup that can cope with
- heavier loads on the web service.
- Use the instructions in the following sections to set up
- Toaster in
- <link linkend='toaster-build-mode'>Build Mode</link>
- where builds and projects are run,
- viewed, and defined through the Toaster web interface.
- </para>
- <section id='toaster-production-instance-requirements'>
- <title>Requirements</title>
- <para>
- Be sure you meet the following requirements:
- <note>
- You must comply with all Apache,
- <filename>mod-wsgi</filename>, and Mysql requirements.
- </note>
- <itemizedlist>
- <listitem><para>
- Have all the build requirements as described in
- "<link linkend='toaster-setting-up-the-basic-system-requirements'>Setting Up the Basic System Requirements</link>"
- chapter.
- </para></listitem>
- <listitem><para>
- Have an Apache webserver.
- </para></listitem>
- <listitem><para>
- Have <filename>mod-wsgi</filename> for the Apache
- webserver.
- </para></listitem>
- <listitem><para>
- Use the Mysql database server.
- </para></listitem>
- <listitem><para>
- If you are using Ubuntu 14.04.3, run the following:
- <literallayout class='monospaced'>
- $ sudo apt-get install apache2 libapache2-mod-wsgi mysql-server virtualenv libmysqlclient-dev
- </literallayout>
- </para></listitem>
- <listitem><para>
- If you are using Fedora 22 or a RedHat distribution, run
- the following:
- <literallayout class='monospaced'>
- $ sudo dnf install httpd mod_wsgi python-virtualenv gcc mysql-devel
- </literallayout>
- </para></listitem>
- </itemizedlist>
- </para>
- </section>
- <section id='toaster-installation-steps'>
- <title>Installation</title>
- <para>
- Perform the following steps to install Toaster:
- <orderedlist>
- <listitem><para>
- Checkout a copy of <filename>poky</filename>
- into the web server directory.
- You will be using <filename>/var/www/toaster</filename>:
- <literallayout class='monospaced'>
- $ mkdir -p /var/www/toaster
- $ cd /var/www/toaster/
- $ git clone git://git.yoctoproject.org/poky
- $ git checkout &DISTRO_NAME;
- </literallayout>
- </para></listitem>
- <listitem><para>
- Initialize a virtual environment and install Toaster
- dependencies.
- Using a virtual environment keeps the Python packages
- isolated from your system-provided packages:
- <literallayout class='monospaced'>
- $ cd /var/www/toaster/
- $ virtualenv venv
- $ source ./venv/bin/activate
- $ pip install -r ./poky/bitbake/toaster-requirements.txt
- $ pip install mysql
- $ pip install MySQL-python
- </literallayout>
- <note>
- Isolating these packages is not required but is
- recommended.
- Alternatively, you can use your operating system's
- package manager to install the packages.
- </note>
- </para></listitem>
- <listitem><para>
- Configure Toaster by editing
- <filename>/var/www/toaster/poky/bitbake/lib/toaster/toastermain/settings.py</filename>
- as follows:
- <itemizedlist>
- <listitem><para>
- Edit the <filename>DATABASE</filename> settings:
- <literallayout class='monospaced'>
- DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.mysql',
- 'NAME': 'toaster_data',
- 'USER': 'toaster',
- 'PASSWORD': 'yourpasswordhere',
- 'HOST': 'localhost',
- 'PORT': '3306',
- }
- </literallayout>
- </para></listitem>
- <listitem><para>
- Edit the <filename>SECRET_KEY</filename>:
- <literallayout class='monospaced'>
- SECRET_KEY = '<replaceable>your_secret_key</replaceable>'
- </literallayout>
- </para></listitem>
- <listitem><para>
- Edit the <filename>STATIC_ROOT</filename>:
- <literallayout class='monospaced'>
- STATIC_ROOT = '/var/www/toaster/static_files/'
- </literallayout>
- </para></listitem>
- <listitem><para>
- Enable Build Mode by adding the following
- line to <filename>settings.py</filename>:
- <literallayout class='monospaced'>
- BUILD_MODE=True
- </literallayout>
- </para></listitem>
- </itemizedlist>
- </para></listitem>
- <listitem><para>
- Add the database and user to the <filename>mysql</filename>
- server defined earlier:
- <literallayout class='monospaced'>
- $ mysql -u root -p
- mysql> CREATE DATABASE toaster;
- mysql> CREATE USER 'toaster'@'localhost' identified by 'yourpasswordhere';
- mysql> GRANT all on toaster_data.* to 'toaster'@'localhost';
- mysql> quit
- </literallayout>
- </para></listitem>
- <listitem><para>
- Get Toaster to create the database schema,
- default data, and gather the statically-served files:
- <literallayout class='monospaced'>
- $ cd /var/www/toaster/poky/
- $ ./bitbake/lib/toaster/manage.py syncdb --migrate
- $ ./bitbake/lib/toaster/manage.py loadconf ./meta-yocto/conf/toasterconf.json
- $ ./bitbake/lib/toaster/manage.py lsupdates
- $ ./bitbake/lib/toaster/manage.py collectstatic
- </literallayout>
- </para>
- <para>
- For the above set of commands, after moving to the
- <filename>poky</filename> directory,
- the <filename>syncdb</filename> command with the
- <filename>migrate</filename> option makes sure the database
- schema has had changes propagated correctly (i.e.
- migrations).
- See the
- <ulink url='https://south.readthedocs.org/en/latest/commands.html#syncdb'><filename>syncdb</filename></ulink>
- command for more information.
- </para>
- <para>
- The
- <link linkend='toaster-command-loadconf'><filename>loadconf</filename></link>
- command loads the
- <filename>./meta-yocto/conf/toasterconf.json</filename>
- JSON file.
- </para>
- <para>
- The <filename>lsupdates</filename> command fetches
- information about machines, recipes and
- layers available as part of OpenEmbedded.
- The information is fetched from the
- <ulink url='http://layers.openembedded.org/'>OpenEmbedded Metadata Index</ulink>.
- This information provides easy access to metadata
- from Toaster, and it is key for Toaster's usability.
- It is not recommended that you use Toaster without
- fetching this information."
- </para>
- <para>
- Finally, the <filename>collectstatic</filename> command
- is a Django framework command that collects all the
- statically served files into a designated directory to
- be served up by the Apache web server.
- For more information on this Django command, see
- <ulink url='https://docs.djangoproject.com/en/1.7/ref/contrib/staticfiles/'></ulink>.
- </para></listitem>
- <listitem><para>
- Add an Apache configuration file for Toaster to your Apache web
- server's configuration directory.
- If you are using Ubuntu or Debian, put the file here:
- <literallayout class='monospaced'>
- /etc/apache2/conf-available/toaster.conf
- </literallayout>
- If you are using Fedora or RedHat, put it here:
- <literallayout class='monospaced'>
- /etc/httpd/conf.d/toaster.conf
- </literallayout>
- Following is a sample Apache configuration for Toaster
- you can follow:
- <literallayout class='monospaced'>
- Alias /static /var/www/toaster/static_files
- <Directory /var/www/toaster/static_files>
- Order allow,deny
- Allow from all
- Require all granted
- </Directory>
- WSGIDaemonProcess toaster_wsgi python-path=/var/www/toaster/poky/bitbake/lib/toaster:/var/www/toaster/venv/lib/python2.7/site-packages
- WSGIScriptAlias / "/var/www/toaster/poky/bitbake/lib/toaster/toastermain/wsgi.py"
- <Location />
- WSGIProcessGroup toastern_wsgi
- </Location>
- </literallayout>
- If you are using Ubuntu or Debian,
- you will need to enable the config and module for Apache:
- <literallayout class='monospaced'>
- $ sudo a2enmod wsgi
- $ sudo a2enconf toaster
- </literallayout>
- Finally, restart Apache to make sure all new configuration
- is loaded.
- For Ubuntu and Debian use:
- <literallayout class='monospaced'>
- $ sudo service apache2 restart
- </literallayout>
- For Fedora and RedHat use:
- <literallayout class='monospaced'>
- $ sudo service httpd restart
- </literallayout>
- </para></listitem>
- <listitem><para>
- Install the build runner service.
- This service needs to be running in order to dispatch
- builds.
- Use this command:
- <literallayout class='monospaced'>
- /var/www/toaster/poky/bitbake/lib/toaster/manage.py runbuilds
- </literallayout>
- Here is an example:
- <literallayout class='monospaced'>
- #!/bin/sh
- # toaster run builds dispatcher
- cd /var/www/toaster/
- source ./venv/bin/activate
- ./bitbake/lib/toaster/manage.py runbuilds
- </literallayout>
- </para></listitem>
- </orderedlist>
- You can now open up a browser and start using Toaster.
- </para>
- </section>
- </section>
- <section id='using-the-toaster-web-interface'>
- <title>Using the Toaster Web Interface</title>
- <para>
- The Toaster web interface allows you to do the following:
- <itemizedlist>
- <listitem><para>
- Browse published layers in the
- <ulink url='http://layers.openembedded.org'>OpenEmbedded Metadata Index</ulink>
- that are available for your selected version of the build
- system.
- </para></listitem>
- <listitem><para>
- Import your own layers for building.
- </para></listitem>
- <listitem><para>
- Add and remove layers from your configuration.
- </para></listitem>
- <listitem><para>
- Set configuration variables.
- </para></listitem>
- <listitem><para>
- Select a target or multiple targets to build.
- </para></listitem>
- <listitem><para>
- Start your builds.
- </para></listitem>
- <listitem><para>
- See what was built (recipes and packages) and what
- packages were installed into your final image.
- </para></listitem>
- <listitem><para>
- Browse the directory structure of your image.
- </para></listitem>
- <listitem><para>
- See the value of all variables in your build configuration,
- and which files set each value.
- </para></listitem>
- <listitem><para>
- Examine error, warning and trace messages to aid in
- debugging.
- </para></listitem>
- <listitem><para>
- See information about the BitBake tasks executed and
- reused during your build, including those that used
- shared state.
- </para></listitem>
- <listitem><para>
- See dependency relationships between recipes, packages
- and tasks.
- </para></listitem>
- <listitem><para>
- See performance information such as build time, task time,
- CPU usage, and disk I/O.
- </para></listitem>
- </itemizedlist>
- </para>
- <section id='web-interface-videos'>
- <title>Toaster Web Interface Videos</title>
- <para>
- Following are several videos that show how to use the Toaster GUI:
- <itemizedlist>
- <listitem><para><emphasis>Build Configuration:</emphasis>
- This
- <ulink url='https://www.youtube.com/watch?v=qYgDZ8YzV6w'>video</ulink>
- overviews and demonstrates build configuration for Toaster.
- </para></listitem>
- <listitem><para><emphasis>Build Custom Layers:</emphasis>
- This
- <ulink url='https://www.youtube.com/watch?v=QJzaE_XjX5c'>video</ulink>
- shows you how to build custom layers that are used with
- Toaster.
- </para></listitem>
- <listitem><para><emphasis>Toaster Homepage and Table Controls:</emphasis>
- This
- <ulink url='https://www.youtube.com/watch?v=QEARDnrR1Xw'>video</ulink>
- goes over the Toaster entry page, and provides
- an overview of the data manipulation capabilities of
- Toaster, which include search, sorting and filtering by
- different criteria.
- </para></listitem>
- <listitem><para><emphasis>Build Dashboard:</emphasis>
- This
- <ulink url='https://www.youtube.com/watch?v=KKqHYcnp2gE'>video</ulink>
- shows you the build dashboard, a page providing an
- overview of the information available for a selected build.
- </para></listitem>
- <listitem><para><emphasis>Image Information:</emphasis>
- This
- <ulink url='https://www.youtube.com/watch?v=XqYGFsmA0Rw'>video</ulink>
- walks through the information Toaster provides
- about images: packages installed and root file system.
- </para></listitem>
- <listitem><para><emphasis>Configuration:</emphasis>
- This
- <ulink url='https://www.youtube.com/watch?v=UW-j-T2TzIg'>video</ulink>
- provides Toaster build configuration information.
- </para></listitem>
- <listitem><para><emphasis>Tasks:</emphasis>
- This
- <ulink url='https://www.youtube.com/watch?v=D4-9vGSxQtw'>video</ulink>
- shows the information Toaster provides about the
- tasks run by the build system.
- </para></listitem>
- <listitem><para><emphasis>Recipes and Packages Built:</emphasis>
- This
- <ulink url='https://www.youtube.com/watch?v=x-6dx4huNnw'>video</ulink>
- shows the information Toaster provides about recipes
- and packages built.
- </para></listitem>
- <listitem><para><emphasis>Performance Data:</emphasis>
- This
- <ulink url='https://www.youtube.com/watch?v=qWGMrJoqusQ'>video</ulink>
- shows the build performance data provided by
- Toaster.
- </para></listitem>
- </itemizedlist>
- </para>
- </section>
- <section id='toaster-web-interface-preferred-version'>
- <title>Building a Specific Recipe Given Multiple Versions</title>
- <para>
- Occasionally, a layer might provide more than one version of
- the same recipe.
- For example, the <filename>openembedded-core</filename> layer
- provides two versions of the <filename>bash</filename> recipe
- (i.e. 3.2.48 and 4.3.30-r0) and two versions of the
- <filename>which</filename> recipe (i.e. 2.21 and 2.18).
- The following figure shows this exact scenario:
- <imagedata fileref="figures/bash-oecore.png" align="center" width="9in" depth="6in" />
- </para>
- <para>
- By default, the OpenEmbedded build system builds one of the
- two recipes.
- For the <filename>bash</filename> case, version 4.3.30-r0 is
- built by default.
- Unfortunately, Toaster as it exists, is not able to override
- the default recipe version.
- If you would like to build bash 3.2.48, you need to set the
- <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_VERSION'><filename>PREFERRED_VERSION</filename></ulink>
- variable.
- You can do so from Toaster, using the "Add variable" form,
- which is available in the "BitBake variables" page of the
- project configuration section as shown in the following screen:
- <imagedata fileref="figures/add-variable.png" align="center" width="9in" depth="6in" />
- </para>
- <para>
- To specify <filename>bash</filename> 3.2.48 as the version to build,
- enter "PREFERRED_VERSION_bash" in the "Variable" field, and "3.2.48"
- in the "Value" field.
- Next, click the "Add variable" button:
- <imagedata fileref="figures/set-variable.png" align="center" width="9in" depth="6in" />
- </para>
- <para>
- After clicking the "Add variable" button, the settings for
- <filename>PREFERRED_VERSION</filename> are added to the bottom
- of the BitBake variables list.
- With these settings, the OpenEmbedded build system builds the
- desired version of the recipe rather than the default version:
- <imagedata fileref="figures/variable-added.png" align="center" width="9in" depth="6in" />
- </para>
- </section>
- </section>
- </chapter>
|