i.MX Android Frequently Asked Questions

Document created by G.Y. CHEN Employee on Mar 19, 2019Last modified by Faqiang Zhu on Aug 8, 2019
Version 8Show Document
  • View in full screen mode

i.MX_Android_FAQ

i.MX Android FAQ

1 Build

1.1 How do I configure the build information?

BUILD_ID and BUILD_NUMBER are two makefile variables that can be used in Android core build system to specify build information if they are defined. In our release package, we define the BUILD_ID as the internal release build number, and define the BUILD_NUMBER as the internal release date. You can customize the value of these two variables in the file of ${MY_ANDROID}/device/fsl/{product}/build_id.mk. "${MY_ANDROID}" represents a the root directory of Android source code. "{product}" is related to specific chips and boards, for example, it can be "imx8m/evk_8mq".

Below is an example to update the BUILD_ID for i.MX 8MQuad EVK

diff --git a/imx8m/evk_8mq/build_id.mk b/imx8m/evk_8mq/build_id.mk
index 257b500..b177202 100644
--- a/imx8m/evk_8mq/build_id.mk
+++ b/imx8m/evk_8mq/build_id.mk
@@ -18,5 +18,5 @@
# (like "CRB01"). It must be a single word, and is
# capitalized by convention.

-export BUILD_ID=1.0.0-ga-rc2
+export BUILD_ID=1.0.0-ga-rc3
export BUILD_NUMBER=20190114

1.2 How do I change boot command line in boot.img?

After using boot.img, we stored the default kernel boot command line inside of this image.
It will package together during android build.

You can change this by changing BOARD_KERNEL_CMDLINE's definition in ${MY_ANDROID}/device/fsl/{product}/BoardConfig.mk file.

NOTE:

Replace {product} with your product, eg, imx8m/evk_8mq.

 

2 Connectivity

2.1 How do I setup a computer to support ADB?

To setup a computer to support ADB, see Android web site for more details.

There is one thing not clear in the page mentioned above about "setup the system to detect the device" on Ubuntu Linux, an udev rules file need to be created and well edited, please follow below steps:

    1. Create the file of "/etc/udev/rules.d/51-android.rules" with root permission and add the vendors of the device to the file with below format

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"

the id value of "18d1" is USB PID for google, which is used in our USB HAL code.

    2. now execute blow command on the host

chmod a+r /etc/udev/rules.d/51-android.rules

2.2 How do I setup a computer to support ADB In Recovery mode?

NXP i.MX 6/7 series support applying system update from ADB's.
Linux OS supports this feature by default.
For Windows OS, follow the steps below:

  1. Install the Google usb driver.
  2. Apply the patch below to the USB driver from Google.
  3. Connect the USB cable to the board and install the driver according to the instructions provided.

--- android_winusb.inf 2013-06-04 13:39:40.344756457 +0800
+++ android_winusb.inf 2013-06-04 13:43:46.634756423 +0800
@@ -23,6 +23,8 @@


[Google.NTx86]
+;adb sideload support
+%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_D001

;Google Nexus One
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_0D02
@@ -59,7 +61,8 @@


[Google.NTamd64]
-
+;adb sideload support
+%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_D001
;Google Nexus One
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_0D02
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_0D02&MI_01

2.3 How do I enable USB tethering?

We support the USB tethering feature, and upstream device can be WIFI or Ethernet.
USB tethering can be enabled in the Settings UI after your OTG USB cable is connected to PC: Settings -> Network & internet -> Hotspot & tethering -> USB tethering.

On linux and Windows 7 PC, when USB tethering is enabled, you can easily get a usb network device with host driver installed automatically.
The IP and DNS server is automatically configured.

On Windows XP PC, when you have connected the board with the PC and you can see an unknown device named "Android" in the device manager, you have to manually install the tethering driver file of tetherxp.inf.
After it is successfully installed, you can see "Android USB RNDIS device" in the device manager.
By this time, you can use USB rndis network device to access the network.

2.4 How do I use MTP?

The Media Transfer Protocol is a set of custom extensions to the Picture Transfer Protocol (PTP).
Whereas PTP was designed for downloading photographs from digital cameras, Media Transfer Protocol supports the transfer of music files on digital audio players and media files on portable media players, as well as personal information on personal digital assistants.

Starting with version 4.0, Android supports MTP as default protocol transfer files with PC, instead of the USB Mass Storage.
By default, as Google suggested, we disabled the UMS and enabled MTP.

