Building Freescale/Embedian’s Android M6.0.1_2.0.1 BSP Distribution
version 1.0a, 1/15/2017
This document describes how to build and deploy Android Marshmallow on the SMARC-FiMX6. It is based on NXP's IMX6_M6.0.1_2.1.0-ga ANDROID release.
Generating SSH Keys
In order to download u-boot and kernel from Embedian. We recommend you use SSH keys to establish a secure connection between your computer and Embedian Gitlab server. The steps below will walk you through generating an SSH key and then adding the public key to our Gitlab account.
Step 1. Check for SSH keys
First, we need to check for existing ssh keys on your computer. Open up Git Bash and run:
Check the directory listing to see if you have a file named either
id_dsa.pub. If you don't have either of those files go to step 2. Otherwise, you already have an existing keypair, and you can skip to step 3.
Step 2. Generate a new SSH key
To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.
Now you need to enter a passphrase.
Which should give you something like this:
Step 3. Add your SSH key to Embedian Gitlab Server
Copy the key to your clipboard.
Go to Embedian Git Server. At Profile Setting --> SSH Keys --> Add SSH Key
Paste your public key and press "Add Key" and your are done.
Overview of this document
The objective of this document is to guide SMARC-FiMX6 Android developers to obtain Android Marshmallow sources, setting up host environment, compilation and deployment.
This document contains instructions for:
- Hardware and software requirements.
- Setup the hardware.
- Setup the toolchain.
- Download & build the sources.
- Install the binaries on the SMARC-FiMX6 SOM.
EVK-STD-CARRIER and SMARC-FiMX6.
Host (PC) setup requirements
The host development environment for Android is based on Ubuntu and Debian, please install Ubuntu version 14.04 64bit LTSor Debian 8.4 64bit
Install required packages on host PC
Install the OpenJDK
Update the default Java version by running:
Obtain Source Code
Get NXP's Android Release Package
Go to NXP's website, download IMX6_M6.0.1_2.1.0_ANDROID_SOURCE_BSP (filename: android_M6.0.1_2.1.0_source.tar.gz) and put into your ~/downloads directory.
Download Google Android M6.0.1
Clone Embedian's U-Boot and Linux kernel sources
Apply all the i.MX Android patches with Freescale i.MX6 support
Apply Embedian's i.MX6 platforms' patches
Build Android Images
Change to Android top level directory.
Switching from eMMC build to SD card build and vice versa
When you switch your target MMC device you need to remove the fstab file. This will guarantee that the make system will copy the right one into target.
Build Android for SD card
Build Android for on-SMARC eMMC
Images created by the Android build for Embedian SMARC-FiMX6 system
All images will be created under out/target/product/smarc_mx6 directory.
|boot-<name1>-<name2>.img||Boot image that contains zImage, device tree blob and ramdisk|
|recovery-<name1>-<name2>.img||Recovery image that contains zImage, device tree blob and ramdisk|
|system.img||Android system image file.|
U-Boot boots from on-module SPI NOR flash, and the rest of the Android images will be loaded from SD card or on-module eMMC.
To flash u-boot into on-module SPI NOR flash. First, you need to prepare for a new SD card and insert into your Linux host PC. The u-boot-<defconfig>.imx is pre-installed in SPI NOR flash at factory default. SMARC-FiMX6 is designed to always boot up from SPI NOR flash and to load other Android images based on the setting of BOOT_SEL. If users need to fuse their own u-boot or perform u-boot upgrade. This section will instruct you how to do that.
For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.
Erase SD card:
Create Partition Layout:
With util-linux v2.26, sfdisk was rewritten and is now based on libfdisk.
On some systems, these partitions may be auto-mounted...
Copy u-boot-<defconfig>.imx to the boot partition.
If SPI NOR Flash is not empty (Factory Default)
Fuse u-boot.imx to the SPI NOR flash.
Insert the SD card that you just made into EVK-STD-CARRIER SD card slot. Stop at U-Boot command prompt (Press any key when booting up). Copy and Paste the following script under u-boot command prompt.
If SPI NOR Flash is empty
In some cases, when SPI NOR flash is erased or the u-boot is under development, we need a way to boot from SD card first. Users need to shunt cross the TEST# pin to ground. In this way, SMARC-FiMX6 will always boot up from SD card.
Insert the same SD card into your host Linux PC.
Copy u-boot.imx to the SD card.
Insert the SD card into EVK-STD-CARRIER. Stop at U-Boot command prompt (Press any key when booting up). Copy and Paste the following script under u-boot command prompt.
Setup SD card
Prepare for the othe SD card that is differmt from the one for bootloader. Insert into your Linux host PC
First, make sure the images that you built is for eMMC (use BUILD_TARGET_DEVICE=emmc when built Android).
Setup eMMC for Android is a bit complex, but trivial. There are a couple of ways to achieve it.
Use MFG Tools v2
NXP/Freescale provides with a way to boot up, partition, format, and program images into eMMC. User can go to NXP's website to download mfgtool and follow their guide to achieve it. We will leave it to users if you would like to use this method to set up your eMMC. Make sure that the FORCE_RECOV# pin has to be shunt to Ground when using this tool.
Use a Ubuntu 14.04 Bootable SD card
The second way that we also recommend is to make a bootable Ubuntu 14.04 SD card for SMARC-FiMX6. User go to our Linux Development Site to learn how to make a bootable Ubuntu 14.04 SD card. An pre-built images can be downloaded from our ftp site. Users can download those images and follow the "Setup SD card" section from our Linux development site. Once it done, you can copy the emb-mksdcard.sh scipt and all Android images into your home directory. Follow exactly what you did for SD card, but now, eMMC device will be emulated as /dev/mmcblk3.
Power off and set BOOT_SEL to OFF ON ON and you will be able to boot up your Android from on-module eMMC.
Use USB Fastboot
Once you have your on-module eMMC partitioned and formated.
On your Linux host PC, you need to install Android tools.
Connect the device with host PC at fastboot mode:
- Connect a USB OTG cable from the target board OTG port to a your host machine USB HOST port.
- Power up the board and hit return/space to stop the boot at U-Boot.
- type fastboot in the U-Boot command line.
On the Host PC:
Android Recovery Mode
Enter board in Android Recovery mode
Shunt LID# pin to ground will enter Android Recovery mode.
Update Android Firmware
Generate OTA Packages
For generating "OTA" packages, use the following commands:
Install OTA Packages to device
- Enter to Android Recovery mode
- Select menu item "apply update from ADB"
- To the host system, perform the following command:
Reboot the device.
When you perform changes to the kernel, you may build boot.img solely instead of building the whole Android.
Toolchain setup for manual build kernel and U-Boot
Setup the toolchain path to point to arm-eabi- tools in prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin
Manual build Bootloader
Change directory to U-Boot
Execute following commands:
It will generate u-boot.imx file.
Manual build Android Linux Kernel and modules
This will generate the uImage (kernel image) in the kernel/arch/arm/boot folder
Last updated 2017-01-25