Introduction: The Dawn of Virtualized Automotive Platforms
The automotive industry is undergoing a profound transformation, driven by software-defined vehicles and the increasing demand for advanced in-car experiences. Android Automotive OS (AAOS) has emerged as a leading platform for infotainment, navigation, and connectivity. However, integrating AAOS into safety-critical automotive environments presents unique challenges, particularly regarding resource isolation and real-time performance for other vehicle functions. This is where hypervisors like ACRN step in, enabling the secure and efficient co-existence of AAOS with other critical operating systems on a single System-on-Chip (SoC).
ACRN, an open-source, lightweight reference hypervisor for IoT development, offers a robust solution for mixed-criticality workloads. By leveraging ACRN, developers can virtualize AAOS as a User OS (U-OS) while running a real-time operating system (RTOS) or a minimal Linux distribution as a Service OS (S-OS) responsible for hypervisor management and device sharing. This guide provides a practical, expert-level walkthrough for setting up ACRN and integrating AAOS as a virtualized guest.
Why ACRN for AAOS in Automotive?
Integrating AAOS within an ACRN-virtualized environment offers several compelling advantages for automotive applications:
- Mixed-Criticality Workloads: Separates non-critical infotainment (AAOS) from safety-critical functions (e.g., instrument clusters, ADAS controllers) into isolated virtual machines, preventing interference.
- Resource Isolation and Security: Hardware-level virtualization ensures strict partitioning of CPU cores, memory, and I/O devices, enhancing system security and fault tolerance.
- Real-time Performance: The Service OS, often a real-time Linux variant, can manage critical hardware resources with predictable latency, while AAOS runs on dedicated, non-real-time cores.
- Simplified Hardware: Consolidates multiple ECUs onto a single powerful SoC, reducing Bill of Materials (BOM) costs, power consumption, and complexity.
- Flexible Development: Allows independent development and updates of AAOS and RTOS components without affecting each other.
ACRN Architecture Overview for AAOS Integration
Understanding ACRN’s fundamental architecture is crucial for successful AAOS integration:
- ACRN Hypervisor: The bare-metal hypervisor layer responsible for CPU scheduling, memory management, and device virtualization.
- Service OS (S-OS): A privileged VM (typically a lightweight Linux distribution) that boots first. It’s responsible for managing hardware resources, acting as a device mediator for User OSes, and providing services like networking and storage to U-OS guests.
- User OS (U-OS): Unprivileged VMs, like our AAOS instance, that run on top of the hypervisor. They interact with hardware either through direct passthrough (for high-performance devices) or via virtio interfaces exposed by the Service OS.
For AAOS, devices like GPU for display, touchscreen input, and potentially USB ports or specific network interfaces are critical. These can either be directly passed through to the AAOS U-OS if supported by the hardware and hypervisor, or accessed via virtualized (virtio) devices managed by the S-OS.
Prerequisites and Development Environment Setup
This guide assumes you have an Intel-based development board with VT-x and VT-d (IOMMU) support. Popular choices include Intel NUC kits (e.g., NUC7i7DNHE) or UP Squared boards. We’ll use Ubuntu 20.04 LTS as the host environment for building ACRN and the Service OS.
1. Hardware & BIOS Configuration
Ensure your hardware meets the requirements and that virtualization features are enabled in the BIOS/UEFI:
- Intel Virtualization Technology (VT-x)
- Intel VT-d (IOMMU)
- Disable Secure Boot (for initial setup)
- Set boot mode to UEFI
2. Ubuntu Host Setup
Install Ubuntu 20.04 LTS. After installation, update your system and install necessary build tools:
sudo apt update && sudo apt upgrade -ysudo apt install git build-essential bison flex libssl-dev libelf-dev xz-utils libncurses-dev uuid-dev iasl python3-pip python3-setuptools python3-wheel python3-psutil python3-pyelftools
Building ACRN from Source
1. Clone the ACRN Repository
Obtain the latest stable release or a specific branch of ACRN:
git clone https://github.com/projectacrn/acrn-hypervisor.gitcd acrn-hypervisorgit checkout <your_desired_branch_or_tag> # e.g., v3.0
2. Configure and Build the Hypervisor
ACRN uses a Kconfig-like system for configuration. We’ll use a pre-defined board configuration as a starting point, then customize it for an AAOS U-OS scenario.
make BOARD=apl-mpr # Example: Apollo Lake platform, often used for automotive reference
This command generates a default configuration for the specified board. You can further customize it using `make menuconfig` if needed, for instance, to enable specific debugging options or adjust memory allocations. After configuration, build the hypervisor:
make
This will produce the `acrn.bin` hypervisor image and `acrn.efi` loader in the `build/hypervisor/` directory.
Preparing Android Automotive OS (AAOS) as a User OS
Building AAOS is a complex process in itself. For brevity, we’ll assume you have a working AAOS source tree (e.g., AOSP master or a specific branch) and the necessary build environment configured. The key modifications for virtualization involve the AAOS kernel.
1. AAOS Kernel Modifications
You’ll need to configure the AAOS kernel to be virtualization-aware and to use virtio devices. Navigate to your AAOS kernel source directory:
cd <AAOS_SOURCE_ROOT>/kernel/common # or your specific kernel path
Ensure the following kernel configuration options are enabled (you might need to run `make menuconfig` and search):
CONFIG_VIRTIO=yCONFIG_VIRTIO_MENU=yCONFIG_VIRTIO_PCI=yCONFIG_VIRTIO_MMIO=yCONFIG_VIRTIO_BLK=yCONFIG_VIRTIO_NET=yCONFIG_VIRTIO_CONSOLE=yCONFIG_VIRTIO_GPU=yCONFIG_VIRTIO_VSOCK=yCONFIG_PARAVIRT=yCONFIG_KVM_GUEST=y
Build your AAOS kernel and its modules. The output will typically be `Image` or `Image.gz` (kernel) and a `ramdisk.img` (initial ramdisk) or a full `super.img` that contains the system, vendor, and product partitions.
source build/envsetup.shlunch aosp_car_x86_64-userdebug # Example targetmake bootimage # or make -j$(nproc)
Configuring ACRN for AAOS U-OS Launch
ACRN uses an XML configuration file to define VM properties. The `acrn-config` tool helps generate the launch script.
1. Create a VM Configuration File (e.g., `aaos_vm.xml`)
This is a simplified example. You’ll need to adjust CPU, memory, and device passthrough based on your hardware and AAOS requirements. Place this file in `acrn-hypervisor/acrn-config/xmls/boards/apl-mpr/` (or your chosen board path).
<!-- aaos_vm.xml --><vm id=
Android Mobile Specs & Compare Directory
Are you researching mobile hardware properties, processor SoCs, GPU chipsets, or RAM configurations? Access our complete specs catalog to compare up to 5 devices side-by-side!
Compare Devices Specs →