This is a simple step by step guide on how to change the Android boot animation which is shown when the system is loading.
- Android L5.1.1_2.1.0 BSP. The basics of the boot animation may also apply to older and upcoming releases but L5.1.1_2.1.0 BSP was used for this document. File names, settings or paths may be changed in older or newer releases.
- i.MX6Q Sabre SD Board or any other i.MX board supported by the BSP release, for testing.
- 7-Zip. This is a free compression tool and has the necessary settings for preparing the boot animation file. It is important that the boot animation file is in Zip format with no compression, otherwise the file won’t be read and the animation will not be shown. Zip tools integrated on some Operating Systems may not always allow for these configurations.
You may download this utility from the link below:
- Android adb tool. This tool is part of the Android SDK. You may download the SDK as part of Android Studio or the SDK as Stand Alone on the following link. Only the adb is required to follow up this document.
Understanding the boot animation format.
The animations used by Android when booting are actually a series of images in either jpg or png format in a zip file with no compression (storage mode) and a text file (desc.txt) with the specified resolution, framerate and loops to be played by the animation.
Each folder containing a part of the animation must contain the images numbered from 000 onwards. This file is always called bootanimation.zip An example of a boot animarion can be found attached to this document.
The contents of the desc.txt file on the attached example are as follow:
480 292 30 p 1 0 part0 p 0 0 part1
(please note that there should be an empty line at the end of the document).
Line 1: Screen resolution followed by FPS (Frames per Second) of the animation.
Lines 3-5: The p serves to describe that the line contains a part of the animation; followed by the number of times the section of the animation will play (with zero being an infinite loop); followed by a delay in frames before moving to the next line. Finally, the folder containing the files of that specific part of the animation (this is why most animations use “part” for the folder name).
Line 6: A blank line. This is important as without it the animation may not run as it will consider the description file incomplete.
There are some animations available around the web as well as some free tools or apps that allow you to create your own animations. You may find an example animation attached to this document which you may use as reference.
It is important that no other files are included on the bootanimation.zip file. This includes the thumbnails created automatically by Windows. Please delete them from your fule before loading it to the board.
Please note that the animation may be repeated in a loop if it’s shorter than the actual time it takes for the system to load. However, the animation will play complete regardless of the loading time so very long boot animations may give the appearance of a longer booting time.
The location of the boot animation file is given on the bootanimation_main.cpp file, which is located on the following path:
There are two definitions that give the file location. We’re focusing on the default image for this document (unencrypted).
#define SYSTEM_BOOTANIMATION_FILE "/system/media/bootanimation.zip" #define SYSTEM_ENCRYPTED_BOOTANIMATION_FILE "/system/media/bootanimation-encrypted.zip"
Note: These definitions may be different from those in third party BSPs. It is common to find BSPs using the "/data/local/” folder as USER_BOOTANIMATION. This is not supported by default on NXP’s BSP.
Loading the new boot animation file.
- Building a User Debug image
Android protects certain folders to avoid tampering, so in order to change the boot animation we will use adb in order to access the file system. However, it is necessary to use a image with root access so we will be using a user debug image.
In order to compile as user debug use the following lunch command after following the instructions in the Android User's Guide:
$ lunch sabresd_6dq-userdebug
After configuring the build for user debug you can then build using make. (This process may take several hours)
- Enabling USB Debug mode
Your board should be running android and then be connected to the computer using the USB OTG port. In order for adb to work you have to enable USB debugging by opening Settings and scrolling down to the “About” option clicking the "About" option 7 times.
- Using adb to load the new boot animation
We’ll connect to the SABRE board using the Android SDK for Windows adb tool available at the path below:
Open a command promt in windows and go to the adb path. Then start the adb server with the following command:
$ adb start-server
This will initialize the adb daemon. In order to connect to the device permission must be granted. A pop up will appear asking whether to trust or not the computer host. Since we will be changing the system partition we must initialize adb as root:
$ adb root
This will restart the adb daemon in root mode. You will need to grant access from your device. You may see the list of connected with:
$ adb devices
If you wish to see the contents of the filesystem you may enter the shell with the following command:
$ adb shell
However, we will be using the pull/push commands from adb in order to change the bootanimation.
If you wish to download the current bootanimation for backup you may do so with the following command:
$ adb pull /system/media/bootanimation.zip C:\
This will download the bootanimation.zip file to C:
Since the system partition is read only you will need to remount with the adb prior to pushing the replacing boot animarion
$ adb remount
$ adb root push C:\BootAni\bootanimation.zip /system/media
After this you may reboot your board and you should see the new boot animation.
Original Attachment has been moved to: bootanimation.zip