Moblin Image Creator is a tool aimed at making life easier for the mobile and embedded developer. The tool is designed to be extremely flexible with platform-specific knowledge isolated to a platform definition. Initial focus is on a new class of devices known as Mobile Internet Devices (MIDs), but the design of Moblin Image Creator is not MID-specific and talk is already underway to add new platform definitions to build consumer electronics stacks, such as TV set-top boxes.
Note: Previously, "Moblin Image Creator" was called "Project Builder", so you may see references to the old name in the documentation and source code.
There are three fundamental features that Moblin Image Creator provides:
- creating a platform-specific build-environment, or "project"
- creating a platform-specific target file-system
- providing user selectable "feature sets" (or fsets) to install bundles of packages that provide some high-level functionality
For more details on projects, targets, fsets, and images, click here.
In addition, there are many other smaller features to simplify your work, such as:
- the choice of a fully functional graphical user interface (GUI) or a purely command line interface
- wrappers for chrooting into a buildroot or target file-system (such as, bind mounting important system directories and copying over network configuration files)
- wrappers for opening Xephyr windows for testing target file-systems
- utilities for creating live USB images of target file-systems, for easy testing of multiple target file-systems
Installation
sudo make install
Running
You must be root to run Moblin Image Creator. You can either start Moblin Image Creator through the desktop menu, in which case, Moblin Image Creator runs automatically as root (after asking for the root password), or you can run Moblin Image Creator from the command-line, using sudo.
Also, Moblin Image Creator can run as a GUI or using the command line. To run the GUI, start Moblin Image Creator with no command line arguments:
$ sudo image-creator
To see the available list of command-line arguments:
$ 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.)
Creating a new project from the command line
$ sudo image-creator -c create-project \
--platform-name mccaslin \
--project-name "MyProject" \
--project-path "/usr/src/myproject" \
--project-description "My Samsung Q1 Ultra project"
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.
Once the project is created, you can use Moblin Image Creator to chroot into the new buildroot using:
$ sudo image-creator -c chroot-project --project-name "MyProject"
Creating a new target from the command line
$ sudo image-creator -c create-target \
--project-name "MyProject" \
--target-name "target1"
Multiple target file systems can be created from a single project. The above command will generate a new target file-system inside the buildroot at BUILDROOT/targets/target1/fs/. You can chroot inside the target file-system using:
$ sudo image-creator -c chroot-target \
--project-name "MyProject" \
--target-name "target1"
Installing target feature sets from the command line
In Moblin Image Creator, the platform defines bundles of packages as an fset, where fsets can have dependencies on other fsets, and installing an fset will automatically install dependent fsets.
After installing Moblin Image Creator, you can see an example of an fset configuration file by looking at: /usr/share/sdk/platforms/mccaslin/fsets/base.fset
<snip>
[Core]
DESC=Fundamental fset that provides a root filesystem
PKGS=linux-image-386
DEBUG_PKGS=gdb man-db manpages
DEPS=
[Hildon-Application-Framework]
DESC=Hildon Application Framework for enabling Mobile Applications
PKGS=ubuntu-mobile sdk-default-icons
DEBUG_PKGS=
DEPS=core
</snip>
To install all needed fsets to boot a Samsung Q1 Ultra* and show the current Hildon desktop, run:
$ sudo image-creator -c install-fset \
--project-name MyProject \
--target-name target1 \
--fset-name "full-mobile-stack"
Creating a live USB image of the new target filesystem from the command-line
$ sudo image-creator -c create-live-usb \
--project-name MyProject \
--target-name target1 \
--image-name live-usb.img
These image files need to be directly written to a USB key, using a tool like dd. For example:
$ sudo dd if=/usr/src/myproject/targets/target1/image/live-usb.img \
of=/dev/sdb
WARNING: The above command is only an example! You must determine what the correct device node is for your system. If you run this command with your HD device file, you will trash your installation.
Testing applications from a target filesystem
There a few options for running a virtual target X session inside your existing X session, running on your workstation. One popular tool for doing this is called Xephyr.
Enable access to the display on your Feisty or Gutsy workstation (outside the target)
$ xhost +
Inside your target, launch the UI inside Xephyr window
(inside target terminal)
# apt-get install xserver-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
This opens a new window that is 1024x600 in size and has access controls turned off. Any application on your workstation can display inside this window (as if the window were a new display) by setting the environment variable DISPLAY to ":2":
$ export DISPLAY=:2
To run applications from the target file-system, you must first chroot into the target, then set the DISPLAY, and run the application.
$ sudo image-creator -c chroot-target \
--project-name MyProject \
--target-name target1
# export DISPLAY=:2
# run-my-application
Getting the source
The Moblin Image Creator source is contained in a git source repository. You can either view the source online at:
http://git.moblin.org/cgit.cgi/moblin-image-creator
Or you can clone the git tree using:
$ git clone git://git.moblin.org/moblin-image-creator
NOTE: To install git from Ubuntu, run "sudo apt-get install git-core".FAQ
Q: Why bother with buildroot environment? Why can't I just install Ubuntu Gutsy* and build my mobile apps directly on my workstation?
A: Using a buildroot allows you to isolate the build machine dependencies from that of the host workstation (or build server). Today, all MID work is focused on Gutsy, so using Gutsy on your workstation and then installing all the needed build dependencies will work. However, one of the goals of Moblin Image Creator is to provide a build-environment that continues to work for a given product long after the product's base distribution becomes obsolete.
Q: To use Moblin Image Creator, do I have to install Ubuntu on my workstation?
A: No. When running Ubuntu (or any Debian* derivative distro), it is possible to generate RPM packages that work on various RPM-based distributions. While building Moblin Image Creator is not supported on a non-debian system, there will be a few pre-built RPMs available on the project download page.
The list of available RPM packages will change over time (depending on demand).
Q: Why is Moblin Image Creator dependent on debian packaging? Why not use RPMs?
A: Initial prototyping was actually based on Fedora* RPMs, using yum to auto-resolve dependencies in the same way we use apt today. From day one, yum has proven itself to be less than ideal for the way we wanted to use it, while at the same time, the number of base Fedora packages that we needed to touch were quickly taking us to the point of maintaining a full distribution.
By moving Moblin Image Creator to a debian package/apt-based implementation and joining the Ubuntu-Mobile team, we benefited from the richer set of debian technologies, while, at the same time, pushing all of our distribution requirements into the upcoming Ubuntu Gutsy repository.
Q: How does cross-compiling work?
A: Because the initial targets for Moblin Image Creator are all x86-based, we can simplify the build by just using the native compiler either installed in the buildroot or installed on the host workstation (if the workstation is running the same base as the target).
Regardless of this, one of the advantages of making Moblin Image Creator debian-based is that there is a rich set of cross-compiling packages for just about any architecture. There shouldn't be any problem creating a new platform definition that pulls from an apt database of packages built for the target architecture, and that build additional packages using existing cross-compiling technologies.


