For building Android 15 I followed the Devlinux.vn post Building Android Automotive 15 for the Raspberry Pi 4 . The only thing to watch out for in that guide is step 3.1, repo init: use this command instead (change the revision):

text
repo init -u https://android.googlesource.com/platform/manifest -b android-15.0.0_r26

A. Overview

If you use Android you are surely familiar with the "Powered by Android" screen at boot, but this boot animation can be completely replaced with another video or picture.

That's the nice thing about Android, just like Linux: it can be customised :v I replaced the Android loading screen with this "Cat saying Huh!" meme.

B. Analysis

Android takes the boot animation from bootanimation.zip in /system/media. There are two ways to get your own boot animation onto the board:

  • Change the build configuration so the built image already contains the boot animation
  • Replace it directly in /system/media on the board after flashing

Structure of a bootanimation.zip:

text
bootanimation.zip
└───part0 [folder name]
│   │   000.png [or .jpg]
│   │   001.png
│   │   002.png
│   │   ...
└───part1
│   │   000.png
│   │   001.png
│   │   002.png
│   │   ...
└───desc.txt [animation specification]

Inside, desc.txt looks like this:

text
[width] [height] [frames per second]
[type ("p" or "c"] [loop count] [pause] [folder] [bg color (optional)]
[type ("p" or "c"] [loop count] [pause] [folder] [bg color (optional)]

Etc. End off with an empty line.
  • [width]
    • Image width
  • [height]
    • Image height
  • [frames per second]
    • Number of frames per second
  • [type]
    • Type p: the boot animation is cut off as soon as the OS finishes loading --> looks faster
    • Type c: the boot animation plays to the end before switching to the OS --> users may easily think the boot is slow
  • [loop count]
    • How many times this part repeats
    • Note: 0 means it repeats forever
  • [pause]
    • How many frames to pause between parts
  • [folder]
    • The folder that holds the part
  • [bg color]
    • Background colour

For example:

text
800 480 30
**p** 1 15 part0 FFFFFF
**p** 0 0 part1 FFFFFF

C. Let's do it

1. Download the video you want
2. Once you have the video, use ffmpeg to cut it into frames
  • If you don't have it yet, install it with:
text
sudo apt update
sudo apt install ffmpeg
  • To keep it simple I create only one part here:
text
ffmpeg -i input.mp4 -vf "fps=8,scale=1280:720" -qscale:v 6 -vframes 120 part0/%03d.jpg
  • How to work out the numbers:
text
total_frames = fps × duration_in_seconds

If you want a 15-second boot animation and pick fps = 8, you need 8*15 = 120 frames. Note: higher fps --> more frames --> bigger bootanimation.zip. Android only accepts a bootanimation.zip of 2-5 MB; anything bigger will not be displayed.

3. Set the desc.txt config file

As described above, I chose these values:

text
1280 720 8
p 1 0 part0 000000
4. Zip the part0 folder and desc.txt into bootanimation.zip
text
zip -r -0 bootanimation.zip desc.txt part0
5. Copy bootanimation.zip to the board

text
mount -o rw,remount /
  • After remounting, files can be created freely.

  • Ctrl + D to get back out, then go to the folder where the boot animation is stored:
text
adb push  /system/media
6. Reboot the board and admire the result :v