The development process for a mobile device tends to be different from the normal process used for workstation/laptops/servers, where the developer would not normally use the mobile device for their development environment, and where there is need to generate a complete OS image from the developers working environment that is then installed on the target device.
In the case of the Ubuntu Mobile project, a complete set of built packages is available to the developer, so a lot of the complexities associated with existing build-your-own-os-from-scratch project are just not needed. To bridge the remaining gap between Ubuntu-Mobile development we use a new tool called project-builder
Features
There are three fundamental features that project-builder provides:
The creation of a platform specific build environment
The creation of platform specific target file-systems
A user selectable "feature sets" (or fsets) to install bundles of packages that provide some high-level functionality
It also offers some additional advantages such as:
The choice of a fully functional graphical user interface or a purely command line interface
Wrappers for chrooting into a buildroot or target file-system(i.e. 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
Developer uses project-builder to start a new project
Here we assume that:
The project is configured to work with a mccaslin type of device
The project is given a name 'myproject' for future reference
The project is given a description of "My Samsung Q1 Ultra project"
The project creates a complete buildroot in /usr/src/myproject
$ sudo project-builder -c create-project \ --platform-name mccaslin \ --project-name "myproject" \ --project-path "/usr/src/myproject" \ --project-description "My Samsung Q1 Ultra project"
Developer uses project-builder to create a new target filesystem
Developer creates a new initial target device filesystem:
Since a project can create multiple target filesystems, the target is named 'target1'
The new target filesystem is rooted at /usr/src/myproject/targets/target1/fs
$ sudo project-builder -c create-target \ --project-name "myproject" \ --target-name "target1"
Developer installs the Ubuntu-Mobile default set of packages for a full UI
Developer installs the "full-mobile-stack" functional set (fset)
The "full-mobile-stack" is a meta fset that depends on the Core, Infrastructure, GNOME-Mobile, Mobile-Applications, and Power-Management fsets
After installing this fset, the target filesystem has enough functionality such that once installed on the target device, the device can boot to the ubuntu-mobile installation and automatically startup into the hildon desktop with the standard set of ubuntu-mobile applications
$ sudo project-builder -c install-fset \ --project-name myproject \ --target-name target1 \ --fset-name "full-mobile-stack"
Developer tweaks the target filesystem as desired
The developer has the choice of building new mobile software from the project buildroot (which comes with the basic ubuntu-mobile development packages installed), or building from their Gutsy host
The software will then need to be installed in the target filesystem. If building from the buildroot, then the target filesystem is located at /targets/target1/fs, and if building from a Gutsy host, then the target filesystem is located at /usr/src/myproject/targets/target1/fs
Developer builds test the target filesystem on host system
Developer installs the Xephyr server in their workstation and starts a new Xephyr window
The "full-mobile-stack" is a meta fset that depends on the Core, Infrastructure, GNOME-Mobile, Mobile-Applications, and Power-Management fsets
$ sudo apt-get install xserver-xephyr $ Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac &
Developer uses project-builder to chroot inside the target filesystem
Bind mounting /proc, /sys/, and /tmp
Copying over host network configuration files
Starting target daemons like dbus
Creating a fresh environment such that applications are not broke with host specific settings
$ sudo project-builder -c chroot-target \ --project-name myproject \ --target-name target1 Password: XXXXX #
Developer launches the hildon-desktop
# start-hildon-desktop &
Developer Creates an Installation Image
Project-builder provides several mechanisms for installing the new target filesystem on the device, including:
USB Install (boot a USB key that installs the target filesystem on the device)
Live USB (boot a working live image off a USB key)
Live RW USB (boot a working live image off a USB key that persist changes to the key)
ISO Install (user boots off a USB CD that installs the target filesystem on the device)
Live ISO (boot a working live image off a CD)
For this usage case, the developer creates an "Install USB" image and then writes the image to a USB key that shows up as /dev/sdb on the developers workstation
$ sudo project-builder -c create-install-usb \ --project-name myproject \ --target-name target1 \ --image-name live-usb.img $ sudo dd if=/usr/src/myproject/targets/target1/image/live-usb.img of=/dev/sdb
Developer Installs the target filesystem on the device
Developer plugs in the USB key to the device and then boots device and enters the BIOS configuration and configures the boot options to boot off a USB key
The device boots, automatically installs the target filesystem, and then shutdown
The developer unplugs the USB key and boots the device to see the running ubuntu-mobile stack
Build system generates an image for a given device
The build system uses the project-builder command line capabilities to create target images
# Inside the build script.... # $PLATFORM is the name of the platform # $BUILDROOT is the build working directory # $DEST is the directory to place the target image # Delete any existing build project project-builder -c delete-project --project-name build 2> /dev/null || true # Kick off a clean project project-builder -c create-project \ --platform-name $PLATFORM \ --project-name build \ --project-path $BUILDROOT \ --project-description "Build system" # Install a new target in the project project-builder -c create-install-usb \ --project-name build \ --target-name buildtarget \ --image-name install.img # Install the standard mobile stack in the target project-builder -c install-fset \ --project-name build \ --target-name buildtarget \ --fset-name "full-mobile-stack" # generate the an install USB image project-builder -c create-install-usb \ --project-name build \ --target-name buildtarget \ --image-name install.img mv $BUILDROOT/targets/buildtarget/image/live-usb.img $DEST
Implementation
The project-builder tool can be used as either a command line tool, or as a GUI if no command line arguments are provided. For a list of available command line arguments, use the --help argument:
$ project-builder --help Usage: project-builder [options] Options: -c CMD, --command=CMD Where CMD is one of: chroot-project, chroot-target, create-install-iso, create-install-usb, create-live- iso, create-live-usb, create-project, create-target, delete-project, delete-target, install-fset, list- fsets, list-platforms, list-projects, list-targets, update-project, or update-target --platform-name=PLATFORM_NAME Platform name --project-name=PROJECT_NAME Project name --project-description=PROJECT_DESC Project description --project-path=PROJECT_PATH Project path -t TARGET_NAME, --target-name=TARGET_NAME Target name --fset-name=FSET_NAME Feature set identifier --image-name=IMAGE_NAME Name to use for target image file -q, --quiet don't print status messages to stdout -d, --enable-debug Enable additional debug package while installing fsets -h, --help show this help message and exit Examples: <Adding a new project> project-builder --command=create-project \ --platform-name='mccaslin' \ --project-name='MyProject' \ --project-desc='Example project' \ --project-path=/usr/src/projects/myproject <Delete a project> project-builder --command=delete-project \ --project-name='MyOtherProject' <Adding a new target to an existing project> project-builder --command=create-target \ --project-name='MyProject' \ --target-name='MyTarget' <Delete a target> project-builder --command=delete-target \ --project-name='MyProject' \ --target-name='MyOtherTarget' <installing an fset into a given target> project-builder --command=install-fset \ --platform-name='mccaslin' \ --project-name='MyProject' \ --target-name='MyTarget' \ --fset='Core' \ <change into a given project buildroot filesystem> project-builder --command=chroot-project \ --project-name='MyProject' \ <change into a given projects target filesystem> project-builder --command=chroot-target \ --project-name='MyProject' \ --target-name='MyTarget' \ <updating a given target inside a project> project-builder --command=update-target \ --project-name='MyProject' \ --target-name='MyTarget' \ <updating a given project> project-builder --command=update-project \ --project-name='MyProject'
GUI