This Quickstart provides you with the tools and know-how to install and work with the Android Board Support Package (BSP) for the phyCORE-AM57x Rapid Development Kit. This Quickstart shows you how to do everything from installing the appropriate tools and source, to building custom kernels, to deploying the OS, to exercising the software and hardware. Please refer to the phyCORE-AM57x Hardware Manual for specific information on board-level features such as jumper configuration, memory mapping and pin layout for the phyCORE-AM57x System on Module (SOM) and baseboard. Additionally, gain access to the SOM and baseboard schematics for the phyCORE-AM57x Rapid Development Kit by submitting a Request for Schematic Files from the PHYTEC Service Desk. Sign up or login here: https://support.phytec.com.
The following system requirements are necessary to successfully complete this Quickstart. Deviations from these requirements may suffice, or may have other workarounds.
AC adapter supplying 12VDC / min. 2A
SD card reader operational under Linux
8GB or 16GB SD Card
Android development requires certain packages to be installed. The commands below are separated into two categories: for flashing, and for building.
These packages are the bare minimum required to flash pre-built images to the target. Specifically phablet-tools contains fastboot and adb, and android-tools-fsutils contains make_ext4fs.
sudo apt-get install phablet-tools android-tools-fsutils git |
If your goal is to flash images and not build your own, you can continue to the Getting Started with Pre-built Images section |
These packages are required for building from our sources.
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip lzop device-tree-compiler |
Additionally, Android Nougat requires Java 1.8.x to be installed and configured.
We have provided Google's instructions for Ubuntu 14.04 below, based on their complete instructions for Ubuntu 14.04 and other Ubuntu versions that are available here: https://source.android.com/source/initializing#installing-the-jdk. |
This can be done with the following steps:
0f5aba8db39088283b51e00054813063173a4d8809f70033976f83e214ab56c0
9ef76c4562d39432b69baf6c18f199707c5c56a5b4566847df908b7d74e15849
6e47215cf6205aa829e6a0a64985075bd29d1f428a4006a80c9db371c2fc3c4c
Optionally, confirm the checksums of the downloaded files against the SHA256 strings using the sha256sum tool:
sha256sum {downloaded .deb file} |
Install the packages:
sudo apt-get update |
Run dpkg for the downloaded .deb files. It may produce errors due to missing dependencies:
sudo dpkg -i openjdk-8-* |
To fix missing dependencies:
sudo apt-get -f install |
(Optional) If there was another java version previously installed, update the default versions:
sudo update-alternatives --config java sudo update-alternatives --config javac |
Create a directory that will be used as the root for all of the sources and additional components needed for building:
sudo mkdir -p /opt/PHYTEC_BSPs sudo chown -R <user>: /opt/PHYTEC_BSPs # <user> should be replaced by your host's username mkdir -p /opt/PHYTEC_BSPs/am57xx cd /opt/PHYTEC_BSPs/am57xx export AM57XX_DIR=`pwd` mkdir -p afs cd afs export ANDROID_ROOT=`pwd` |
$AM57XX_DIR and $ANDROID_ROOT are referenced throughout this document. If you use a different directory instead of what is here, be sure to configure those variables accordingly. |
The Android Filesystem (AFS) contains a pre-built toolchain, but it is not 100% compatible with our external sources (the Linux kernel and U-boot) so we recommend downloading and utilizing a separate Linaro toolchain for this purpose:
wget https://releases.linaro.org/components/toolchain/binaries/5.3-2016.02/arm-linux-gnueabihf/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz tar -Jxvf gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz -C /opt/PHYTEC_BSPs rm gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf.tar.xz |
After extracting the toolchain, it needs to be added to the host's PATH to properly use it for building:
export PATH=/opt/PHYTEC_BSPS/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin:$PATH |
To make this change last beyond your current terminal session, use a text editor to modify your ~/.bashrc file and add it to the end. |
If you have not yet configured your Git environment on your host machine, please execute the following commands to set your user name and email address. See here for more information on getting started with Git.
git config --global user.email "your@email.com" git config --global user.name "Your Name" git config --global http.sslcainfo /etc/ssl/certs/ca-certificates.crt |
This section is intended to walk you through the steps required to retrieve, flash, and boot the released pre-built images.
If you made it this far without first visiting the Requirements, Development Host Setup, and Directory Setup sections please follow those links and return when your configuration meets the requirements and your environment is ready. |
Download the release images and script used for flashing
wget http://artifactory.phytec.com/artifactory/am57xx-images-released-public/BSP-Android-TI-AM57x-PD17.1.0.tar.bz2 mkdir -p $AM57XX_DIR/emmc_files tar -jxf BSP-Android-TI-AM57x-PD17.1.0.tar.bz2 -C $AM57XX_DIR/emmc_files cp /usr/bin/fastboot /usr/bin/make_ext4fs $AM57XX_DIR/emmc_files/. |
Optional command to free up disk space:
|
Flashing the BSP-Android-TI-AM57x-PD17.1.0 images requires initially booting the system using bootloaders loaded on an SD card.
Specifically, you will need an SD card with the first partition configured for roughly 64MiB. We recommend that you use the attached script here for simplicity: create-sdcard.sh
When using this script, it will ask if you want to create 2 or 3 partitions. Press 2. Further, when it asks if you would like to continue press N. |
After the card has been partitioned, remove and reinsert it in your card reader to automount the partitions in Ubuntu. Once the partitions appear in /media/<user>/, copy the MLO and u-boot.img bootloaders to the boot partition.
cp $AM57XX_DIR/emmc_files/MLO $AM57XX_DIR/emmc_files/u-boot.img /media/<user>/boot/. # as before, replace <user> with your host's username sync; umount /media/<user>/* |
Now that an SD card is loaded with bootloaders, the target is almost ready for booting.
The following image will help for the next steps below:
X24: connect a HDMI to Micro-HDMI cable between a consumer monitor and the target for video output
Although some HDMI monitors have touch capabilities, this is currently untested and therefore unsupported |
Type the following commands into the serial console to set up the u-boot environment:
env default -f -a set partitions $partitions_android saveenv env save reset |
Press any key in the serial console to stop in u-boot again and type this command to prepare the target for flashing:
fastboot 1 |
Now that the target is ready to receive images, we need to tell the host what to send over USB. To this end, we use the commands fastboot and the fastboot.sh script that has been created to facilitate the process.
If you are using a VM for your host PC, after performing the previous 'fastboot 1' command on the target, you will need to attach the 'Texas Instruments USB download gadget' device to it before the following commands will work. |
Perform these commands from the host:
cd $AM57XX_DIR/emmc_files sudo ./fastboot.sh |
This will start a flurry of output on both the host PC's terminal and the serial console. Once the transfer and flashing is complete, this is an example of what you will see on the host:
Following that, we use fastboot to reboot the board completely into Android with the following command:
sudo ./fastboot reboot |
Booting into Android will begin with an animated "android" logo visible on an attached display. Additionally, there will be console access to the filesystem shortly after the animated logo appears.
Booting is complete when a minimal Android home screen is visible.
To properly power the target down after you are finished with it, use the following command on the console:
reboot -p |
This section will explain how to build the individual pieces of the BSP from source to create your own customized images.
If you made it this far without first visiting and following the information provided in the Requirements and Development Host Setup sections, please follow those links and return when your configuration meets the requirements and your environment is ready. |
The first step to building the bootloaders is to fetch the source from the PHYTEC git repository:
cd $AM57XX_DIR git clone https://stash.phytec.com/scm/asdk/uboot-phytec.git -b BSP-Android-TI-AM57x-PD17.1.0 cd uboot-phytec |
After downloading the source you will have the BSP-Android-TI-AM57x-PD17.1.0 tag checked out and it is recommended that you create a branch from this location to manage any changes that you make to the source. The following command can be used to create a branch and switch to it:
git checkout -b "WIP/mychanges" # this is a basic example of a branch name |
Following that, the images can be built using the following make command:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- O=am57xx_phycore_rdk am57xx_phycore_rdk_defconfig all |
The Toolchain needs to be configured and added to your PATH for this command to work properly. Please revisit that section if you have a build error. |
The above make command creates the build in an output directory am57xx_phycore_rdk instead of in the local directory, keeping the local directory clean and all build settings contained. After it finishes, the MLO and u-boot.img binary images are located in the am57xx_phycore_rdk directory.
To flash these images using the fastboot.sh script utilized to Flash the Target with Pre-Built Images, copy them to the aforementioned emmc_files directory:
cp am57xx_phycore_rdk/MLO am57xx_phycore_rdk/u-boot.img $AM57XX_DIR/emmc_files/. |
Like the instructions for the bootloaders, you first need to fetch the kernel source from the PHYTEC git repository:
If you have already downloaded the AFS and completed the setup steps, you can skip the fetching steps mentioned below and use the kernel source located at $ANDROID_ROOT/device/phytec/am57xx_rdk-kernel. Keep in mind that any changes to the source here may be disregarded with future repo sync operations. |
cd $AM57XX_DIR git clone https://stash.phytec.com/scm/asdk/linux-phytec-ti.git -b BSP-Android-TI-AM57x-PD17.1.0 cd linux-phytec-ti |
After downloading the source you will have the BSP-Android-TI-AM57x-PD17.1.0 tag checked out and it is recommended that you create a branch from this location to manage any changes that you make to the source. The following command can be used to create a branch and switch to it:
git checkout -b "WIP/mychanges" # this is a basic example of a branch name |
Following that, the images can be built using the following make commands:
export KERNELDIR=`pwd` make ARCH=arm am57xx_phycore_rdk_defconfig make -j<N> ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- # replace <N> with the number of CPU threads you want to use. Suggested value for <N> is (number of CPU threads) - 1 |
The Toolchain needs to be configured and added to your PATH for this command to work properly. Please revisit that section if you have a build error. |
When the build is complete, you will find the kernel at arch/arm/boot/zImage and the devicetree binary at arch/arm/boot/dts/am57xx-phycore-rdk.dtb.
In Android, the kernel becomes part of the boot.img file/partition and cannot be flashed by itself, but to flash the devicetree binary using the fastboot.sh script utilized to Flash the Target with Pre-Built Images, copy it to the aforementioned emmc_files directory:
cp arch/arm/boot/dts/am57xx-phycore-rdk.dtb $AM57XX_DIR/emmc_files/. |
After completing the AFS steps involving repo init and repo sync, the kernel binary can be copied to $ANDROID_ROOT/device/phytec/am57xx_rdk/kernel to be included as part of boot.img in the next AFS build.
If boot.img already exists in $ANDROID_ROOT/out/target/product/am57xx_rdk/ then you will also need to remove it before initiating another AFS build or it will not be regenerated.
|
The Android filesystem contains many different git repositories and packages so we use the repo tool to fetch and prepare everything we need for building based on our customized manifest file.
cd $ANDROID_ROOT repo init -u https://stash.phytec.com/scm/asdk/platform-manifests.git -b nougat-mr1-release -m default.xml repo sync -j<N> # replace <N> with the number of threads you wish to use. For repo, this also means more parallel downloads and increased bandwidth usage in addition to CPU thread usage. |
If you notice general sluggishness of your network or repo appears to hang at any point, Ctrl + C to quit out of the repo command and reduce the number of threads in your repo sync command before continuing. |
After successfully fetching all of the sources, we need to apply a couple patches to modify TI's sources to build properly with our board.
cp device/phytec/am57xx_rdk/ti-proprietary-open-patches/patch-ti-proprietary-open.sh $ANDROID_ROOT/. ./patch-ti-proprietary-open.sh device/phytec/am57xx_rdk/ti-proprietary-open-patches |
If you built your own kernel, now is the best time to place it in $ANDROID_ROOT/device/phytec/am57xx_rdk to create a boot.img that matches your changes. |
Set up the AFS build environment and set it to build for the phyCORE-AM57xx RDK
source build/envsetup.sh lunch full_am57xx_rdk-userdebug |
Lastly, initiate the build.
make -j<N> # replace <N> with the number of CPU threads you want to use. Suggested value for <N> is (number of CPU threads) - 1. |
Build time will vary based on host specifications and dedicated threads, but expect a clean build to take a minimum of one hour. |
After the build is complete, the output images are in out/target/product/am57xx_rdk.
To flash these images using the fastboot.sh script utilized to Flash the Target with Pre-Built Images, copy them to the aforementioned emmc_files directory:
cp $ANDROID_ROOT/out/target/product/am57xx/*.img $AM57XX_DIR/emmc_files/. |
If the kernel .config has been modified, potentially resulting in different headers, the SGX kernel module pvrsrvkm.ko will need to be rebuilt and a new system.img generated that contains it. The following commands will need to be executed:
# configure additional environment variables export CROSS_COMPILE=$ANDROID_ROOT/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi- export KERNEL_CROSS_COMPILE=arm-linux-gnueabihf- export OUT_DIR=$ANDROID_ROOT/out cd device/ti/proprietary-open/jacinto6/sgx_src/eurasia_km/eurasiacon/build/linux2/omap_android make ARCH=arm TARGET_PRODUCT="am57xx_rdk" BUILD=release |
$ANDROID_ROOT and $KERNELDIR are set at different stages in this document and need to be configured for the above make command to work successfully. Please refer to Directory Setup and Building the Kernel sections to set these appropriately. |
After the make command succeeds, you can find the new SGX module here: $ANDROID_ROOT/device/ti/proprietary-open/jacinto6/sgx_src/eurasia_km/eurasiacon/binary2_omap_android_release/target/pvrsrvkm.ko. To make it part of your next AFS build, it needs to be copied to the system directory and some files deleted to force system.img to be rebuilt:
cp $ANDROID_ROOT/device/ti/proprietary-open/jacinto6/sgx_src/eurasia_km/eurasiacon/binary2_omap_android_release/target/pvrsrvkm.ko $ANDROID_ROOT/out/target/product/am57xx_rdk/system/lib/modules/pvrsrvkm.ko rm -f $ANDROID_ROOT/out/target/product/am57xx_rdk/system.img rm -f $ANDROID_ROOT/out/target/product/am57xx_rdk/obj/PACKAGING/systemimage_intermediates/system.img |
Now the next make command run from $ANDROID_ROOT should generate a new system.img with the updated SGX module.
cd $ANDROID_ROOT make -j<N> # replace <N> with the number of CPU threads you want to use. Suggested value for <N> is (number of CPU threads) - 1. |