Preparing for Development
Creating an Image for a Target Device

Introduction
Moblin Image Creator is a tool you can use to create an image of a target environment. You can use the image to develop on a platform or architecture that is different than your current development system. You can copy the image to an actual device so that your applications can be tested and distributed. The tool is extremely flexible with platform-specific knowledge isolated to each platform definition. By selecting a platform architecture, you can create a platform-specific build-environment, or "project." For any project, you can create a number of individual target file-systems, or "targets," and add to the targets bundles of related packages that provide a certain high-level functionality, called "functional sets" (fsets). You can create images of the targets, which can be copied to a mobile device.

Users of Image Creator 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 allows you to boot from the USB drive, without modifying the mobile device hard drive.
    • Non-live images erase and replace the mobile device hard drive contents with the contents of the image.
  7. Boot the device off of the image.
This guide walks you through the process of creating a working image for your mobile device. We assume that you already have Moblin Image Creator installed and you have created a target. Running this image on a device boots the Linux kernel, loads the appropriate drivers, starts X, shows the UI, and allows you to launch applications.

Supported Devices
Image Creator currently allows you to create an image for a Samsung Q1 Ultra*. However, you don't need to have this device to develop applications. For application or driver development, or to simply test run the UI, you can run everything using Xephyr ( a virtual X session) on your Linux workstation. Instructions for installing and running Xephyr are described here.

Update Your Image on the Workstation
Before creating an image, you may want to update or configure your target. You can do this easily on the workstation by chrooting into the target file-system:
  1. Select a project in the Platform Projects section.
  2. Select a target in the Targets section.
  3. Select the Terminal button in the Targets section (a new terminal is started, chrooted into the target file-system).
  4. Modify the target system as desired. Add packages (apt-get install [pkg]), add media content, or change configuration settings.
About Media Codecs and Media Content
The default video, audio, and photo viewer is called "mobile player" and can use Gstreamer* and Helix* engines. By default, only the open source gstreamer packages are included. To add support for additional media formats, you may wish to install additional gstreamer codec packages. To do this, you must first add a restricted repository to your target's apt sources list. You can easily do this by running the following command from your target's terminal:
# echo `cat /etc/apt/sources.list` "restricted" > /etc/apt/sources.list

If you're behind a firewall, this file /etc/apt/sources.list should look like this:
deb http://archive.ubuntu.com/ubuntu gutsy main restricted


To install a specific gstreamer codec package, run the following command from the target's terminal:
# export http_proxy="http://<proxy>:<port>"
# apt-get update
# apt-get install <gstreamer-codec-pkg>

If you would like all gstreamer codecs, use:
# apt-get install gstreamer0.10-*

The following table shows the supported formats and their corresponding packages.

Media format Required package(s)
Audio
OggVorbis gstreamer0.10-plugins-base
WAV, AU gstreamer0.10-plugins-good
MP3 gstreamer0.10-plugins-ugly
aac/aac+ gstreamer0.10-plugins-bad-multiverse
AC3 gstreamer0.10-ffmpeg
WMA gstreamer0.10-ffmpeg, gstreamer0.10-plugins-ugly
Video
OggTheora gstreamer0.10-plugins-base
H.263 gstreamer0.10-ffmpeg, gstreamer0.10-plugins-good
motionJPEG gstreamer0.10-plugins-good
MPEG1/2 gstreamer0.10-ffmpeg, gstreamer0.10-plugins-ugly
MPEG4 gstreamer0.10-ffmpeg, gstreamer0.10-plugins-ugly
WMV gstreamer0.10-ffmpeg, gstreamer0.10-plugins-ugly
Splitter
3GP/MP4 gstreamer0.10-ffmpeg, gstreamer0.10-plugins-good
AVI gstreamer0.10-ffmpeg, gstreamer0.10-plugins-good
ASF gstreamer0.10-ffmpeg, gstreamer0.10-plugins-ugly
MPEG2 gstreamer0.10-ffmpeg, gstreamer0.10-plugins-ugly

Test the Target Image UI on the Workstation
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.

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

Create an Image (Live or Installable)
You can create images of your targets and write them to a USB drive. There are two kinds of images that Moblin Image Creator creates: live and installable. Live images allow you to boot directly from the USB drive, without modifying the mobile device's hard drive. An installable image will erase the contents of the mobile device's hard drive and replace it with the contents of the image.

To create the type of image you want and write it to your USB drive:

  1. Select a project in the Platform Projects sections.
  2. Select a target in the Targets section.
  3. Select the appropriate button to create the image:
    • To create a live image, select the Live USB button in the Targets Images section.
    • To create an installable image, select the Install USB button in the Targets Images section.
  4. With a USB drive Inserted in your workstation, select the Write USB Image button to burn the image to the drive.
  5. Warning: The contents of the USB drive will be completely replaced by the image.

Write an Image from the File System
If you have an image located on your workstation's file-system, but you haven't created it through Moblin Image Creator, you can still use Moblin Image Creator to write the image to a USB drive. To do this, select Write USB Image from the Tools menu. Moblin Image Creator displays a dialog box that allows you to browse your workstation's file-system for an .img file. Then it locates your USB drive and safely writes the image for you.

Load and Run an Image on the Platform In this section, we'll briefly discuss how to load, run, and install a Moblin image on your target device.

Live vs. Installable Images
Warning: Non-live images will wipe out your target system hard drive. Before you start this task, be sure you know if you created a live or an installable image.

  1. Insert a USB drive into the USB port on your mobile device.
  2. Plug in a keyboard, if necessary.
  3. Boot to the BIOS. This usually means pressing F2 repeatedly during the initial 2-3 seconds.
  4. Move the USB pen drive to first place in the boot order (Look for USB HDD).
  5. Press F10, save, and reboot.
  6. When the system reboots, wait for the boot prompt. Press Enter.
    Note: This process takes approximately 5 minutes.
When the system reboots, you will boot into the UI.

Connect Wirelessly with Samsung Q1 Ultra*
The Samsung Q1 Ultra kernel configuration includes the MadWiFi driver for the Atheros chipset. To connect to an access point, boot the device from the image, and then perform the following steps in an X terminal window (xterm). Note: To open an xterm, scroll all the way to the left on the ho+me screen and click the XTerm icon.

First, you can check if the WiFi is turned on, by running:
# iwconfig

Next, bring up the wireless interface and scan for access points:
# ifconfig ath0 up
# iwlist ath0 scan

Connect to the desired access point and get an IP address using DHCP:
# iwconfig ath0 essid [access-point]
# dhclient

You should be able to connect to the network now.