Building Android

Prebuilt Images

If you don’t want to build Android from source, you can download prebuilt images:

Extract the archive and follow the flashing instructions.

Building from source

Fetching the code

Fetch the code using repo:

For Android 16 :

mkdir ~/src/khadas-aosp-16 && cd $_
repo init -u https://gitlab.baylibre.com/baylibre/amlogic/atv/aosp/manifest.git -b yukawa-android-16
repo sync

For more information about repo, visit Android’s official documentation

Note

To save same disk space, pass the --depth=1 option to repo init:

repo init -u https://gitlab.baylibre.com/baylibre/amlogic/atv/aosp/manifest.git -b yukawa-android-16 --depth=1

Setup

Refer to:

Build

For Android 16 :

cd ~/src/khadas-aosp-16
source build/envsetup.sh
lunch LUNCH-TARGET
m

Supported Lunch target:

Android lunch target

Android Variant

yukawa-bp2a-userdebug

TV Debug (VIM3/VIM3L)

We also support the following build flags to enable optional features:

  • TARGET_KERNEL_USE=6.12|mainline : Select Kernel version (default is 6.12)

  • TARGET_VIM3=true : Build for VIM3 Board

  • TARGET_VIM3L=true : Build for VIM3L Board (Default target)

  • TARGET_BUILTIN_EDID=true : This option allows to preload 1920x1080 EDID structure

  • TARGET_USE_TABLET_LAUNCHER=true : Use tablet launcher instead of Android TV launcher

Note

AVB (Android Verified Boot) is now enabled by default and cannot be disabled.

Initial Flashing instructions

Initial flashing instructions:

Flashing instructions

To reflash on a device which already has Android installed, run:

  1. Reboot to U-Boot

adb reboot bootloader
  1. Flash using the script: in a different terminal, change directory to out/target/product/yukawa and run :

# for VIM3
fastboot flash bootloader u-boot_kvim3_ab.bin && fastboot erase bootenv && fastboot reboot bootloader

# for VIM3L
fastboot flash bootloader u-boot_kvim3l_ab.bin && fastboot erase bootenv && fastboot reboot bootloader
  1. Reset U-Boot environment to default values:

Interrupt the U-Boot autoboot by pressing any key, then run the following commands:

env default -a
saveenv
reset

After the board resets, interrupt U-Boot again and enter fastboot mode:

fastboot 0
  1. Flash all partitions using the automated script:

./flash.sh

Note

The flash.sh script automatically handles:

  • Formatting the device with fastboot oem format

  • Flashing all required partitions (boot, super, dtbo, vbmeta, vendor_boot, init_boot, etc.)

  • Erasing misc and frp partitions

  • Formatting metadata partition

  • Rebooting the device

The script will reboot the device automatically when complete.