Using Reference Boards

You can create builds for Nexus and Pixel devices using Android Open Source Project (AOSP) builds and the relevant hardware-specific binaries. For available Android builds and targeted devices, see Source code tags and builds.

You can also create builds for DragonBoard 845c, HiKey 960 and Khadas VIM3 Android reference boards, which are designed to help nonmobile component vendors develop and port drivers to Android releases. Using a reference board can ease upgrade efforts, reduce time to market for new Android devices, lower device costs by enabling ODM/OEMs to choose from a wider range of compatible components, and increase the speed of innovation among component suppliers.

Google supports DragonBoard 845c, HiKey 960 and Khadas VIM3 Android reference boards. AOSP provides kernel source and board support for these boards, so developers can easily create and debug peripheral drivers, do kernel development, and perform other tasks with fewer OEM encumbrances.

DragonBoard 845c

The DragonBoard 845c is part of the RB3 platform and is available from 96boards.org.

Dragonboard image

Figure 1. DragonBoard 845c

Compiling userspace

Use the following commands to download and build Android on the DragonBoard 845c.

  1. Download the Android source tree:

    repo init -u https://android.googlesource.com/platform/manifest -b master
    repo sync -j8
    
  2. Build:

    . ./build/envsetup.sh
    lunch db845c-userdebug
    make -j24
    

Installing local images

  1. Boot db845c into fastboot mode (see DragonBoard Recovery).

  2. Run following command:

    ./device/linaro/dragonboard/installer/db845c/flash-all-aosp.sh
    

Alternately, you can perform QDL board recovery by running the following script after booting db845c in USB flashing mode:

./device/linaro/dragonboard/installer/db845c/recovery.sh

Flashing images from ci.android.com

You can use flash.android.com to easily test the latest AOSP build artifacts from ci.android.com. You don't need to build, but you need to have a DragonBoard 845c already flashed with the latest bootloader in AOSP before you begin.

  1. In a web browser, go to flash.android.com.

  2. Click Get Started then skip step 1 (as your device is already in developer mode).

  3. In available, locate DragonBoard 845c (db845c). If you don't see it, click + Add new device then select either Android gadget or Android device from the list.

  4. Select DragonBoard 845c (db845c).

  5. Click Select a build ID and choose the most recent build.

  6. Click Install.

  7. Follow the remaining instructions and wait while the board is flashed.

Congratulations, your DragonBoard 845c is now running the very latest AOSP build!

Building the kernel

To build the DragonBoard db845c Android Generic Kernel Image (GKI) kernel artifacts:

  1. Run following commands to clone the kernel source and prebuilt Android toolchains and build scripts.

    mkdir repo-common
    cd repo-common
    repo init -u https://android.googlesource.com/kernel/manifest -b common-android-mainline
    repo sync -j8 -c
    rm -rf out
    BUILD_CONFIG=common/build.config.db845c ./build/build.sh
    
  2. Delete all objects in ${AOSP_TOPDIR}device/linaro/dragonboard-kernel/android-mainline/ then copy build artifacts from out/android-mainline/dist/ to ${AOSP_TOPDIR}/device/linaro/dragonboard-kernel/android-mainline/ then rebuild userspace with:

    make TARGET_KERNEL_USE=mainline -j24
    

    and flash the device with the new kernel (see Compiling userspace)

  3. Test the GKI kernel:

    1. View the latest kernel_aarch64 build.

    2. In artifacts, download Image.gz and copy it to ${AOSP_TOPDIR}/device/linaro/dragonboard-kernel/android-mainline/.

    3. Build and flash the device with the new kernel (see Compiling userspace).

HiKey 960 boards

The HiKey 960 board is available from Amazon and Lenovator.

HiKey 960 board image

Figure 2. HiKey 960 board by Lenovator

Compiling userspace

Use the following commands to download and build Android on the HiKey 960 board.

  1. Download the Android source tree:

    repo init -u https://android.googlesource.com/platform/manifest -b master
    repo sync -j8
    
  2. Build:

    . ./build/envsetup.sh
    lunch hikey960-userdebug
    make -j24
    

Installing initial images

  1. Select fastboot mode by turning ON switch 3 (for details, refer to the HiKey 960 Getting Started guide).

  2. Power the board.

  3. Flash initial images:

    cd device/linaro/hikey/installer/hikey960
    
  4. Turn OFF switch 3 and power cycle the board.

Flashing images

  1. Enter fastboot mode by turning ON switch 3.

  2. Flash images by running the following commands:

    fastboot flash boot out/target/product/hikey960/boot.img
    
  3. Turn OFF switch 3 and power cycle the board.

Building the kernel

To build the HiKey960 Android GKI kernel artifacts:

  1. Run the following commands:

    mkdir repo-common
    cd repo-common
    repo init -u https://android.googlesource.com/kernel/manifest -b common-android12-5.4
    repo sync -j8 -c
    rm -rf out
    BUILD_CONFIG=common/build.config.hikey960 build/build.sh
    
  2. Delete all objects in ${AOSP_TOPDIR}device/linaro/hikey-kernel/hikey960/5.4/ then copy build artifacts from the kernel build in out/android12-5.4/dist/ to ${AOSP_TOPDIR}/device/linaro/hikey-kernel/hikey960/5.4/

  3. Concatenate the DTB:

    cat device/linaro/hikey-kernel/hikey960/5.4/Image.gz
    device/linaro/hikey-kernel/hikey960/5.4/hi3660-hikey960.dtb  > 
    device/linaro/hikey-kernel/hikey960/5.4/Image.gz-dtb
    
  4. Build Android Userspace

    lunch hikey960-userdebug
    make TARGET_KERNEL_USE=5.4 HIKEY_USES_GKI=true -j24
    

    and flash the device with the new kernel (see Compiling userspace)

  5. Test the Generic Kernel Image (GKI) kernel

    • View the latest kernel_aarch64 build.

    • In artifacts, download Image file and copy it to ${AOSP_TOPDIR}/device/linaro/hikey-kernel/hikey960/5.4/.

    • Compress the image and concatentate the DTB

    gzip ${AOSP_TOPDIR}/device/linaro/hikey-kernel/hikey960/5.4/Image
    cat ${AOSP_TOPDIR}/device/linaro/hikey-kernel/hikey960/5.4/Image.gz
    ${AOSP_TOPDIR}/device/linaro/hikey-kernel/hikey960/5.4/hi3660-hikey960.dtb  >
    ${AOSP_TOPDIR}/device/linaro/hikey-kernel/hikey960/5.4/Image.gz-dtb
    

