Author: Sam Protsenko <semen.protsenko at linaro dot org>

Date: 25 Apr 2018

Booting Android-O on AM57x EVM / BeagleBoard X15 boards

This document describes how to build and boot Android "Oreo" on TI AM57x EVM and X15 boards.

Setting up the board

Here is the minimal required connectivity set to work with AM57x EVM board:

  • Power supply: "Curtis Industries" DT060AF-5, 12V adapter, 5A (60W); positive inner, female barrel 5.5 mm x 2.5 mm

  • OTG cable: USB "A" to USB-Micro "B" (example).

    • OTG cable will be used for:
    • flashing images to eMMC via fastboot tool

    • adb tool

  • Serial console cable: Recommended cable for serial console is TTL-232R-3V3 (datasheet).

    • Connection scheme:


For X15 board you will also need HDMI cable and external monitor

For complete accessories list, please refer to BeagleBoard X15 Quick Start Guide.

Host configuration

Serial console

Install minicom:

$ sudo aptitude install minicom

Add your user to dialout group to be able to use minicom without root permissions:

$ sudo usermod -a -G dialout $USER

Logout/login in your OS.

Configure minicom:

$ sudo minicom -s

Select "Serial port setup" menu item and choose next settings:

  • Serial Device: /dev/ttyUSB0
  • Bps/Par/Bits: 115200 8N1
  • Hardware Flow Control: No

Then select "Save setup as dfl" and "Exit from Minicom".

Now you should be able to have serial connection with your board:

$ minicom

udev rules for OTG USB

In order for fastboot to work without root permissions, create (or edit) /etc/udev/rules.d/51-android.rules file:

$ sudo vim /etc/udev/rules.d/51-android.rules

and add next text to it:

# Texas Instruments
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", MODE="0664", GROUP="plugdev"

Restart udev:

$ sudo udevadm control --reload-rules
$ sudo udevadm trigger

Downloading the software


Obtain U-Boot sources:

$ git clone git:// u-boot
$ cd u-boot
$ git checkout ti-u-boot-2018.01


Obtain kernel sources:

$ git clone git:// linux
$ cd linux
$ git checkout ti-android-linux-4.14.y


Make sure you have a bin/ directory in your home directory and that it is included in your path:

$ mkdir ~/bin
$ export PATH=~/bin:$PATH

Download the Repo tool and ensure that it is executable:

$ curl > ~/bin/repo
$ chmod a+x ~/bin/repo

Obtain AFS sources:

$ mkdir android
$ cd android
$ repo init -u git:// -b oreo-mr1-core-dev
$ repo sync -j20


Next toolchains will be used:

  • for U-Boot: Linaro GCC toolchain
  • for kernel: Linaro GCC toolchain
  • for Android: internal Android toolchains

Download and unpack Linaro GCC toolchain:

$ cd /opt
$ sudo wget
$ sudo tar xJvf gcc-linaro-7.2.1-2017.11-x86_64_arm-eabi.tar.xz
$ sudo rm gcc-linaro-7.2.1-2017.11-x86_64_arm-eabi.tar.xz

Build instructions

Setting up build environment

Next environment should be used to build the U-Boot and Linux kernel:

$ export PATH=/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-eabi/bin:$PATH
$ export CROSS_COMPILE=arm-eabi-
$ export ARCH=arm

Building U-Boot

Build U-Boot using next commands:

$ make am57xx_evm_defconfig
$ make -j4

Output files:

  • 1st stage: MLO

  • 2nd stage: u-boot.img

Building the kernel

Build Linux kernel using next commands:

$ ./ti_config_fragments/ -t ti_sdk_dra7x_android_release
$ make ti_sdk_dra7x_android_release_defconfig
$ make -j4 zImage dtbs modules

