Android Automotive on a Raspberry Pi 4

Android Automotive on a Raspberry Pi 4

As we know, the main difference in workflow between the emulator and a real device occurs at the lower levels of the stack (HAL, Kernel, and Drivers), where the emulator simulates the hardware while a real device interacts with actual hardware components. At the higher levels (Application and Framework), the workflows are quite similar.

For working with hardware outside of work (company hardware boards), I found a hardware board that can be used for educational purposes.

Here are the list of hardware boards that can use for AOSP development: DragonBoard 845c, Qualcomm Robotics Board RB5, HiKey 960, VIM3, TinkerBoard, Raspberry PI. Also, we could consider Pixel Phones as Development Platforms for Android Automotive.

In my opinion, the most suitable for hardware-based AOSP development with a large support community and lower price is the Raspberry PI 4.

Here are the main sections of this story:

  1. Download AOSP
  2. AOSP Build
  3. Creating RPi Boot Image
  4. Creating Bootable SD Card
  5. Flashing Raspberry Pi 4 with SD Card

Prerequisites

Before we do this, we need the following environment:

  • A 64 bit linux build machine with more than 16GB RAM and 400GB storage [requirements]. I used Ubuntu 22.04.3 OS with RAM 16+ Gb and 8+ cores 2.5 GHz.
  • Raspberry Pi 4 any model.

Article content
Raspberrypi 4

  • Touchscreen display or Monitor

Article content

  • At least 16GB SD Card for flashing the image. SD card with low speed can affect on working firmware, so the speed should be at least 12.5 MB/s.

Download AOSP

Before start Downloading AOSP the linux machine should be established a build environment [doc].

Set up for AOSP development (9.0 or later)

Before you download and build the main branch of the Android source, ensure that your hardware meets the necessary requirements and that required software is properly installed. You should also be familiar with the following terms:

Git

Git is a free and open source distributed version control system. Android uses Git for local operations such as branching, commits, diffs, and edits. For help learning Git, refer to the Git documentation.

Repo

Repo is a Python wrapper around Git that simplifies performing complex operations across multiple Git repositories. Repo doesn't replace Git for all version control operations, it only makes complex Git operations easier to accomplish. Repo uses manifest files to aggregate Git projects into the Android superproject.

Manifest file

A manifest file is an XML file specifying where the various Git projects in the Android source are placed within an AOSP source tree.

More likely, it require installation of 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        

Once machine set up, install Source control tools in order to download source code (AOSP), in my case it is repo [doc].

Download the source code [doc]. I used instruction from github. Use build commands from github to be sure that it is updated.

Initialize repo:

repo init -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r20
curl -o .repo/local_manifests/manifest_brcm_rpi.xml -L https://raw.githubusercontent.com/raspberry-vanilla/android_local_manifest/android-14.0/manifest_brcm_rpi.xml --create-dirs        

Sync source code:

repo sync        

When repo sync done successfully it can be build.


Article content
repo snip

AOSP Build

Setup Android build environment, run script:

. build/envsetup.sh        


Article content
build step

choose car userdebug build for Raspberry pi 4

lunch aosp_rpi4_car-userdebug        

and build boot, system, and vendor images for the Raspberry Pi device.

make bootimage systemimage vendorimage        

Here is explanation for these images.

  • The boot image is a specific package that contains the kernel and RAMDisk, which is necessary for the device’s boot process.
  • The system image contains the Android system files, including the framework, libraries, and system apps. It is mounted as the /system partition on the device.
  • The vendor image includes the hardware-specific binaries and libraries needed for the device to function. These files are part of the /vendor partition on the device.

During build it could some error appears, it might be lack of installed packages on Linux machine, so read log error and install. Example:

sudo apt-get install flex        

once it build finished make flashable image for the device.

Creating RPi Boot Image

Run script that located on root folder of source code:

./rpi4-mkimg.sh        

When this script is done, it should be image created