NOTE: Please make sure you disable the USB Tethering when using MTP. Under WinXP, you can not make MTP work with ADB enabled, but under Win7, MTP can work together with ADB in most of the cases.

When connecting the board to PC by USB cable, a USB icon will be shown in the notification bar.
Then you can click on the notification area, and select "Connected as a media device" to launch the USB computer connection option UI.
There, MTP and PTP can be chosen as current transfer protocol. You can also launch the option UI by Settings -> Storage -> MENU -> USB computer connection.

MTP on Windows XP

Windows XP supports PTP protocol by default.
In order to support MTP protocol, you must install Windows Media Player (Version >= 10).
When connecting to the PC, you can see MTP devices in windows explorer.
Since Windows XP only supports copy/paste files in the explorer, you cannot directly open the files in MTP device.

MTP on Windows 7

Windows 7 supports MTP(PTP) protocol by default.
When connecting to the PC, you can see MTP devices in windows explorer.
You can do any operations just as you would on your hard disk.

MTP on ubuntu

Ubuntu supports PTP protocol by default.
To support MTP protocol, you must install the following packages: libmtp, mtp-tools by

$ sudo apt-get install mtp-tools

If your default libmtp version is not 1.1.1 (current latest libmtp on ubuntu is 1.1.0), you must upgrade it manually by:

$ sudo apt-get install libusb-dev
$ wget http://downloads.sourceforge.net/project/libmtp/libmtp/1.1.1/libmtp-1.1.1.tar.gz
$ tar -xvf libmtp-1.1.1.tar.gz
$ cd libmtp-1.1.1
$ ./configure --prefix=/usr
$ make -j4
$ sudo make install

After you have done the steps outlined above, you can transfer the files between PC and Device by the following commands:

  • mtp-detect: find current connected MTP device
  • mtp-files: list all the files on MTP device

2.5 How do I set networking proxy for Wi-Fi?

To configure the proxy settings for a Wi-Fi network, you have to:

  • Tap and hold a network from the list of added Wi-Fi networks
  • Now choose "Advanced options", and scroll down to "Proxy".
  • Choose "Manually". Then enter the proxy settings provided by the network administrator.
  • Finally tap on the button denoted as "CONNECT".

2.6 How to adapt the "wifi country code" for a specific country and/or region?

In i.MX Android Software, "CN" is used as default code while it's mainly for mainland of China. Some other countries and/or regions are listed in below table for convenience. If the target country/region is not in below table,  Search on the internet with the keyword of "ISO 3166" for the result.

CodeCountry/Region name
CACanada
JPJapan
DEGermany
NLNetherlands
ITItaly
PTPortugal
LULuxembourg
NONorway
FIFinland
DKDenmark
CHSwitzerland
CZCzech Republic
ESSpain
GBUnited Kingdom
KRRepublic of Korea (South Korea)
FRFrance
SGSingapore
BRBrazil
ILIsrael
ATAustria
AUAustralia
BEBelgium
CYCyprus
EEEstonia
GRGreece
HUHungary
IDIndonesia
IEIreland
IDIndia
ISIceland
LTLithuania
LVLatvia
MYMalaysia
NZNew Zealand
PHPhilippines
PLPoland
SESweden
SISlovenia
SKSlovak Republic
THThailand
USUnited States
ZASouth Africa

 

2.7 How to switch the Power role of USB Power Delivery through USB Type-C?

Several i.MX 8 board support the USB Power Delivery(PD) through USB Type-C port.The board can be acted as Power Sink or Power Source.
Check corresponding Android Release Notes to see whether board support USB Power Delivery(PD) or not.
Below are the steps to switch the Power role:

1.Connect a reference device with i.MX board:

Use a Type-C to Type-C cable to connect i.MX board with the reference device(support Usb Power Delivery).

2.Check i.MX board device's role

If i.MX board connects as host , and the reference device is a device(has a usb Drop-down menu to choose transfer files, ptp), then do step 3 on the reference device.
If i.MX board connects as device(has a usb Drop-down menu to choose transfer files, ptp), and the reference device is a host, then do step 3 on i.MX board.

3.Power role switch

If i.MX board is host:
To make i.MX board as Power Source to charge the reference device, choose "Charging this device" on the reference device's usb Drop-down menu.
To make i.MX board as Power Sink to be charged by the reference device, choose "Supplying power" on the reference device's usb Drop-down menu.

If i.MX board is device:
To make i.MX board as Power Source to charge the reference device, choose "Supplying power" on i.MX board's usb Drop-down menu.
To make i.MX board as Power Sink to be charged by the reference device,choose "Charging this device" on i.MX board's usb Drop-down menu.