Output files:

  • kernel image: arch/arm/boot/zImage

  • device tree blobs: arch/arm/boot/dts/ti/*.dtb*

Building Android

Follow instructions from official Android page for setting up the packages required for building Android.

Install package for mkimage tool (external dependency for building FIT images):

$ sudo aptitude install u-boot-tools

Build Android FS using next commands:

$ export KERNELDIR=<path to your kernel directory>
$ . build/
$ lunch am57xevm_full-userdebug
$ make -j4

Output files:

  • host files: out/host/linux-x86/bin/*

  • target files: out/target/product/am57xevm/*

Boot from SD card

SD card boot can be helpful in next cases:

  • Brand-new board doesn't have any software flashed into its eMMC. So SD card should be used to bring it up
  • SD card boot also can be helpful when the board is "bricked" (eMMC boot doesn't work)

If your board already has U-Boot in eMMC -- skip this step. AM57xx EVM board supports only micro-SD cards.

Format SD card

SD card needs to have 2 partitions on it: "boot" (FAT32) and "rootfs" (ext4).

Script below will partition and format SD card for you (making 100MB for "boot" partition and the rest of SD card for "rootfs").

NOTE: Be sure to use sfdisk 2.27.* or above. It was noticed that my script doesn't work with sfdisk 2.25.2.

   1 #!/bin/bash
   3 disk=""
   4 boot_part=""
   5 rootfs_part=""
   7 print_usage() {
   8         echo "Usage: $0 sd_card_device"
   9         echo
  10         echo "Example:"
  11         echo "    $0 /dev/mmcblk0"
  12 }
  14 parse_arguments() {
  15         if [ $# -ne 1 ]; then
  16                 echo "Error: Wrong arguments count" >&2
  17                 print_usage
  18                 exit 1
  19         fi
  21         disk=$1
  22         if [ ! -e $disk ]; then
  23                 echo "Error: $disk file not found" >&2
  24                 exit 1
  25         fi
  27         if [[ $disk = *"mmcblk"* ]]; then
  28                 boot_part=${disk}p1
  29                 rootfs_part=${disk}p2
  30         else
  31                 boot_part=${disk}1
  32                 rootfs_part=${disk}2
  33         fi
  34 }
  36 ask_confirmation() {
  37         read -r -p "You are about to format $disk. Are you sure? "
  38         case $REPLY in
  39                 [Yy]*)
  40                         echo "[II] Start formatting..."
  41                         echo
  42                         ;;
  43                 *)
  44                         echo "[II] Exiting..."
  45                         exit 1
  46                         ;;
  47         esac
  48 }
  50 create_partitions() {
  51         echo "---> Erase partition table/labels on micro-SD card..."
  52         sudo dd if=/dev/zero of=${disk} bs=1M count=1
  54         echo
  55         echo "---> Create partition layout..."
  56         sudo sfdisk ${disk} << EOF
  57                 2048,100M,0x0c,*
  58                 ,,L,-
  59 EOF
  61         if [ ! -e $boot_part ]; then
  62                 echo "Error: $boot_part file not found" >&2
  63                 exit 1
  64         fi
  66         if [ ! -e $rootfs_part ]; then
  67                 echo "Error: $rootfs_part file not found" >&2
  68                 exit 1
  69         fi
  71         echo
  72         echo "---> Format partitions..."
  73         echo "  --> Format partition 1 (boot)..."
  74         sudo mkfs.vfat -F 32 -n "boot" $boot_part
  75         echo "  --> Format partition 2 (rootfs)..."
  76         sudo mkfs.ext4 -F -L "rootfs" $rootfs_part
  77 }
  79 parse_arguments $*
  80 ask_confirmation
  81 create_partitions

Copying files

Copy next files to "boot" partition of your SD card:

 - MLO
 - u-boot.img

Flashing U-Boot to eMMC

1. Insert your SD card into board's slot and press power or reset button to start.

2. Once you can see U-Boot output in "minicom" -- press any key to get into U-Boot shell.

3. Run next commands in U-Boot shell:

=> env default -f -a
=> setenv partitions $partitions_android
=> env save
=> fastboot 1

4. On your host:

$ fastboot oem format
$ fastboot flash xloader MLO
$ fastboot flash bootloader u-boot.img

(you can find fastboot tool in your AFS host output directory).

5. Press "Ctrl+C" in U-Boot shell to get out from fastboot mode (or just reboot your board).

6. Check that eMMC has correct partition table (optional):

=> part list mmc 1

7. Remove SD card from your board. Now you can run U-Boot from eMMC (just reset the board).

Booting Android from SD

Here we won't copy Android rootfs to SD boot, because we are only using SD card to re-flash bootloader to eMMC. If you are interested in booting Android from SD, see this link:

Preparing images

Preparing eMMC binaries/images

Copy next files to the directory that will contain binaries for flashing:

From U-Boot:

  • MLO

  • u-boot.img

From Android (from out/target/product/am57xevm/):

  • boot_fit.img

  • cache.img

  • recovery.img

  • system.img

  • userdata.img

  • vendor.img

Flashing eMMC images

Get to U-Boot shell on device and run next command:

=> fastboot 1

Run next commands on host, from directory with eMMC images:

$ fastboot erase environment
$ fastboot flash xloader MLO
$ fastboot flash bootloader u-boot.img
$ fastboot flash boot boot_fit.img
$ fastboot flash cache cache.img
$ fastboot flash recovery recovery.img
$ fastboot flash system system.img
$ fastboot flash userdata userdata.img
$ fastboot flash vendor vendor.img

Now you can reboot your board and Android will be booted from eMMC.

[1] Android-O Release Notes for Jacinto 6 (DRA7 EVM)

Boards/BeagleBoard-X15 (last modified 2018-05-11 13:30:37)