Done, created .../out/target/product/rpi4/RaspberryVanillaAOSP14–202531178-rpi4.img!        

Creating Bootable SD Card

Insert SD card in Linux machine, use BalenaEtcher for flashing image on SD card.

Select the built image located in out/target/product/rpi4/RaspberryVanillaAOSP14–202531178-rpi4.img and specify SD card and Flash it.

Article content

Flashing Raspberry Pi 4 with SD Card

Insert SD Card into Raspberry Pi, connect power supply and wait until it flashed. It usually takes 1–2 min.

In order to works touchscreen display properly it requires to connect:

  • Power supply 5V 3A (Type-C).
  • HDMI cable (micro-HDMI — mini-HDMI)
  • Type-C cable for touchscreen (Type-C — USB A)

Finally, it flashed, connected and works.

Article content

I ran into two main problems:

  • The first, my Linux machine didn’t have all necessary packages for building AOSP. I fixed this by installing the missing packages that I’ve mentioned above.
  • The second, after creating the SD card’s partitions and flashing the images, the Android Automotive OS wouldn’t boot on my Raspberry Pi. I solved this by using the rpi4-mkimg.sh script to make a single image.
  • The third, ADB debugging — USB-C cable need to connect to PC. But if we connect a display, camera, fan, and other devices to the Raspberry Pi 4 (RP4), USB-C power from the PC will not be sufficient. Additional power can be supplied via pinouts (see https://pinout.xyz/): pin 4 is positive (5V), and pin 6 is negative. Alternatively, a USB hub with more than one USB-C slot is required: one slot for power supply and the other to connect to the PC for ADB.

Overview

This guide covers the complete process of building AOSP Android 14 for Raspberry Pi 4 and 5, including environment setup, source code synchronization, compilation, and flashing the image onto the device.

Prerequisites

  • 64-bit Ubuntu 22.04 LTS machine with 16GB+ RAM and 400GB+ storage
  • Raspberry Pi 4 or 5 (any model)
  • 16GB+ SD card (high-speed recommended)
  • Touchscreen display or monitor (for UI testing)

Step 1: Establish Android Build Environment

Install necessary packages:

sudo apt-get install coreutils dosfstools e2fsprogs fdisk kpartx mtools ninja-build pkg-config python3-pip rsync
sudo pip3 install dataclasses jinja2 mako meson ply pyyaml        

Step 2: Download AOSP Source Code

Initialize repo:

repo init -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r20
curl -o .repo/local_manifests/manifest_brcm_rpi.xml -L https://raw.github🚗 Android Automotive on a Raspberry Pi 4: AOSP Development & Use Cases 🔥

Ever wondered how Android Automotive OS (AAOS) runs on real embedded hardware? In this article, I explore how to build AOSP Android 15 for the Raspberry Pi 4 & 5, including:

✅ Setting up the AOSP build environment on Ubuntu
✅ Downloading and compiling Android source code
✅ Flashing the Raspberry Pi with Android Automotive
✅ Overcoming common challenges during the process

🔧 Why does this matter?
Running Android Automotive on a Raspberry Pi opens up endless possibilities for IVI (In-Vehicle Infotainment) prototyping, smart dashboards, embedded AI systems, and edge computing projects.

💡 Use Cases & Projects:
🚀 Custom Android Automotive infotainment systems
🏠 Smart home IoT hub with touchscreen interface
📺 DIY Android TV media center
🤖 Edge AI machine learning applications
📟 Interactive embedded kiosks

🔗 Read the full guide to dive into the technical details, code, and troubleshooting tips!

What are your thoughts on Android Automotive for DIY hardware projects? Let’s discuss in the comments! ⬇️ #Android #AOSP #EmbeddedSystems #Automotive #RaspberryPi #AndroidAutomotiveusercontent.com/raspberry-vanilla/android_local_manifest/android-14.0/manifest_brcm_rpi.xml --create-dirs        

Optionally, reduce download size:

repo init -u https://android.googlesource.com/platform/manifest -b android-14.0.0_r20 --depth=1
curl -o .repo/local_manifests/manifest_brcm_rpi.xml -L https://raw.githubusercontent.com/raspberry-vanilla/android_local_manifest/android-14.0/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/remove_projects.xml        

Sync source code:

repo sync        

Step 3: Configure and Build AOSP

Set up the Android build environment:

. build/envsetup.sh        

Select device and target UI:

lunch aosp_rpi4-bp1a-userdebug      # Base profile for RPi4
lunch aosp_rpi4_tv-bp1a-userdebug   # Android TV for RPi4
lunch aosp_rpi4_car-bp1a-userdebug  # Android Automotive for RPi4
lunch aosp_rpi5-bp1a-userdebug      # Base profile for RPi5
lunch aosp_rpi5_tv-bp1a-userdebug   # Android TV for RPi5
lunch aosp_rpi5_car-bp1a-userdebug  # Android Automotive for RPi5        

Compile AOSP:

make bootimage systemimage vendorimage -j$(nproc)        

Step 4: Create Flashable Image

For Raspberry Pi 4:

./rpi4-mkimg.sh        

For Raspberry Pi 4:

./rpi4-mkimg.sh        

Use Cases & Potential Projects

1. Android Automotive Prototyping

  • Develop and test Android Automotive OS (AAOS) on Raspberry Pi.
  • Create custom vehicle infotainment systems with touchscreen integration.
  • Experiment with voice assistants, navigation, and media controls.

2. Smart Home Hub

  • Build a smart home control center using Raspberry Pi with AOSP.
  • Integrate Google Assistant, home automation APIs, and IoT device support.

3. Android TV Set-Top Box

  • Use Raspberry Pi as a custom Android TV device.
  • Experiment with app installations, streaming services, and UI customizations.

4. Edge AI & Machine Learning

  • Leverage TensorFlow Lite and ML Kit on AOSP for edge AI applications.
  • Implement image recognition or voice processing tasks.

5. Embedded Kiosk Systems

  • Deploy self-service kiosks running Android.
  • Integrate RFID/NFC readers, barcode scanners, and touchscreen UIs.

Additional Considerations

  • Linux Kernel Build: Follow Raspberry Pi-specific kernel build instructions.
  • Troubleshooting: If build errors occur, check logs and install missing dependencies.
  • ADB Debugging: Ensure sufficient power when connecting peripherals to Raspberry Pi.

This guide provides a streamlined approach to setting up AOSP for Raspberry Pi while ensuring flexibility for different use cases, including tablet UI, Android TV, and Android Automotive. 🚀


Mark Marasch

Battle-tested engineering manager and influential communicator. Capable cross-discipline problem solver and leader. Obstacle obliteration, effective communication, achievement of results.

2mo

I have a Raspberry Pi 4 in my car's dash running OpenAuto Pro. I'm not impressed with it, so I might give this a try. Thanks!

Like
Reply
Xavier Salomon Magloire NANGUY

Information Communication Technology Specialist at International Committee of the Red Cross - ICRC

3mo

Nice project to build I am very interested by the outcome

Like
Reply
Ahmed Samy

Electronics and Embedded Systems Engineer @Origin-Labs

3mo

Great job 💚 What are the prerequisites to start studying Android automotive?

Like
Reply

Impressive alternative to Raspberry Pi—built for production, not just prototyping. Excited to see solutions like this driving real-world deployments. https://www.microbin.io/buy

Like
Reply
Deuel Clement

Technology Enabler | Fintech Leader | Seasoned Banker | Business Development Expert | Tech Sales & SaaS Enthusiast | B2B Strategist | Market Expansion Specialist

4mo

Nice job Abdull!!

Like
Reply

To view or add a comment, sign in

Others also viewed

Explore topics