How to build Linaro Ubuntu-based images for IFC6410

In this wiki page, we explain how the Linaro Ubuntu-based images for IFC6410, also called Snapdragon Linux Platform release, are produced.

It is important to note that Ubuntu is a package-based, binary distribution. As such Ubuntu images are produced by assembling together pre-built binary packages. Each package is not rebuilt from scratch during image creation. Each source package is uploaded separately into the Ubuntu archives prior to the image creation, whenever there is a source change to submit in a package. Source packages are built using Ubuntu build infrastructure on https://launchpad.net/. The Ubuntu archive contains source and binary packages for each component available in Ubuntu.

Some packages are modified or created by Linaro. Linaro uses a Launchpad Personal Package Archive or PPA (see https://help.launchpad.net/Packaging/PPA) for all its packages.

All the packages installed in the root file system are coming either from Ubuntu archives or from Linaro maintained Personal Packages Archives (PPA). The Linaro PPA used for this release are:

The list of packages that were overlaid by Linaro to run for Snapdragon Linux Platform releases are generally: mesa, cogl, libdrm, xf86-video-freedreno and alsa-lib. These packages are thus the one maintained in the Linaro PPAs.

When building your own custom Ubuntu-based images, it is recommended to carefully read Canonical's Intellectual property rights policy: http://www.canonical.com/intellectual-property-rights-policy.

The process of building the Linaro Ubuntu-based image for IFC6410 is done in three different steps:

  1. Assembling a generic Ubuntu root file system that contains all the user space packages
  2. Building the IFC6410 kernel binary package (.deb)
  3. Generation of the fastboot-ready final images

All three steps are done on Linaro Continuous Integration server (based on Jenkins): https://ci.linaro.org/, and all build scripts are publicly available. As such, while very few people should need to re-generate the release images, given the binary-package nature of Ubuntu, it is possible to do it.

Assembling generic Ubuntu root file system

The Jenkins job configuration is here: https://ci.linaro.org/view/engineering-builds/job/ubuntu-armhf-rootfs/configure. The images are built on x86 hosts running Ubuntu 14.04 LTS, using live-build utility and QEMU.

All the build configurations are available in http://git.linaro.org/ci/ubuntu-build-service.git. In particular, the developer and gnome images configurations can be found here:

The configure script and Makefile in each build configuration should work on any own local Ubuntu machine. The scripts are optimized for Linaro Jenkins, some tweaks might be necessary to build outside of Linaro Jenkins. For example, the Linaro Jenkins is using a local apt mirror to optimize network utilization. So you need to replace any iteration of http://localhost:3142/LINK with http://LINK.

When running live-build it will download packages from Ubuntu archives and/or Linaro PPA and install them to create the root file system. The list of packages installed in the image are listed for each build configuration in customization/package-lists/*.chroot.

Building the IFC6410 kernel binary package

The Jenkins job configuration can be found here: https://ci.linaro.org/view/lt-kernel-ci/job/LT-QCOM-working-tree/. The kernel is cross compiled using the standard Linux kernel Makefile. The .deb files are created also using the built-int support, e.g. using the Kernel Makefile deb-pkg target.

Generation of the fastboot-ready final images

The Jenkins job configuration can be found here: https://ci.linaro.org/view/member-builds/job/lt-qcom-ifc6410-image/configure. We generate the following fastboot-ready images:

  • boot-ifc6410-<ID>.img which includes the kernel image and the init ramdisk

  • firmware-ifc6410-<ID>.img which is a placeholder to later install the APQ firmware files

  • linaro-trusty-developer-ifc6410-<ID>.img which is the developer root file system image

  • linaro-trusty-gnome-ifc6410-<ID>.img which is the Gnome based root file system image

Build artifacts

Build artifacts are first uploaded on Linaro Snapshot server, before they get archived (montly) on Linaro Release server. The IFC6410 Linaro Ubuntu-based are published here: http://snapshots.linaro.org/ubuntu/pre-built/ifc6410, and are organized by build number.

The file README.txt in the build artifacts has pointers to the generic root file system image that were used to customize the images for IFC6410. For example, for the Linaro 14.05 release, we can see:

This build is using artifacts from the following builds:
Kernel build: https://ci.linaro.org/jenkins/job/LT-QCOM-working-tree/36
Linaro Ubuntu developer build: http://snapshots.linaro.org/ubuntu/images/developer/661
Linaro Ubuntu gnome build: http://snapshots.linaro.org/ubuntu/images/gnome/661

How to rebuild and customize the kernel

How to rebuild and customize any user space Ubuntu package

Since all packages installed in Linaro Ubuntu-based images are maintained either in Ubuntu archives or in proper PPA, it is possible for our users to update their environment with commands such as:

 sudo apt-get update
 sudo apt-get upgrade

For some time, Linaro will maintain these PPAs up-to-date, and whenever a new package version (bug fix) is pushed in the Ubuntu archives, the same fix will be applied and uploaded in the Linaro PPAs. If you face any issue after upgrading the installation, please report it.

All user space software is packaged using Ubuntu or Debian packaging process, since Debian is the rock upon which Ubuntu is built. As such you can find extensive information about using, patching and building packages in the Ubuntu packaging guide or The Debian New Maintainers Guide. If you quickly want to rebuild any package, you can run the following commands to fetch the package source code and install all build dependencies:

 sudo apt-get update
 sudo apt-get build-dep <pkg>
 apt-get source <pkg>

Then you can rebuild the package locally with:

 cd <pkg-version>
 dpkg-buildpackage -b -us -uc

Notes: * you can drop patches in debian/patches/ and update debian/patches/series before building with dpkg-buildpackage to customize the source code. * all associated .deb files will be located in the root folder, and can be installed in the system with dpkg -i <pkg>.deb. * all these commands should be executed on the target directly, not on the development host. It is generally enough to build packages natively, on the target platform. For most packages, it is possible to cross compile Ubuntu/Debian packages however this goes beyond the scope of this wiki page.

How to mount and modify a Linaro Ubuntu-based images before flashing

The fastboot-ready root file system image is a regular file system image which can be mounted on your desktop before flashing. This can be used to make any modifications to the image such as changing some configurations files (e.g. network configuration files).

The only caveat is that the generated image is a sparse image, which has been optimized to use less disk space (e.g. so that empty space in the file system does not use disk space). The sparse image can be converted to a regular image using simg2img utility from the Android tools package. If you are using Ubuntu you can install it with:

sudo apt-get install android-tools-fsutils

As such, the following command can be used to mount and modify the released image:

simg2img linaro-trusty-developer-ifc6410-<ID>.img linaro-trusty-developer-ifc6410-<ID>.img.raw
sudo mount -o loop linaro-trusty-developer-ifc6410-<ID>.img.raw /mnt/<a mount point>
edit files in /mnt/<a mount point>
sudo umount /mnt/<a mount point>

Any modification done inside the image mount point will be permanently applied to the raw image file, after unmounting. You can then flash the updated image with the same usual fastboot flash command, as per the release notes.

How to compile any custom application

N/A

How to install the Ubuntu-based image on USB, SD, or SATA instead of eMMC

N/A

How to install setup and use Android ADB

It is possible to setup Android Debug Bridge (adb) server on the Linaro Ubuntu image, if you are using a Linaro release until Linaro 14.10. For Linaro releases after 14.10, support for Android drivers in the kernel have been disabled, hence ADB is not available.

Adb is not setup by default in the released images, but this can be added on a running image. It is working with any Ubuntu image (developer, gnome, ...). Once adb daemon is running on the board it can be used to reboot into bootloader mode, for example.

First you need to install the adb daemon on the running target:

sudo apt-get install android-tools-adbd

Once the tool is installed need to add the Android USB gadget configuration commands on the running target. On the target, edit the file /etc/init/android-tools-adbd.conf and add the next block of script before the last line that starts the adbd program:

pre-start script
    echo 0 > /sys/class/android_usb/android0/enable
    echo 0x9025 > /sys/class/android_usb/android0/idProduct
    echo 0x05C6 > /sys/class/android_usb/android0/idVendor
    echo diag > /sys/class/android_usb/android0/f_diag/clients
    echo smd,tty > /sys/class/android_usb/android0/f_serial/transports
    echo smd,bam > /sys/class/android_usb/android0/f_rmnet/transports
    echo diag,adb,serial,rmnet,mass_storage > /sys/class/android_usb/android0/functions
    echo 1 > /sys/class/android_usb/android0/enable
end script

You can now start the adb daemon:

start android-tools-adbd

From your desktop host machine, you can now connect to your target device using adb, like any standard Android devices. For example, you can list all attached devices with

adb devices

You can get an Android shell with

adb shell

Or you can reboot the target device into fastboot mode with

adb reboot-bootloader

Boards/IFC6410/LinaroUbuntu (last modified 2015-03-02 09:59:03)