This BSP Development Guide walks through the installation and build steps for the Android Board Support Package (BSP) for the phyCORE-i.MX8M mini development kit (phyBOARD-Polis). Building BSP images from source is useful for those who require modifying the default Android image and require a way to deploy those changes in an easy and reproducible way.

Please refer to the phyCORE-i.MX8M mini Hardware Manual for specific information on board-level features such as jumper configuration, memory mapping and pin layout for the phyCORE-i.MX8M mini System on Module (SOM) and baseboard. Additionally, gain access to the SOM and carrier board schematics for the phyCORE-i.MX8M mini development kit by submitting a Request for Schematic Files from the PHYTEC Service Desk. Sign up or login here: https://support.phytec.com.

Requirements


The following are needed to successfully perform the steps outlined in this guide. Deviations from these requirements may suffice, or may have other workarounds.

  • A modern GNU/Linux Operating host system either natively or via a virtual machine:
    • Ubuntu 18.04 LTS recommended, 64-bit required. Other distributions will likely work, please note that some setup information as well as OS-specific commands and paths may differ
    • If using a virtual machine, VMWare Workstation, VMWare Player, and VirtualBox are all viable solutions
  • Root access to your Linux Host PC. Some commands in the Quickstart will not work if you don’t have sudo access (ex. package installation, formatting SD card)
  • At least 200 GB of free disk space on the Linux Host PC
  • Active Internet connection

Host Setup


These packages are required for building the Android BSP from PHYTEC sources. 

Host (Ubuntu)

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 uuid uuid-dev liblz-dev liblzo2-2 liblzo2-dev u-boot-tools mtd-utils android-tools-fsutils openjdk-8-jdk device-tree-compiler gdisk m4 libz-dev libssl-dev
CODE

The above is the recommended package installation for development on a Ubuntu 18.04 LTS Linux distribution. For a breakdown of the packages, as well as a list of packages required for other Linux distributions, see the following Android Guide by NXP:

https://www.nxp.com/docs/en/user-guide/ANDROID_USERS_GUIDE.pdf

Build the BSP


  • Download the BSP source package from NXP: https://www.nxp.com/webapp/Download?colCode=Q10.0.0_2.0.0_ANDROID_SOURCE&appType=license
  • Navigate to the source tarball's location in your filesystem: 

    Host (Ubuntu)

    cd ~/Downloads
    CODE
  • Unpack the tarball: 

    Host (Ubuntu)

    tar -xf imx-android-10.0.0_2.0.0.tar.gz -C ~
    CODE

    Once unpacked, the tarball can be removed to save on disk space:

    rm imx-android-10.0.0_2.0.0.tar.gz
    CODE
  • Navigate into the source directory: 

    Host (Ubuntu)

    cd ~/imx-android-10.0.0_2.0.0
    export ANDROID_BSP_ROOT=`pwd`
    CODE
  • Download the PHYTEC setup script. This custom setup script needs to be used in order to add support for PHYTEC hardware. 

    Host (Ubuntu)

    wget https://artifactory.phytec.com/artifactory/imx8mm-images-released-public/imx_android_setup-ALPHA1.sh
    CODE
  • Give the PHYTEC setup script executable permissions: 

    Host (Ubuntu)

    chmod +x imx_android_setup-ALPHA1.sh
    CODE
  • Run the PHYTEC setup script: 

    Host (Ubuntu)

    ./imx_android_setup-ALPHA1.sh
    CODE

    The PHYTEC setup script will fetch various source repositories to a local build directory. In order to increase the speed of this process, an optional argument can be given to share the fetch process across multiple threads. Reference the following:

    Host (Ubuntu)

    ./imx_android_setup-ALPHA1.sh -jX
    CODE

    The X here specifies the number threads to be used. It is important to not overwhelm your build machine by specifying more tasks than it has cores. For example, if your build system has 8x cores, leave 2x cores for other system tasks. You can check the number of cores your build machine has available by using the following command:

    Host (Ubuntu)

    nproc --all
    CODE
  • Once the local build directory is setup, navigate into it: 

    Host (Ubuntu)

    cd android_build/
    CODE
  • Source the build environment: 

    Host (Ubuntu)

    source build/envsetup.sh
    CODE
  • Launch the distributed process manager for the build: 

    Host (Ubuntu)

    lunch phyboard_polis-userdebug
    CODE
  • Start the build: 

    Host (Ubuntu)

    ./imx-make.sh
    CODE

    In order to increase the speed of the overall build, an optional argument can be given to leverage parallel compilation. Reference the following:

    Host (Ubuntu)

    ./imx-make.sh -jX
    CODE

    The X here specifies the number threads to be used. It is important to not overwhelm your build machine by specifying more tasks than it has cores. For example, if your build system has 8 cores, specify "-j6" in order to reserve 2 cores for other system tasks. You can check the number of cores your build machine has available by using the following command:

    Host (Ubuntu)

    nproc --all
    CODE

Built Images


All images generated by the build are deployed to $ANDROID_BSP_ROOT/android_build/out/target/product/phyboard_polis/ 

Deployed FileDescription
boot.imgBootloader image
u-boot.imxThe bootloader used by UUU for phyCORE-i.MX 8M mini with LPDDR4 on it. It will not be flashed to MMC.

partition-table.img

GPT partition table image for single bootloader condition. Used for 16 GB SD Card and eMMC.
dtbo-imx8mm.imgDevice Tree image for phyCORE-i.MX 8M mini development kit.
vbmeta-imx8mm.imgAndroid Verify boot metadata image for dtbo-imx8mm.img.
product.imgLogical partition product_a and logical partition product_b in super partition.
system.imgLogical partition system_a and logical partition system_b in super partition.
vendor.imgLogical partition vendor_a and logical partition vendor_b in super partition.
uuu_imx_android_flash.sh

Flash script used to program the boot media of the phyCORE-i.MX8M mini development kit.

fsl-sdcard-partition.sh

Flash script used to program the boot media of the phyCORE-i.MX8M mini development kit.

fastboot_imx_flashall.sh

Flash script used to program the boot media of the phyCORE-i.MX8M mini development kit.

lpmakeCommand-line tool for creating Android Logical Partition images.