Creating an Android Boot Animation on Mac OS

Been a while since I updated the blog, so here’s a quick one to get back into the swing of things.

I have an HTC Explorer that I rooted a while back, mainly so that I could get rid of some of the OEM installed crap. But once you have your device rooted, chances are you’ll want to do more. So I played around with changing the boot animation on my phone.

I followed the instructions I found on a few different sites, but couldn’t get it to work. The issue, as I discovered, is that the Archive Utility that comes with Mac OS doesn’t create zip files that work with the Android OS. So here are my instructions for creating a replacement boot animation for your Android device.

Short Guide

  1. Create images and desc.txt file
  2. Create bootanimation.zip using zip -r -X -0 bootanimation desc.txt image_folder/
  3. Mount /system as read-write: mount -rw -o remount /dev/block/mtdblock3 /system
  4. Make boot animation location writable by the shell: chmod 777 /system/etc/customer
  5. Copy the bootanimation.zip to device: adb push bootanimation.zip /system/etc/customer
  6. Test that it works: adb shell bootanimation

PRE_REQUISITES:

Root Access
You’ll need to have root access to your device. Instructions will vary according to your device. Here are the instructions for rooting the HTC Explorer.

Android Device Bridge (adb)
You’ll need this to root your device, but if you used another machine to get root, then download adb-fastboot-install

Imaging Editing Software
To create your images. Boot animations are a collection of still images, shown by the device in a slideshow. Must be the same resolution as your device.

Description of bootanimation.zip

Your boot animation is stored in a zipped file that contains a folder with the sequentially numbered images that make up your animation and a desc.txt file that contains the parameters that set up your slideshow.

Location of bootanimation.zip

Depending on your device, bootanimation.zip may be located in several different locations. For the HTC Explorer, the packaged animation is located in /system/customize/resource/hTC_bootanimation.zip

Creating your custom animation

Follow these instructions on creating your custom boot animation file.

Creating the bootanimation.zip file

Once you have your images and desc.txt file completed, you need to create a zip file.

DO NOT USE THE IN-BUILT ARCHIVE UTILITY

Mac OS includes data with compressed files that will cause problems when Android tries to use your boot animation. Instead, open Terminal and use the zipcommand:

zip -r -X -0 bootanimation desc.txt image_folder/

Replace image_folder/ with the name of the directory containing your images.

Copying bootanimation.zip to your device

At this point, you can connect your device to your Mac using the supplied USB cable. Before doing so, make sure that USB Debugging is enabled. (Settings -> Applications -> Development -> USB Debugging). When you connecting your device, you may be prompted for a mode. Select “Charge Only”.

Before you can copy any data to your device, you need to mount the /system directory as read-write. In Terminal type the following commands:

adb shell
su
mount

The mount command should return a list of all the mount points on your device. Look down the list for the /system mount point and make a note of which device is mounted at that point On my phone, it’s /dev/block/mtdblock3, but yours may be different. Once you have the name of the device, run the following command:

mount -rw -o remount /dev/block/mtdblock3 /system

(Don’t forget to substitute the correct device for /dev/block/mtdblock3.)

Aside: I mentioned above that the packaged animation for the HTC Explorer is located in /system/customize/resource/hTC_bootanimation.zip. Normally you would make a backup of this file and replace it with your custom boot animation. However, when troubleshooting problems with my own boot animation I found an entry in the Android logs that suggested that Android would first look in /system/etc/customer for a boot animation. Placing your custom boot animation here has a couple of benefits:

  • You don’t need to make a backup of the OEM boot animation.
  • You won’t lose the original boot animation if you ever decide to go back
  • You won’t mistakenly over-write the original boot animation.

The final step before copying your custom animation to your device is to make sure that the shell can write to the location where your boot animation will reside. Although the /system directory has been mounted as read-write, the permissions on the directory only allow root user to access the data. The method used to push data to your phone uses a different user, so we need to make sure that we have write access. Once again, using the adb shell, we run the following command:

chmod 777 /system/etc/customer

NOTE: If you’re using the same directory as I am in the sample above, you may have to create the customer first. Use mkdir /system/etc/customer to do so.

Exit out of the adb shell by typing Ctrl-D twice. (Once to log out as root, and again to log out completely.) You should now be back at the standard Terminal prompt. At the Terminal prompt, issue the following command:

adb push bootanimation.zip /system/etc/customer

Testing that your boot animation is working

You could always restart your phone to check that the custom animation is working, but there is an easier way. From the Terminal prompt, use:

adb shell bootanimation

This will start the boot animation on your phone, to exit hit Ctrl-C.