Preparing for Development
Projects and Targets: Using Image Creator

Introduction
Image Creator uses Projects, Targets, and Functional Sets to organize files and packages.

Moblin Image Creator provides three fundamental features which allow you to:
  • Create a platform-specific build-environment, or "project".
  • Create a platform-specific target file-system, or "target", which can be used for developing and installing applications written specifically for the build-environment.
  • Create images of the target file system for the embedded device.
Users of Image Creator will generally follow these steps:
  1. Create a project.
  2. Add a target to the project.
  3. Install desired fsets on the target.
  4. Add your own code or applications to the target.
  5. Create an image from the target.
  6. Write the image to a USB drive.
    • Live images will allow you to boot from the USB drive, without modifying the mobile device hard drive.
    • Non-live images will erase and replace the mobile device hard drive contents with the contents of the image.
  7. Boot the device off of the image.

If you have not done so already, install Moblin Image Creator.

Running Moblin Image Creator
Moblin Image Creator has both a graphical and command-line user interface. You must be root to run Moblin Image Creator. You can start Moblin Image Creator from the command line, using sudo, or by selecting it from the desktop menu.

To run the Moblin Image Creator UI, you can start the tool with the following command, omitting any arguments:
$ sudo image-creator

You can also run Moblin Image Creator entirely through the command line, by running it with different arguments. To see the available list of command-line arguments, use the following command:
$ sudo image-creator --help

Hint: Moblin Image Creator installs a bash completion configuration file, so if you are using bash, you can press the Tab key. After typing a few letters of a given command line argument, bash will auto-complete (provide you a list of possible completions).

Project Assistant: Creating a Project, Target, and Adding Fsets in One Shot
One of the newest features in the Moblin Image Creator UI is The Project Assistant, which allows you to create a project, add a target to that project, and add fsets to that target, through one dialog.

The Project Assistant can be found by selecting the Project Assistant option from the File menu.

Step 1: Create a Project
The first step is to create a project. Enter values for the name, description, path, and platform parameters.


Figure 2-1: Moblin Image Creator wizard asking for the project name, description, path, and platform.

Parameter descriptions:
Project Name This is the name used to reference the project.
Project Description This is a description of the project, what it's used for, what it will contain, etc.
Project Path This is a full path on your local file-system that specifies where the project's build-environment and file-system are created. You must specify an empty folder, and it is recommended that you have at least one GB of free space.

Note: Later, you can chroot from this file location to develop software for your targets.
Project Platform This is the platform which will determine kernel configuration and device drivers. It should be based on the architecture of the target device on which you wish to install the image.

Menlow and McCaslin are the names of the low power Intel® Architecture (IA) platforms. Existing Intel-processor-based, ultra-mobile systems, such as the Samsung Q1 Ultra*, use the McCaslin platform. The next generation of ultra-mobile systems will use the Menlow platforms.

Once this is complete, select the Forward button.


Step 2: Create a Target and Add fsets
After you create a project, you can use The Project Assistant to add a target to that project and select which fsets you want added to your target. Each target must have a unique name.

Figure 2-2: Moblin Image Creator wizard displaying a list of fsets.

Parameter description:
Name This is the name used to reference the target. This will become a directory located in the <project-location>/targets directory and will contain the file-system for your target. It must be unique.

Depending on your objectives, you can select among the different available fsets. Each fset installs a bundle of related packages. For example, if you would like a full GUI, select the fset that says "full-mobile-stack-with-proprietary" (see note on Adobe Flash* below). If you select an fset that depends on the installation of other fsets, these are automatically selected and installed, as well. For more information about the fsets, click here.

About Adobe Flash* Plug-in
The UI currently uses Adobe Flash. The Flash plug-in is included in the full-mobile-stack-with-proprietary fset. The Flash program is owned and licensed by Adobe Systems Inc. Users wishing to build an image containing the Flash program must agree to a license for Flash. Use, installation, or distribution of a user interface using the Flash program on certain devices may require a separate license from Adobe.

About Wireless Driver
The Samsung Q1 Ultra has an Atheros AR5006X Wireless Network Adapter. The Samsung Q1 Ultra kernel configuration includes the MadWiFi Linux driver for the Atheros chipset. This describes connecting to an access point. Once this is complete, select the Forward button.

Step 3: Review and Apply
Make sure that your configuration is correct, and click the Apply button. Moblin Image Creator will create a project, add a target to the project, and add fsets to the target.

Creating a New Project from the GUI
The GUI also allows you to create a new project without using the Project Assistant, by selecting the Add button in the Platform Projects section. Moblin Image Creator will display a dialog box, asking you to enter the project parameters, described above. You also have the option to add a target to the project.

