Trusty System Basics

Chapter 4: Hardware & Toolchain Preparation

4. Hardware & Toolchain Preparation

4.1 Recommended Development Boards

For Trusty OS development, we recommend the following platforms:

Option 1: Google Pixel Phones (Recommended)

Note: Pixel devices provide the most authentic TrustZone environment with production-grade hardware security features.

Option 2: QEMU Emulator (For Beginners)

Hardware Considerations

When selecting hardware for Trusty development:

  • Ensure the device supports fastboot oem commands
  • Verify bootloader unlock capability
  • Check for available Trusty TEE debugging interfaces
  • Consider device-specific Trusty implementations

4.2 AOSP Integrated Build Environment Configuration

Trusty development requires the Android Open Source Project (AOSP) build environment.

System Requirements

Setup Steps

  1. Install required packages:
    sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev \
    gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev \
    libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig
  2. Configure Git:
    git config --global user.name "Your Name"
    git config --global user.email "you@example.com"
  3. Install repo tool:
    mkdir ~/bin
    curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
    chmod a+x ~/bin/repo
  4. Add to PATH in ~/.bashrc:
    export PATH=~/bin:$PATH
  5. Initialize AOSP repository (choose branch):
    mkdir ~/aosp
    cd ~/aosp
    repo init -u https://android.googlesource.com/platform/manifest -b android-12.0.0_r1
  6. Sync the source code:
    repo sync -j4
Pro Tip: Use repo sync -j$(nproc --all) to use all available CPU cores for faster synchronization.

4.3 Cross-Compilation Toolchain (AOSP Prebuilts)

AOSP provides prebuilt toolchains for Trusty development.

Toolchain Components

Environment Setup

Add these to your .bashrc or build script:

export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:<AOSP_ROOT>/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin
export TRUSTY_TOP=<AOSP_ROOT>/trusty

Building Trusty Components

  1. Navigate to Trusty directory:
    cd $TRUSTY_TOP
  2. Set up build environment:
    . ./build/envsetup.sh
  3. Select target device:
    lunch trusty_<device>-userdebug
  4. Build Trusty OS:
    make -j$(nproc --all)

Important Notes

  • Always use the toolchain versions specified in AOSP manifests
  • Mixing toolchain versions can cause subtle TrustZone issues
  • For production builds, consider using the trusty_release target