NOTE:

1.Below command can check current power role for the i.MX board
cat /sys/class/typec/port0/power_role
source [sink] : means this i.MX board is been charged by the reference device,
[source] sink : means this i.MX board is charging the reference device,

2.The reference device should support the USB Power Delivery(PD).
You can check whether the reference device support it or not by below command
when it is connected with i.MX board's USB Type-C port:
cat /sys/class/typec/port0/port0-partner/supports_usb_power_delivery,
If this value is yes, then this reference device supports usb power delivery.

Google pixel phone meets this requirement, but Google nexus 6 does not.

3 Core

3.1 How do I enter Android Recovery mode manually?

When the system is running, press "VOLUME DOWN" and "Power" to enter Recovery mode if board has these keys.
This check is in u-boot.git board support file, where you can change your preferred combo keys.
Also, you can input this command in the console:

reboot recovery # the board reset to recovery mode.

to enter recovery mode.

3.2 How do I enter the text menu in recovery mode?

NOTE: This function only works on boards with POWER / VOLUME UP / VOLUME DOWN keys.

  • When the system completes booted up into recovery mode, you will see an Android Robot Logo
  • Press the POWER KEY(keep pressed), and then VOLUME UP KEY going to the text menu like this:

  • Move the menu item by VOLUME UP and VOLUME DOWN button.
  • Select the menu item by Power Key.
  • Select the required option using the direction keys on the keypad or keyboard.
    • reboot system now
    • apply update from ADB, you may update the software from update.zip by adb sideload command. Only NXP i.MX 6/7 series support this feature.
    • wipe data/factory reset. /data and /cache partitions are formatted.
    • wipe cache partition. /cache partition is formatted.
  • Reboot the system.

3.3 How do I upgrade system by ADB?

NXP i.MX 6/7 series support applying system update from ADB.
Before upgrade the system with ADB tool, please install adb driver first, see "2 Connectivity->2.2 How do I setup a computer to support ADB In Recovery mode?" section.

After the installation and setup of the driver is complete, follow the steps below:

  • Download the OTA update package to your computer, and connect the board to your PC with USB cable.
  • Ensure that the system has entered recovery mode. See "3.1 How do I enter Android Recovery mode manually" section.
  • Toggle the text Menu, move the cursor to "apply update from ADB", the UI is displayed as follows:

  • On your computer, execute below command

adb sideload $YOUR_UPDATE_PACKAGE.zip

  • After the package is sent, the system starts updating the firmware with the update file.

3.4 How do I use android fastboot?

Fastboot is an utility which can be used to download images from Windows/Linux PC to the target storage device.
This utility is released by Google, which can be downloaded from Android official site.
Android release implements part of the fastboot commands in the U-Boot, such as: flash, reboot, getvar.

Before using the fastboot, Google usb driver should be installed on windows HOST and the target board should boot up to bootloader fastboot mode.

NOTE: the size of images downloaded by fastboot must be less than the related partition size.

Target side:

  • Power on the board with USB OTG connected.
  • Make sure board enter fastboot mode. There are several ways to enter fastboot mode.
    • Option1: Input reboot bootloader in console after boot.
    • Option2:
      • Connect power to the board. You'll see the following output from the console.

        U-Boot ...
        ...
        Fastboot: Normal
        Hit any key to stop autoboot: 3

      • Hit any key before the countdown completes to access the bootloader prompt. Type fastboot usb and hit Enter:

        Fastboot: Normal
        Hit any key to stop autoboot: 0
        => fastboot usb

NOTE:

1.On HOST PC, it will prompt you that a new device was found and that you need to install the driver. Please install it.
2.After board enter U-Boot mode, type mmc part on target side to get detail partition name defined in partition table image. Some partitions are hardcoded in u-boot, it will not be listed here.