Setting the serial number

To set the random serial number, run:

  fastboot getvar nve:SN@16\_DIGIT\_NUMBER

Bootloader exports the generated serial number to the kernel using androidboot.serialno=.

Setting monitor resolution

Edit the device/linaro/hikey/hikey960/BoardConfig.mk parameter BOARD_KERNEL_CMDLINE and configure the video setting. For example, the setting for a 24-inch monitor is video=HDMI-A-1:1280x800@60.

VIM3 and VIM3L boards

The Vim3 and VIM3L boards by Khadas are available from Khadas website

VIM3 board image

Figure 3. VIM3 board by Khadas

Compiling userspace

Use the following commands to download and build Android on the VIM3 board.

  1. Download the Android source tree:

    repo init -u https://android.googlesource.com/platform/manifest -b master
    repo sync -j8
    
  2. Build:

    . ./build/envsetup.sh
    lunch yukawa-userdebug
    make TARGET_USE_TABLET_LAUNCHER=true TARGET_VIM3=true -j24
    

    By default, Android is built with the 4.19 kernel. To use kernel 5.4 prebuilts:

    make TARGET_USE_TABLET_LAUNCHER=true TARGET_VIM3=true TARGET_KERNEL_USE=5.4 -j24
    

    For VIM3L, use:

    make TARGET_USE_TABLET_LAUNCHER=true TARGET_VIM3L=true -j24
    

Installing initial images

  1. Put the board in USB upgrade mode following VIM3 flashing instructions.

  2. Flash initial images to RAM:

    cd path/to/aosp/device/amlogic/yukawa/bootloader/
    ./tools/update write u-boot_kvim3_noab.bin 0xfffa0000 0x10000
    ./tools/update run 0xfffa0000
    ./tools/update bl2_boot u-boot_kvim3_noab.bin
    
    • If you encounter permission issues, refer to the udev rules section to add the appropriate USB rules.
    • If tools/update doesn't work, use the pyamlboot tool to flash the board instead.
  3. After U-Boot boots and runs fastboot, run the following commands:

    fastboot oem format
    fastboot flash bootloader u-boot_kvim3_noab.bin
    fastboot erase bootenv
    fastboot reboot bootloader
    
  4. Unplug and Plug Power cable.

The board should boot into the just-flashed U-boot and enter fastboot mode.

Flashing images

  1. Enter fastboot mode (see previous section for instructions).

  2. Flash all Android images:

    cd out/target/product/yukawa
    fastboot flash boot boot.img
    fastboot flash super super.img
    fastboot flash cache cache.img
    fastboot flash userdata userdata.img
    fastboot flash recovery recovery.img
    fastboot flash dtbo dtbo-unsigned.img
    fastboot reboot
    

Building the kernel

To build the kernel artifacts for VIM3 or VIM3L:

  1. Download additional toolchains:

    cd ${AOSP_TOPDIR}
    git clone https://android.googlesource.com/platform/prebuilts/gas/linux-x86 prebuilts/gas/linux-x86
    
  2. Clone the kernel source:

    # for 4.19
    git clone https://android.googlesource.com/kernel/hikey-linaro -b android-amlogic-bmeson-4.19
    # for 5.4
    git clone https://android.googlesource.com/kernel/hikey-linaro -b android-amlogic-bmeson-5.4
    
  3. Export build variables:

    export PATH=${AOSP_TOPDIR}/prebuilts/clang/host/linux-x86/clang-r399163b/bin:$PATH
    export PATH=${AOSP_TOPDIR}/prebuilts/gas/linux-x86:$PATH
    export PATH=${AOSP_TOPDIR}/prebuilts/misc/linux-x86/lz4:$PATH
    export ARCH=arm64
    export CROSS_COMPILE=aarch64-linux-gnu-
    export LLVM=1
    
  4. Build the kernel:

    cd hikey-linaro
    make meson_defconfig
    make DTC_FLAGS="-@" -j24
    
  5. Compress the kernel and copy build_artifacts to ${AOSP_TOPDIR}/device/amlogic/yukawa-kernel:

    lz4c -f arch/arm64/boot/Image arch/arm64/boot/Image.lz4
    KERN_VER=4.19 # for 4.19 kernel
    KERN_VER=5.4  # for 5.4 kernel
    for f in arch/arm64/boot/dts/amlogic/*{g12b-a311d,sm1}-khadas-vim3*.dtb; do
        cp -v -p $f ${AOSP_TOPDIR}/device/amlogic/yukawa-kernel/${KERN_VER}/$(basename $f)
    done
    cp -v -p arch/arm64/boot/Image.lz4 ${AOSP_TOPDIR}/device/amlogic/yukawa-kernel/${KERN_VER}/Image.lz4
    
  6. Rebuild Android userspace (see Compiling userspace) and flash the new kernel (see Flashing images).