The recently released Raspberry Pi 5 is making waves with its impressive performance capabilities, positioning it as a powerful option for various applications, including running Android Automotive. This post will show you how to build Android Automotive OS (AAOS) and run it on the RPI 4 or 5.
Prerequisites
Set up AOSP build environment.
If you are using Ubuntu 22+, you can download repo with apt. If not, please follow the guide above to set up repo.
Build machine:
- A 64-bit x86 Linux system
- At least 400 GB of free disk space to check out and build the code (250 GB to check out + 150 GB to build).
- A minimum of 64 GB of RAM. Based on my experience, 32 GB of RAM is good for building Android 13. But for Android 14, 32 GB is not enough and will give an error and stop the build. A swap can be used when you don’t have enough RAM.
To set up swap:
- Open a Terminal: You’ll need terminal access with superuser privileges.
- Create the Swap File:
- Use the
fallocate
command to create a swap file.sudo fallocate -l 32G /swapfile
- If
fallocate
is not available,sudo dd if=/dev/zero of=/swapfile bs=1G count=32
- Set the Correct Permissions: Ensure only the root user can read and write to the swap file
sudo chmod 600 /swapfile
- Format the Swap File: Set up the file as a swap space
mkswap /swapfile
- Enable the Swap File: Activate the swap file for immediate use
sudo swapon /swapfile
- Make it Permanent: To ensure the swap file is used at boot, add it to
/etc/fstab
. - Open the file in a text editor:
sudo nano /etc/fstab
- Add the following line at the end:
/swapfile none swap sw 0 0
- Verify the Swap: Check that the swap is active:
sudo swapon --show
- Or check with
free -h
Install additional packages:
sudo apt-get install bc coreutils dosfstools e2fsprogs fdisk kpartx mtools ninja-build pkg-config python3-pip
sudo pip3 install meson mako jinja2 ply pyyaml dataclasses
Create a directory and initialize the repo:
mkdir aaos_rpi && cd aaos_rpi
repo init -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r34 --depth=1
curl -o .repo/local_manifests/manifest_brcm_rpi.xml -L https://raw.githubusercontent.com/raspberry-vanilla/android_local_manifest/android-14.0.0_r34/manifest_brcm_rpi.xml --create-dirs
curl -o .repo/local_manifests/remove_projects.xml -L https://raw.githubusercontent.com/raspberry-vanilla/android_local_manifest/android-14.0.0_r34/remove_projects.xml
Sync source code:
repo sync -j$(nproc --all)
Build
Build for Raspberry Pi 4 or Raspberry Pi 5
source build/envsetup.sh
lunch aosp_rpi4_car-ap1a-userdebug
lunch aosp_rpi5_car-ap1a-userdebug
make bootimage systemimage vendorimage -j$(nproc)
Make flashable image for the device (rpi4 or rpi5):
./rpi4-mkimg.sh
./rpi5-mkimg.sh