Host side:

  • Make sure fastboot is contained by the system environment variable of "PATH".
  • Go to image folder.
  • Below is an example to use fastboot to flash images for NXP imx8 series.
    • Make sure your board is in unlock state before flashing images with fastboot.
    • bootloader0/bootloader and gpt partitions is hardcoded in u-boot, it's not in partition table file.
    • names and number of partitions defined in partition table file may change as time goes on and new features are enabled.

      $ fastboot flash gpt partition-table.img
      $ fastboot flash bootloader0 u-boot.imx
      $ fastboot flash dtbo dtbo.img
      $ fastboot flash boot boot.img
      $ fastboot flash system system.img
      $ fastboot flash vendor vendor.img
      $ fastboot flash vbmeta vbmeta.img
      $ fastboot reboot

  • Below is an example to use fastboot to flash images for NXP i.MX 6/7 series.

    $ fastboot flash gpt partition-table.img
    $ fastboot flash bootloader u-boot.imx
    $ fastboot flash dtbo dtbo.img
    $ fastboot flash boot boot.img
    $ fastboot flash system system.img
    $ fastboot flash vendor vendor.img
    $ fastboot flash vbmeta vbmeta.img
    $ fastboot flash recovery recovery.img
    $ fastboot reboot

4 A/V

4.1 How do I check frame drop statistic while video playback?

Input below commands from console while video playback to get the real-time frame drop statistics.

dumpsys media.player | grep "num"

Then check the output,frame drop statistic will be showed like:

numFramesTotal(1892), numFramesDropped(0), percentageDropped(0.00%)

numFramesTotal: The total frames of the video file.
numFramesDropped: The dropped frame count as AV synchronization.
percentageDropped: The total dropped frame percentage.

5 Graphics

5.1 How to set GPU Minimal clock to balance performance and power consumption?

Normally GPU works at full speed.
When thermal driver report chip too hot, the GPU driver will adjust internal clock to reduce the power consumption to cool the chip down quickly.
In theory we should set the GPU clock to 1/64 so that chip can be cool down more quickly, but you may see the black screen or flicker issue when GPU work at so slow clock especially in large resolution.
There is below way to customize the threshold of GPU minimal clock based the chip and the resolution of their product.

Customer can set the minimal GPU clock by change below line in ${MY_ANDROID}/device/fsl/{product}/init.rc file, the value can be set to any value from 1 to 64.

write /sys/module/galcore/parameters/gpu3DMinClock 3

Current default value is 3.
Customer should tune and set the suitable value based on their test.

5.2 How to disable GPU acceleration?

There are three parts using GPU acceleration on android. Customer may need to disable some of them separately to narrow down issue. Below are the steps to do it.

1.Disable HWComposer:

You can disable HWComposer in Setting apk, Settings->System-> {} Developer options ->Disable HW overlays

2.Disable OpenGL Renderer

You can disable OpenGL Renderer and force use SKIA to draw by set "setprop sys.viewroot.hw false" and kill surfaceflinger thread.

3.Disable OpenGL 3D draw

Disable OpenGL 3D draw can only be done after Disable OpenGL Renderer as this operation will totally disable all 3D OpenGL acceleration.
You can do it by "mv /system/lib/egl/libGLES_android.so /system/lib/egl/libGLES.so" and kill surfaceflinger thread.

NOTE:

below example tell you how to kill surfaceflinger
root@sabresd_6dq:/ # ps | grep surfaceflinger
system 159 1 168148 7828 ffffffff b6f05834 S /system/bin/surfaceflinger
root@sabresd_6dq:/ # kill 159

6 Misc

6.1 How to enable Developer options on Android Jelly Bean and later version?

Google has hidden the Developer options since the version Jelly Bean - here's how to get them back:

  • Go to the Settings menu, and scroll down to "System". Tap it. Then Tap "About tablet" menu.
  • Scroll down to the bottom again, where you see "Build number."
  • Tap it seven times. After the third tap, you'll see a playful dialog that says you're four taps away from being a developer. Keep on tapping, until you've got the developer settings back.

6.2 How do I enable or disable bus frequency feature?

The Bus Frequency driver is used to low down the DDR, AHB and AXI bus frequency in the SoC when the IPs who needs high bus frequency is not working.
This saves the power consumption in Android earlysuspend mode significantly (playing audio with screen off).
The bus frequency driver is enabled by default, if you want to enable or disable it, please do the following command in the console:

Disable:
   $ echo 0 > sys/bus/platform/drivers/imx_busfreq/busfreq/enable
Enable:
   $ echo 1 > sys/bus/platform/drivers/imx_busfreq/busfreq/enable

Please note that if you're using ethernet, the up operation will enable the FEC clock and force bus frequency to be high.
That means you can not go into low bus mode anymore, no matter the ethernet cable is plugged or unplugged.
So if you want to system going to low bus mode, you must do 'netcfg eth0 down' to shutdown the FEC manually.
If you want to use FEC again, please do 'netcfg eth0 up' manually, when FEC is shutdown with clock gated, the PHY can not detect your cable in/out events.

3 people found this helpful

Attachments

    Outcomes