ReleaseEngineering/Mozpool/How To Create a Panda Android Image Suitable For Mozpool

From MozillaWiki
Jump to navigation Jump to search

Mozpool uses build artifacts to deploy Android and B2G on to SD cards. The SD card must be pre-populated with a preseed image which contains a MBR partition table and the u-boot loader.

Capturing the Android Artifacts from a SD Card

If you have installed Android on an SD card, you can extract the system, userdata, and boot artifacts using tar.

  • Start by inserting the SD card into the reader on the capturing host.
  • Create the mount points.
mkdir -p /tmp/boot/ /tmp/system/ /tmp/data/
  • Check dmesg to determine the device filename (eg this is typically either /dev/sdX or /dev/mmcblkX)
dmesg
  • Some OSes auto mount SD cards upon insertion. Check the mounted filesystems and mount the boot, system and userdata partitions to the correct mount points.
sudo mount -t vfat /dev/mmcblk0p1 /tmp/boot
sudo mount -t ext4 /dev/mmcblk0p2 /tmp/system
sudo mount -t ext4 /dev/mmcblk0p5 /tmp/data
  • Using Tar to extract the artifacts. Although android uses several partitions, only 3 are needed for mozpool to deploy at working Android image. It is critical to use sudo here. Not using it can result in bootable but unstable images due to clobbered file ownership and permissions.
sudo tar -jcpsf system.tar.bz2 -C /tmp system
sudo tar -jcpsf userdata.tar.bz2 -C /tmp data
sudo tar -jcf boot.tar.bz2 -C /tmp boot/uInitrd boot/uImage

This will produce 3 tarball artifacts.

  • system - Android mounts this as /system within the init startup phase and contains all the Android OS components
  • userdata - Android mounts this as /data. It contains apps and configuration data
  • boot - This is contains only 2 file, the Android linux kernel (uImage) and the initrd ram disk image (uInitrd). The boot loader and boot loader scripts are provided in the preseed image and should not be captured in the boot artifact.

Capturing Android Artifacts from an image file

This process is similar to the previous steps but is used when extracting Android artifacts from an Android SD Card image file which is typically created using dd.

  • Setup loopback device to file
sudo losetup /dev/loop0 android.img
  • Setup partitions
sudo partx -a /dev/loop0
  • Create mount points
sudo mkdir -p /tmp/boot /tmp/system /tmp/data
  • Mount boot, system and data filesystems
sudo mount -t vfat /dev/loop0p1 /tmp/boot
sudo mount -t ext4 /dev/loop0p2 /tmp/system/
sudo mount -t ext4 /dev/loop0p5 /tmp/data/
  • Extract filesystems to artifacts
sudo tar -jcpf boot.tar.bz2 -C /tmp boot/uImage boot/uInitrd
sudo tar -jcpf system.tar.bz2 -C /tmp system/
sudo tar -jcpf userdata.tar.bz2 -C /tmp data/

Once the artifacts are captured, see Adding New Android Images to Mozpool section for uploading instructions.