Image Creation

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:

It also offers some additional advantages such as:

Developer uses project-builder to start a new project

Here we assume that:

		$ 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:

		$ 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)

Developer tweaks the target filesystem as desired

Developer builds test the target filesystem on host system

Developer installs the Xephyr server in their workstation and starts a new Xephyr window

Developer uses project-builder to chroot inside the target filesystem

				 $ sudo project-builder -c chroot-target        \
				 --project-name myproject \
				 --target-name target1
				 Password: XXXXX
				 # 
				 

Developer Creates an Installation Image

Project-builder provides several mechanisms for installing the new target filesystem on the device, including:

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

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

Figure 2.5. Project Builder GUI

Project Builder GUI