Adding a New Target from the GUI
By selecting a project in the Platform Projects section, you can see a list of all of the project's targets displayed in the Targets section. You can add more targets to the selected project by selecting the Add button in the Targets section. Moblin Image Creator will display a dialog box asking you to enter the target parameters, described above.

Adding Functional Sets to an Existing Target
You can add fsets to a selected target by selecting the Add Functional Sets button in the Targets section of Moblin Image Creator. Moblin Image Creator will display a dialog box asking you to select among the different available fsets. Each fset installs a bundle of related packages. For example, if you would like a full GUI, select the fset that says, "full-mobile-stack-with-proprietary". If you select a fset that depends on the installation of other fsets, these are automatically selected and installed, as well. For more information about the fsets, click here.



Chrooting into the Project and Target Build Environments and File Systems
If you wish to install, configure, build, or run applications from a chroot into the projects build-environment, you can do so by selecting the Terminal button in either the Targets section or the Platform Projects system. This will launch a chrooted terminal, with the default prompt delineated with a "#".

Note: In the following examples, commands issued from a workstation's terminal will have a bash delineation of "$", and commands issued on a chrooted target or project terminal, will have a bash delineation of "#".

Creating a New Project from the Command Line
You can also create a project by running Moblin Image Creator from the command line, with the following command and arguments. You must specify values for the project parameters, described above.
$ sudo image-creator -c create-project \
--platform-name [platform-name] \
--project-name "<your-project-name>" \
--project-path "<full-path-to-project>" \
--project-description "<your-description>"

The above command extracts the buildroot rootstrap in the /usr/src/myproject directory, and then installs additional, required build packages into that new file-system. You must specify an empty folder where your project's build-environment will be created.

To obtain a list of available platform names, you can run the following command:
$ sudo image-creator -c list-platforms

Once the project is created, you can use Moblin Image Creator to chroot into the new buildroot by using the following command:
$ sudo image-creator -c chroot-project --project-name "[project-name]"

Creating a new Target from the Command Line
You can target a project using the following command and arguments. You must specify an existing project and unique name for the target.
$ sudo image-creator -c create-target \
--project-name "[project-name]" \
--target-name "<your-target-name>"

To obtain a list of the available project names, you can run the following command:
$ sudo image-creator -c list-projects

You can chroot inside the target file-system using:
$ sudo image-creator -c chroot-target \
--project-name "[project-name]" \
--target-name "[target-name]"

Installing Target Feature Sets from the Command Line
You can install fests to a target by using the following command. You must specify an existing project, target, and available fset.
$ sudo image-creator -c install-fset \
--project-name "[project-name]" \
--target-name "[target-name]" \
--fset-name "[fset-name]"

To obtain a list of your available target names, you can run the following command:
$ sudo image-creator -c list-targets --project-name "[project-name]"

To obtain a list of your available fset names, you can run the following command:
$ sudo image-creator -c list-fsets

For example, to install all needed fsets to boot a Samsung* Q1 Ultra and show the current Hildon desktop, you can use "full-mobile-stack" as the value for the "-fset-name" parameter.

Testing Applications from a Target File System
You can test your applications by chrooting into the target file-system and running a virtual X session inside your workstation's existing X session. If Xephyr, a popular tool for running a virtual X session, isn't installed on your target, you must install it.

Installing and Using Xephyr
To install Xephyr, run the following command from your target's terminal:
# apt-get install xserver-xephyr\

To run a virtual X session, you must enable access to your display, by running the following command from your workstation's terminal:
$ xhost +SI:localuser:root

From your target's terminal, run the following commands to configure and run Xephyr:
# export DISPLAY=:0
# /etc/init.d/dbus start
# xinit /etc/X11/xinit/xinitrc -- /usr/bin/Xephyr :2 -host-cursor -screen 1024x600x32 -dpi 96 -ac
# killall gconfd-2

If you have the full-mobile-stack fset installed, you can run a script that automatically installs, configures, and runs Xephyr:
# ume-xephyr-start

Sharing Projects
Moblin Image Creator lets you can share your projects with others. You can compress and save a project by selecting the Save Project option from the File menu. Moblin Image Creator can load a compressed project by selecting the Load Project option from the File menu.

Clearing Rootstraps
Rootstraps are used to create a project by copying certain files, configurations, and environmental variables from your development workstation to the project file-system. You can clear the rootstraps of the selected project by selecting the Clear Rootstraps option from the Tools menu.

Upgrading Projects and Targets
You can upgrade your projects and targets by clicking the Upgrade Project/Target buttons in the Platform Projects or Targets sections. This runs apt-get update and apt-get upgrade from the respective chrooted environment.