%poky; ] > Setting Up and Using Toaster
Starting Toaster for Local Development Once you have set up the Yocto Project and installed the Toaster system dependencies as described in "Preparing to Use Toaster", you are ready to start Toaster. If you want to configure and start your builds using the Toaster web interface (i.e. "Build Mode"), navigate to the root of your Source Directory (e.g. poky): $ cd poky Next, start Toaster: $ bitbake/bin/toaster Open your favourite browser and enter the following: http://127.0.0.1:8000 If you would rather configure and start your builds using the command line (i.e. Analysis Mode), 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: $ cd poky Once in that directory, source the build environment script: $ source oe-init-build-env Next, from the build directory (e.g. poky/build), start Toaster using this command: $ source ../bitbake/bin/toaster You can now run your builds from the command line, or with Toaster as explained in section "Using the Toaster Web Interface". To access the Toaster web interface, open your favorite browser and enter the following: http://127.0.0.1:8000
Setting a Different Port By default, Toaster starts on port 8000. You can use the WEBPORT parameter to set a different port. For example, either of the following commands sets the port to "8400": $ bitbake/bin/toaster webport=8400 or $ source ../bitbake/bin/toaster webport=8400
The Directory for Cloning Layers If you are running Toaster in Build Mode, Toaster creates a _toaster_clones directory inside your Source Directory (i.e. poky). For example, suppose you use this command to start Toaster: poky/bitbake/bin/toaster In this example, Toaster creates and uses the poky/_toaster_clones directory to clone any layers needed for your builds. 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 TOASTER_DIR environment variable, which takes precedence over your current working directory. Setting this environment variable causes Toaster to create and use $TOASTER_DIR./_toaster_clones.
The Build Directory If you are running Toaster in Build Mode, Toaster creates a build directory within your Source Directory (e.g. poky). For example, suppose you use this command to start Toaster: poky/bitbake/bin/toaster In this example, Toaster creates and uses the poky/build directory to execute the builds. Alternatively, if you would like all of your Toaster related files and directories to be in a particular location, you can set the TOASTER_DIR environment variable, which takes precedence over your current working directory. Setting this environment variable causes Toaster to use $TOASTER_DIR./build as the build directory.
Creating a Django Superuser Toaster is built on the Django framework. Django provides an administration interface you can use to edit Toaster configuration parameters. To access the Django administration interface, you must create a superuser by following these steps: If you used virtualenv, 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: $ source venv/bin/activate From the root of your checkout directory, invoke the following command from manage.py: $ ./bitbake/lib/toaster/manage.py createsuperuser Django prompts you for the username, which you need to provide. Django prompts you for an email address, which is optional. Django prompts you for a password, which you must provide. Django prompts you to re-enter your password for verification. After completing these steps, the following confirmation message appears: Superuser created successfully. 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: http://127.0.0.1:8000/admin 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.
Setting Up a Production Instance of Toaster 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 Build Mode where builds and projects are run, viewed, and defined through the Toaster web interface.
Requirements Be sure you meet the following requirements: You must comply with all Apache, mod-wsgi, and Mysql requirements. Have all the build requirements as described in "Setting Up the Basic System Requirements" chapter. Have an Apache webserver. Have mod-wsgi for the Apache webserver. Use the Mysql database server. If you are using Ubuntu 14.04.3, run the following: $ sudo apt-get install apache2 libapache2-mod-wsgi mysql-server virtualenv libmysqlclient-dev If you are using Fedora 22 or a RedHat distribution, run the following: $ sudo dnf install httpd mod_wsgi python-virtualenv gcc mysql-devel
Installation Perform the following steps to install Toaster: Checkout a copy of poky into the web server directory. You will be using /var/www/toaster: $ mkdir -p /var/www/toaster $ cd /var/www/toaster/ $ git clone git://git.yoctoproject.org/poky $ git checkout &DISTRO_NAME; Initialize a virtual environment and install Toaster dependencies. Using a virtual environment keeps the Python packages isolated from your system-provided packages: $ 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 Isolating these packages is not required but is recommended. Alternatively, you can use your operating system's package manager to install the packages. Configure Toaster by editing /var/www/toaster/poky/bitbake/lib/toaster/toastermain/settings.py as follows: Edit the DATABASE settings: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'toaster_data', 'USER': 'toaster', 'PASSWORD': 'yourpasswordhere', 'HOST': 'localhost', 'PORT': '3306', } Edit the SECRET_KEY: SECRET_KEY = 'your_secret_key' Edit the STATIC_ROOT: STATIC_ROOT = '/var/www/toaster/static_files/' Enable Build Mode by adding the following line to settings.py: BUILD_MODE=True Add the database and user to the mysql server defined earlier: $ 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 Get Toaster to create the database schema, default data, and gather the statically-served files: $ 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 For the above set of commands, after moving to the poky directory, the syncdb command with the migrate option makes sure the database schema has had changes propagated correctly (i.e. migrations). See the syncdb command for more information. The loadconf command loads the ./meta-yocto/conf/toasterconf.json JSON file. The lsupdates command fetches information about machines, recipes and layers available as part of OpenEmbedded. The information is fetched from the OpenEmbedded Metadata Index. 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." Finally, the collectstatic 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 . 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: /etc/apache2/conf-available/toaster.conf If you are using Fedora or RedHat, put it here: /etc/httpd/conf.d/toaster.conf Following is a sample Apache configuration for Toaster you can follow: 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> If you are using Ubuntu or Debian, you will need to enable the config and module for Apache: $ sudo a2enmod wsgi $ sudo a2enconf toaster Finally, restart Apache to make sure all new configuration is loaded. For Ubuntu and Debian use: $ sudo service apache2 restart For Fedora and RedHat use: $ sudo service httpd restart Install the build runner service. This service needs to be running in order to dispatch builds. Use this command: /var/www/toaster/poky/bitbake/lib/toaster/manage.py runbuilds Here is an example: #!/bin/sh # toaster run builds dispatcher cd /var/www/toaster/ source ./venv/bin/activate ./bitbake/lib/toaster/manage.py runbuilds You can now open up a browser and start using Toaster.
Using the Toaster Web Interface The Toaster web interface allows you to do the following: Browse published layers in the OpenEmbedded Metadata Index that are available for your selected version of the build system. Import your own layers for building. Add and remove layers from your configuration. Set configuration variables. Select a target or multiple targets to build. Start your builds. See what was built (recipes and packages) and what packages were installed into your final image. Browse the directory structure of your image. See the value of all variables in your build configuration, and which files set each value. Examine error, warning and trace messages to aid in debugging. See information about the BitBake tasks executed and reused during your build, including those that used shared state. See dependency relationships between recipes, packages and tasks. See performance information such as build time, task time, CPU usage, and disk I/O.
Toaster Web Interface Videos Following are several videos that show how to use the Toaster GUI: Build Configuration: This video overviews and demonstrates build configuration for Toaster. Build Custom Layers: This video shows you how to build custom layers that are used with Toaster. Toaster Homepage and Table Controls: This video 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. Build Dashboard: This video shows you the build dashboard, a page providing an overview of the information available for a selected build. Image Information: This video walks through the information Toaster provides about images: packages installed and root file system. Configuration: This video provides Toaster build configuration information. Tasks: This video shows the information Toaster provides about the tasks run by the build system. Recipes and Packages Built: This video shows the information Toaster provides about recipes and packages built. Performance Data: This video shows the build performance data provided by Toaster.
Building a Specific Recipe Given Multiple Versions Occasionally, a layer might provide more than one version of the same recipe. For example, the openembedded-core layer provides two versions of the bash recipe (i.e. 3.2.48 and 4.3.30-r0) and two versions of the which recipe (i.e. 2.21 and 2.18). The following figure shows this exact scenario: By default, the OpenEmbedded build system builds one of the two recipes. For the bash 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 PREFERRED_VERSION 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: To specify bash 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: After clicking the "Add variable" button, the settings for PREFERRED_VERSION 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: