i.MX Processors Knowledge Base

cancel
Showing results for 
Search instead for 
Did you mean: 

i.MX Processors Knowledge Base

Discussions

Graphics are a big topic in the Android platform, containing java/jni graphic framework and 2d/3d graphic engines (skia, OpenGL-ES, renderscript). This document describes the general Android graphic stack and UI features on Freescale devices. 1. Android Graphic Stacks All Android 3D apps and games have the following graphic stack: Android system UI and all Apps UI follow 2D graphic stack as below, the hardware render will accelerate Android 2D UI with GPU HW OpenGL-ES 2.0 to improve the whole UI performance. Hardware acceleration can be disabled on i.mx6 in device/fsl/imx6/soc/imx6dq.mk USE_OPENGL_RENDERER := false Then rebuild frameworks/base/core/jni, and replace libandroid_runtime.so Surfaceflinger is responsible of all surface layers composition, and  then generate the framebuffer pixmap for display devices. these graphic surface layers are from 2D/3D apps. Hwcomposer is the alternative module of Surfaceflinger with OpenGL-ES. Hwcomposer is used to combine the specific surface layers supported by specific vendor devices. Freescale i.MX6 devices use GPU 2D to combine most surface layers, and the system power can be reduced with GPU 2D instead of GPU 3D. The typical power saving case is video playback. Hwcomposer with GPU 2D can offload GPU 3D task when running game and benchmarks, it is proved to improve the overall system performance about 20%. 2. Performance measurment Show FPS for Android system performance For NFS boot you can set “debug.sf.showfps” to 1 in init.freescale.rc (“setprop debug.sf.showfps 1”) and then reboot the system. For SD or EMMC boot, you can issue command “setprop debug.sf.showfps 1” in console, then find system_server thread by top and kill it to reset the system. Graphic benchmarks for 3D capability measurement Quadrant Full test benchmark cover CPU, Memory, IO, 2D and 3D GLBenchmark http://www.glbenchmark.com/ NenaMark2 https://market.android.com/details?id=se.nena.nenamark2 An3DBench http://www.androidzoom.com/android_applications/tools/an3dbench_hnog.html AnTutu http://www.antutu.com/software.html 3DMark http://www.futuremark.com/benchmarks/3dmark06/introduction/ Browser benchmarks http://www.webkit.org/perf/sunspider/sunspider.html http://v8.googlecode.com/svn/data/benchmarks/current/run.html http://www.craftymind.com/guimark2/ http://www.craftymind.com/factory/guimark/GUIMark_HTML4.html http://themaninblue.com/writing/perspective/2010/03/22/ 3.  Android UI features Dual display with same content This feature is supported in the default image in Android i.MX 6 release package. In this feature, LVDS panel and HDMI output can be supported simultaneously. It is only enabled when the HDMI TV has been connected with the board. Overscan for TV devices Some TVs may miss display the contents in overscan area. To avoid the contents in overscan area being lost, the common implement is by underscanning with an adjustable black border and letitng the viewer adjust the width of the black border. The downscan operation is done by surfaceflinger when it does surface composition through HW OpenGL ES. There is no performance impact since all the work is done by GPU HW. Overscan can be configured in display setting in visual mode: 32 bits color depth 32bpp UI can be supported by adding “bpp=32” in uboot as below: setenv bootargs ‘… video=mxcdi1fb:RGB666,XGA,bpp=32 …’, also can configure it in display setting. Enable 32bpp frame buffer and application surface buffer will be allocate to RGBA8888 format instead of default RGB565 format, that means more system memory is allocated. After enabling 32bpp, if some applications still don't have better UI quality, check to see if  there is hard code to request RGB565 format surface (should request RGBA8888 format to get better quality). Sample code is attached to test for 32bpp (left is on 16bpp, right is on 32bpp) Display Visual Setting The display setting is the add-on feature in FSL Android release, it is very convenient for end-users to change display property, mostly for the following features: Dual display enablement Display color depth setting(16bpp, 32bpp) Overscan adjustment in horizontal and vertical orientation 4. Issue Diagnosis Application Compatibility Some Android applications may not run correctly on some Android releases. It may cause application compatibility, so check the application in other platforms. For example Neocore and Asphalt 5 can run on Eclair, Froyo, and Gingerbread, but will not correctly run on Honeycomb. GPU Compatibility Some game UIs may not correctly display on our Android release. When encountering this kind of issue, the customer can check whether it is caused by the game using an OpenGL extension which our GPU does not support. They can download another data package (for example not extension data package) to have a check. Others Enlarge GPU memory if you encounter UI abnormally displaying after running an application for a while. Some applications need Wifi connections, so monitor the console log to see whether there are any error reports.
View full article
Description about VPU & IPU usage in Android R13.4 GA release for i.MX6DQ
View full article
Trace the malloc and expose violate access to freed memory Introduction Libc has a malloc debug framework for difference debugger. Each debugger takes as a libraries, and override the default malloc/free/calloc/realloc/, hooked before calling the real functions. NOTE: This tip assume that you are working with an eng or userdebug build of the platform, not on a production device. Trace the low level malloc/free in bionic Bionic has a malloc debugger called leak debugger, which can record all the malloc/free in low level. And developers can use ddms on host to check each block of memory on heap by malloc. And ddms support convert caller function address to name conver. That makes easy for us to check which component, which function allocated for how many memories. You can turn on memory tracking with debug level 1: $ adb shell setprop libc.debug.malloc 1 $ adb shell stop $ adb shell start You need to restart the runtime so that zygote and all processes launched from it are restarted with the property set. Now all Dalvik processes have memory tracking turned on. You can look at these with DDMS, but first you need to turn on its native memory UI: Open ~/.android/ddms.cfg Add a line "native=true" Upon relaunching DDMS and selecting a process, you can switch to the new native allocation tab and populate it with a list of allocations. This is especially useful for debugging memory leaks. NOTE: to solve the module symbols, please export two env on HOST: $ export PATH=$PATH:<android src>/prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin $ export ANDROID_PRODUCT_OUT=<android src>/out/target/product/<platform> Expose the memory access to freed area In this release he Electric Fence 2.2.0 has been ported to Android. it's also a memory debugger tool as above leak debugger. It helps you detect two common programming bugs: software that overruns the boundaries of a malloc() memory allocation, and software that touches a memory allocation that has been released by free(). It will dump the call stack and mmap of the process, if the malloc/free is not called with correct parameters. It will also make a segment fault, when applications want to access the address which is freed. The usage of efence is almost same as above, which we define it's debug level to 15: $ adb shell setprop libc.debug.malloc 15 After setting this property, you can run your applications, and if there's any memory leakage, logcat will show information. Example: Access the memory, which has been freed already: root@android:/data # setprop libc.debug.malloc 15 I/libc    ( 4136): setprop using MALLOC_DEBUG = 1 (leak checker) root@android:/data # ./memtest I/libc    ( 4138): ./memtest using MALLOC_DEBUG = 15 (efence) F/libc    ( 4138): Fatal signal 11 (SIGSEGV) at 0x4015bff4 (code=2) I/DEBUG  ( 3856): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** I/DEBUG  ( 3856): Build fingerprint: 'freescale/sabresd_6dq/sabresd_6dq:4.0.4/R13.5-rc1/eng.b03824.20120711.11133 8:eng/test-keys' I/DEBUG  ( 3856): pid: 4138, tid: 4138  >>> ./memtest <<< I/DEBUG  ( 3856): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 4015bff4 I/DEBUG  ( 3856):  r0 00000000  r1 00000002  r2 40151c6c  r3 00000000 I/DEBUG  ( 3856):  r4 4015bff4  r5 bec75a54  r6 00000001  r7 bec75a5c I/DEBUG  ( 3856):  r8 00000000  r9 00000000  10 00000000  fp 00000000 I/DEBUG  ( 3856):  ip 00000000  sp bec75a20  lr 40133f8f  pc 0000a554  cpsr 60000010 I/DEBUG  ( 3856):  d0  203f810033915fe5  d1  0000000000000000 I/DEBUG  ( 3856):  d2  0000000000000000  d3  0000000000000000 I/DEBUG  ( 3856):  d4  0000000000000000  d5  0000000000000000 I/DEBUG  ( 3856):  d6  0000000000000000  d7  204cb48d00000000 I/DEBUG  ( 3856):  d8  0000000000000000  d9  0000000000000000 I/DEBUG  ( 3856):  d10 0000000000000000  d11 0000000000000000 I/DEBUG  ( 3856):  d12 0000000000000000  d13 0000000000000000 I/DEBUG  ( 3856):  d14 0000000000000000  d15 0000000000000000 I/DEBUG  ( 3856):  d16 41c0265a46a47ae1  d17 3f50624dd2f1a9fc I/DEBUG  ( 3856):  d18 41c9c8aff2800000  d19 0000000000000000 I/DEBUG  ( 3856):  d20 0000000000000000  d21 0000000000000000 I/DEBUG  ( 3856):  d22 0000000000000000  d23 0000000000000000 I/DEBUG  ( 3856):  d24 0000000000000000  d25 0000000000000000 I/DEBUG  ( 3856):  d26 0000000000000000  d27 0000000000000000 I/DEBUG  ( 3856):  d28 0000000000000000  d29 0000000000000000 I/DEBUG  ( 3856):  d30 0000000000000000  d31 0000000000000000 I/DEBUG  ( 3856):  scr 00000010 I/DEBUG  ( 3856): I/DEBUG  ( 3856):          #00  pc 0000a554  /data/memtest I/DEBUG  ( 3856):          #01  pc 00016834  /system/lib/libc.so (__libc_init) I/DEBUG  ( 3856): I/DEBUG  ( 3856): code around pc: I/DEBUG  ( 3856): 0000a534 e3a0000a ebfff8d1 e3a01001 e1a00004  ................ I/DEBUG  ( 3856): 0000a544 e5c4100a ebfff8d9 e3560001 e3a03000  ..........V..0.. I/DEBUG  ( 3856): 0000a554 e5c43000 0a000064 e59f21f0 e2857004  .0..d....!...p.. I/DEBUG  ( 3856): 0000a564 e5954004 e08f1002 e1a00004 ebfff8c0  .@.............. I/DEBUG  ( 3856): 0000a574 e3500000 0a00003f e59fc1d4 e1a00004  ..P.?........... I/DEBUG  ( 3856): I/DEBUG  ( 3856): code around lr: I/DEBUG  ( 3856): 40133f6c 68200701 0001f020 454e1046 2e00d018  .. h ...F.NE.... I/DEBUG  ( 3856): 40133f7c 2102da01 1c81e000 43394338 f7eb4622  ...!....8C9C"F.. I/DEBUG  ( 3856): 40133f8c 4605ed56 d1ec2800 da062e00 0101f008  V..F.(.......... I/DEBUG  ( 3856): 40133f9c f06f4620 f7ea4200 4628e8d4 87f0e8bd  Fo..B....(F.... I/DEBUG  ( 3856): 40133fac eff0f7e9 6003234b 30fff04f bf00e7f6  ....K#.`O..0.... I/DEBUG  ( 3856): I/DEBUG  ( 3856): memory map around addr 4015bff4: I/DEBUG  ( 3856): 40150000-4015a000 I/DEBUG  ( 3856): 4015a000-4015d000 I/DEBUG  ( 3856): 4015d000-4015e000 I/DEBUG  ( 3856): I/DEBUG  ( 3856): stack: I/DEBUG  ( 3856):    bec759e0  00000000 I/DEBUG  ( 3856):    bec759e4  00000000 I/DEBUG  ( 3856):    bec759e8  00000000 I/DEBUG  ( 3856):    bec759ec  4012090f  /system/lib/libefence.so I/DEBUG  ( 3856):    bec759f0  4015a014 I/DEBUG  ( 3856):    bec759f4  00002000 I/DEBUG  ( 3856):    bec759f8  00000004 I/DEBUG  ( 3856):    bec759fc  40120df1  /system/lib/libefence.so I/DEBUG  ( 3856):    bec75a00  4015bff4 I/DEBUG  ( 3856):    bec75a04  bec75a54  [stack] I/DEBUG  ( 3856):    bec75a08  00000001 I/DEBUG  ( 3856):    bec75a0c  bec75a5c  [stack] I/DEBUG  ( 3856):    bec75a10  00000000 I/DEBUG  ( 3856):    bec75a14  400d9167  /system/lib/libc.so I/DEBUG  ( 3856):    bec75a18  df0027ad I/DEBUG  ( 3856):    bec75a1c  00000000 I/DEBUG  ( 3856): #00 bec75a20  00008924  /data/memtest I/DEBUG  ( 3856):    bec75a24  bec75a54  [stack] I/DEBUG  ( 3856):    bec75a28  00000001 I/DEBUG  ( 3856):    bec75a2c  bec75a5c  [stack] I/DEBUG  ( 3856):    bec75a30  00000000 I/DEBUG  ( 3856):    bec75a34  400d9837  /system/lib/libc.so I/DEBUG  ( 3856): #01 bec75a38  00000000 I/DEBUG  ( 3856):    bec75a3c  00000000 I/DEBUG  ( 3856):    bec75a40  00000000 I/DEBUG  ( 3856):    bec75a44  00000000 I/DEBUG  ( 3856):    bec75a48  00000000 I/DEBUG  ( 3856):    bec75a4c  b00046ef  /system/bin/linker I/DEBUG  ( 3856):    bec75a50  00000001 I/DEBUG  ( 3856):    bec75a54  bec75b79  [stack] I/DEBUG  ( 3856):    bec75a58  00000000 I/DEBUG  ( 3856):    bec75a5c  bec75b83  [stack] I/DEBUG  ( 3856):    bec75a60  bec75b8f  [stack] I/DEBUG  ( 3856):    bec75a64  bec75ba2  [stack] I/DEBUG  ( 3856):    bec75a68  bec75bc5  [stack] I/DEBUG  ( 3856):    bec75a6c  bec75bde  [stack] I/DEBUG  ( 3856):    bec75a70  bec75c08  [stack] I/DEBUG  ( 3856):    bec75a74  bec75c20  [stack] I/DEBUG  ( 3856):    bec75a78  bec75c57  [stack] I/DEBUG  ( 3856):    bec75a7c  bec75c61  [stack] I/BootReceiver( 3551): Copying /data/tombstones/tombstone_00 to DropBox (SYSTEM_TOMBSTONE) D/dalvikvm( 3551): GC_CONCURRENT freed 398K, 10% free 8805K/9735K, paused 3ms+5ms [2] + Segmentation fault  ./memtest
View full article
Introduction This guide provides a step by step explanation of what is involved in adding a new WiFi driver and making a new WiFi card work well in a custom Android build. (This guide was written for Android 4.1 but should be applicable to previous Android releases and hopefully future releases.) Contents Understand how Android WiFi works Port WiFi driver. Compile a proper wpa_supplicant in your BoardConfig.mk Modify your wifi.c in HAL. Launch wpa_supplicant and dhcpcd services in init.rc. Several debug tips. Understand How Android WiFi Works As the following figure, Android wireless architecture can be divided into three parts: Java Framework(WifiManager, WifiMonitor etc..), HAL(wifi.c,wpa_supplicant,netd) kernel space modules(wireless stack, wifi drivers) Java Framework communicate with wpa_supplicant using native interface (wifi.c). Wpa_supplicant and netd uses wireless extension or nl80211 to control WiFi drivers. Port WiFi driver Usually WiFi driver is provided as a kernel module. There are mainly two types of Android WiFi architecture:nl80211 and wext. With the implementation of nl80211/cfg80211 many wireless drivers in main line kernel  support nl80211 interface instead of wireless extension. For different vendors’ WiFi drivers, writing one Android.mk to add its compile into Android is what you should do. Here take atheros’s AR6kl as an example: ath6kl_module_file :=drivers/net/wireless/ath/ath6kl/ath6kl_sdio.ko $(ATH_ANDROID_SRC_BASE)/$(ath6kl_module_file):$(mod_cleanup) $(TARGET_PREBUILT_KERNEL) $(ACP)         $(MAKE) -C $(ATH_ANDROID_SRC_BASE) O=$(ATH_LINUXPATH) ARCH=arm CROSS_COMPILE=$(ARM_EABI_TOOLCHAIN)/arm-eabi- KLIB=$(ATH_\ LINUXPATH) KLIB_BUILD=$(ATH_LINUXPATH)         $(ACP) -fpt $(ATH_ANDROID_SRC_BASE)/compat/compat.ko $(TARGET_OUT)/lib/modules/         $(ACP) -fpt $(ATH_ANDROID_SRC_BASE)/net/wireless/cfg80211.ko $(TARGET_OUT)/lib/modules/ include $(CLEAR_VARS) LOCAL_MODULE := ath6kl_sdio.ko LOCAL_MODULE_TAGS := optional LOCAL_MODULE_CLASS := ETC LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/modules LOCAL_SRC_FILES := $(ath6kl_module_file) include $(BUILD_PREBUILT) Compile a proper wpa_supplicant in your BoardConfig.mk In Android’s external directory, there are two wpa_supplicant_* projects. For wext-based wifi driver, wpa_supplicant_6 can be used. For nl80211-based WiFi driver, wpa_supplicnat_8 can only be used. But if WiFi vendors supply their own customized wpa_supplicant, it will be much easier to debug the communication between wpa_supplicant and WiFi drivers. No matter which supplicant  you choose, just control their compile in your BoardConfig.mk. Take atheros’s ath6kl as an example: ifeq ($(BOARD_WLAN_VENDOR),ATHEROS) BOARD_WLAN_DEVICE                        := ar6003 BOARD_HAS_ATH_WLAN                      := true WPA_SUPPLICANT_VERSION                  := VER_0_8_ATHEROS WIFI_DRIVER_MODULE_PATH                  := "/system/lib/modules/ath6kl_sdio.ko" WIFI_DRIVER_MODULE_NAME                  := "ath6kl_sdio" WIFI_DRIVER_MODULE_ARG                  := "suspend_mode=3 wow_mode=2 ar6k_clock=26000000 ath6kl_p2p=1" WIFI_DRIVER_P2P_MODULE_ARG              := "suspend_mode=3 wow_mode=2 ar6k_clock=26000000 ath6kl_p2p=1 debug_mask=0x2413" WIFI_SDIO_IF_DRIVER_MODULE_PATH          := "/system/lib/modules/cfg80211.ko" WIFI_SDIO_IF_DRIVER_MODULE_NAME          := "cfg80211" WIFI_SDIO_IF_DRIVER_MODULE_ARG          := "" WIFI_COMPAT_MODULE_PATH                  := "/system/lib/modules/compat.ko" WIFI_COMPAT_MODULE_NAME                  := "compat" WIFI_COMPAT_MODULE_ARG                  := "" endif then you need to provide a proper wpa_supplicant.conf  for your device. wpa_supplicant.conf  is very important because the control socket for android is specified in this file(ctrl_interface=). This file should be copied to /system/etc/wifi. Minimum required config options in wpa_supplicant.conf : There are two different ways in which wpa_supplicant can be configured, one is to use a "private" socket in android namespace, created by socket_local_client_connect() function in wpa_ctrl.c and another is by using a standard UNIX socket. Android private socket ctrl_interface=wlan0 update_config=1 - Unix standard socket ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi update_config=1 Modify your wifi.c in HAL Here what you should do is modifying some codes like wifi_load_driver and wifi_unload_driver. For Broadcom or CSR’s wifi driver, you can directly use the original wifi.c. But for atheros’s ath6kl driver, there are total three  .ko modules to install. So some micro variables and codes need to be changed to adapt it. Launch wpa_supplicant and dhcpcd services in init.rc If you have configured to use android private socket, you should do like this: service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0 -c / data/misc/wifi /wpa_supplicant.conf socket wpa_wlan0 dgram 660 wifi wifi disabled oneshot or if you have configured to use unix standard socket, you should do like this: service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0  -c/data/misc/wifi/wpa_supplicant.conf disabled oneshot If WiFi driver is not “wext” but “nl80211”, you should change it to –Dnl80211. For dhcpcd, you should lunch it like the following: service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL     class late_start     disabled oneshot The parameters “-ABKL” can largely enhance wifi connection speed.  About what “ABKL” stand for, you can refer to dhcpcd’s GNU manual. Several debug tips Incorrect permissions will result in wpa_supplicant not being able to create/open the control socket andlibhardware_legacy/wifi/wifi.c won't connect. Since Google modified wpa_supplicant to run as wifi user/group the directory structure and file ownership should belong to wifi user/group (see os_program_init() function in wpa_supplicant/os_unix.c ). Otherwise errors like: E/WifiHW  (  😞 Unable to open connection to supplicant on "/data/system/wpa_supplicant/wlan0": No such file or directory will appear. Also wpa_supplicant.conf should belong to wifi user/group because wpa_supplicant will want to modify this file. How to Enable debug for wpa_supplicant.               By default wpa_supplicant is set to MSG_INFO that doesn't tell much.                    To enable more messages:                 modify common.c and set wpa_debug_level = MSG_DEBUG                 modify common.h and change #define wpa_printf from if ((level) >= MSG_INFO) to if ((level) >= MSG_DEBUG)         3. WiFi driver’s softmac.               For most vendors’ WiFi driver, the mac address is fixed. We should add one softmac rule to let WiFi driver’s mac is unique for each board.
View full article
When streaming, if you want to play a streaming URL, it can be inconvenient if the browser cannot recognize the URL as a media stream and downloads the content rather than using Gallery to play it. To create this kind of media streaming, you need to write an apk to use VideoView to play the URL/ media stream from the console. Here is the command of how to play a media file or network stream from console. Gingerbread am start -n com.cooliris.media/com.cooliris.media.MovieView -d "<URL>"       The URL can be file position or network stream URL, such as: you can play a local file by: am start -n com.cooliris.media/com.cooliris.media.MovieView -d "/mnt/sdcard/test.mp4" You can also play a http stream by: am start -n com.cooliris.media/com.cooliris.media.MovieView -d "http://v.iask.com/v_play_ipad.php?vid=76710932" Or play a rtsp stream by: am start -n com.cooliris.media/com.cooliris.media.MovieView -d "rtsp://10.0.2.1:554/stream" ICS am start -n com.android.gallery3d/com.android.gallery3d.app.MovieActivity -d "<URL>"        The URL has the same definition of Gingerbread.
View full article
Sometimes w e need to use proxy to access network with Ethernet. Here are the steps for how to set proxy in Gingerbread and ICS. Gingerbread 1. Enable http proxy >  sqlite3 /data/data/com.android.providers.settings/databases/settings.db "INSERT INTO secure VALUES (99, 'http_proxy', 'wwwgate0.freescale.net:1080');" With this setting, you can access network for web browsing. If you want to play some http streaming content, you need to set a property for the player, > setprop rw.HTTP_PROXY http://wwwgate0-az.freescale.net:1080 2. Disable http proxy >  sqlite3 /data/data/com.android.providers.settings/databases/settings.db "delete from secure where name='http_proxy'" >  setprop rw.HTTP_PROXY "" ICS 1. Enable http proxy >  setprop net.proxy wwwgate0-az.freescale.net:1080 With this setting, you can access network for web browsing. If you want to play some http streaming content, you need to set a proxy property for the player, >  setprop rw.HTTP_PROXY http://wwwgate0-az.freescale.net:1080 2. Disable http proxy >  setprop net.proxy "" >  setprop rw.HTTP_PROXY ""
View full article
There is a very quick way to find out which line cause the crash in logcat, Generally, if some native service crashes, look in the crash log in logcat like this: I/DEBUG ( 2253): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** I/DEBUG ( 2253): Build fingerprint: 'freescale/sabresd_6dq/sabresd_6dq:4.0.4/R13.3-rc3/eng.b18293.20120710.124535:user/test-keys' I/DEBUG ( 2253): pid: 3043, tid: 3080 >>> /system/bin/mediaserver <<< I/DEBUG ( 2253): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad I/DEBUG ( 2253): r0 deadbaad r1 00000001 r2 a0000000 r3 00000000 I/DEBUG ( 2253): r4 00000000 r5 00000027 r6 00bfd370 r7 40c1ef18 I/DEBUG ( 2253): r8 00004349 r9 00000000 10 000003f5 fp 00000000 I/DEBUG ( 2253): ip ffffffff sp 418876a0 lr 400ff1b5 pc 400fb91c cpsr 60000030 I/DEBUG   ( 2253):  ip ffffffff  sp 418876a0  lr 400ff1b5  pc 400fb91c  cpsr 60000030 We can see it’s possibly related to some code that we debugged, but don’t know exactly where or which line of code, Android has a tool to convert this log to a more precise log. As a quick example, i f you got this crash in logcat: F/libc ( 3043): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1) I/DEBUG ( 2253): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** I/DEBUG ( 2253): Build fingerprint: 'freescale/sabresd_6dq/sabresd_6dq:4.0.4/R13.3-rc3/eng.b18293.20120710.124535:user/test-keys' I/DEBUG ( 2253): pid: 3043, tid: 3080 >>> /system/bin/mediaserver <<< I/DEBUG ( 2253): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad I/DEBUG ( 2253): r0 deadbaad r1 00000001 r2 a0000000 r3 00000000 I/DEBUG ( 2253): r4 00000000 r5 00000027 r6 00bfd370 r7 40c1ef18 I/DEBUG ( 2253): r8 00004349 r9 00000000 10 000003f5 fp 00000000 I/DEBUG ( 2253): ip ffffffff sp 418876a0 lr 400ff1b5 pc 400fb91c cpsr 60000030 I/DEBUG ( 2253): d0 3e4ccccd00000000 d1 7e37e43c3e4ccccd I/DEBUG ( 2253): d2 0000004042000000 d3 4200000000000000 I/DEBUG ( 2253): d4 3ff0000000000000 d5 3ff0000000000000 I/DEBUG ( 2253): d6 4220000041300000 d7 3e4ccccd3e4ccccd I/DEBUG ( 2253): d8 000000000000685d d9 00000000010bee7c I/DEBUG ( 2253): d10 0000000000000000 d11 0000000000000000 I/DEBUG ( 2253): d12 0000000000000000 d13 0000000000000000 I/DEBUG ( 2253): d14 0000000000000000 d15 0000000000000000 I/DEBUG ( 2253): d16 0000000000000000 d17 3ff0000000000000 I/DEBUG ( 2253): d18 7e37e43c8800759c d19 0000000000000000 I/DEBUG ( 2253): d20 bfe0000000000000 d21 405443dab91ed79f I/DEBUG ( 2253): d22 0000000000000000 d23 3f40624dd2f1a9fc I/DEBUG ( 2253): d24 7fff80007fff0000 d25 3f6328e1cb8c85e0 I/DEBUG ( 2253): d26 0000000000000000 d27 0000000000000000 I/DEBUG ( 2253): d28 0000000000000000 d29 0000000000000000 I/DEBUG ( 2253): d30 0000000000000000 d31 0000000000000000 I/DEBUG ( 2253): scr 28000010 I/DEBUG ( 2253): I/DEBUG ( 2253): #00 pc 0001791c /system/lib/libc.so I/DEBUG ( 2253): #01 pc 00003f3e /system/lib/libcutils.so (__android_log_assert) I/DEBUG ( 2253): #02 pc 0006c436 /system/lib/libstagefright.so (_ZN7android8OMXCodec16drainInputBufferEPNS0_10BufferInfoE) I/DEBUG ( 2253): #03 pc 0006cbc2 /system/lib/libstagefright.so (_ZN7android8OMXCodec17drainInputBuffersEv) I/DEBUG ( 2253): #04 pc 0006f570 /system/lib/libstagefright.so (_ZN7android8OMXCodec4readEPPNS_11MediaBufferEPKNS_11MediaSource11ReadOpti onsE) I/DEBUG ( 2253): #05 pc 00051aba /system/lib/libstagefright.so (_ZN7android11AudioPlayer5startEb) I/DEBUG ( 2253): #06 pc 0005411e /system/lib/libstagefright.so (_ZN7android13AwesomePlayer18startAudioPlayer_lEb) I/DEBUG ( 2253): #07 pc 0005554a /system/lib/libstagefright.so (_ZN7android13AwesomePlayer6play_lEv) I/DEBUG ( 2253): #08 pc 000558e0 /system/lib/libstagefright.so (_ZN7android13AwesomePlayer4playEv) I/DEBUG ( 2253): #09 pc 00027f4e /system/lib/libmediaplayerservice.so (_ZN7android17StagefrightPlayer5startEv) I/DEBUG ( 2253): #10 pc 00024dda /system/lib/libmediaplayerservice.so (_ZN7android18MediaPlayerService6decodeEixxPjPiS2_) I/DEBUG ( 2253): I/DEBUG ( 2253): code around pc: I/DEBUG ( 2253): 400fb8fc 4623b15c 2c006824 e026d1fb b12368db \.#F$h.,..&..h#. I/DEBUG ( 2253): 400fb90c 21014a17 6011447a 48124798 24002527 .J.!zD.`.G.H'%.$ I/DEBUG ( 2253): 400fb91c f7f47005 2106ee22 eebef7f5 f04fa901 .p.."..!......O. I/DEBUG ( 2253): 400fb92c 460a5380 93032006 94029401 ea7af7f5 .S.F. ........z. I/DEBUG ( 2253): 400fb93c 4622a905 f7f52002 f7f4ea84 2106ee0e .."F. .........! I/DEBUG ( 2253): I/DEBUG ( 2253): code around lr: I/DEBUG ( 2253): 400ff194 41f0e92d 4c0c4680 447c2600 68a56824 -..A.F.L.&|D$h.h I/DEBUG ( 2253): 400ff1a4 e0076867 300cf9b5 dd022b00 47c04628 gh.....0.+..(F.G I/DEBUG ( 2253): 400ff1b4 35544306 37fff117 6824d5f4 d1ee2c00 .CT5...7..$h.,.. I/DEBUG ( 2253): 400ff1c4 e8bd4630 bf0081f0 00028346 41f0e92d 0F......F...-..A I/DEBUG ( 2253): 400ff1d4 9004b086 f602fb01 460c461f 46154814 .........F.F.H.F I/DEBUG ( 2253): I/DEBUG ( 2253): memory map around addr deadbaad: I/DEBUG ( 2253): becef000-bed10000 [stack] I/DEBUG ( 2253): (no map for address) I/DEBUG ( 2253): ffff0000-ffff1000 [vectors] I/DEBUG ( 2253): You can see it’s related to which lib, but don’t know which line. So, let’s go to your source code, for example: mydroid; after do $. build/envsetup.sh$ lunch sabresd_6dp-eng $ development/scripts/stack Then you have a prompt: Reading native crash info from stdin The you just copy all the crash log in above to this prompt. And then Key in EOF (CTRL+D) in this prompt. You will get output like this: Reading symbols from /home/b33651/proj/ics/out/target/product/sabresd_6dq/symbols pid: 3043, tid: 3080 >>> /system/bin/mediaserver <<< signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad   r0 deadbaad r1 00000001 r2 a0000000 r3 00000000   r4 00000000 r5 00000027 r6 00bfd370 r7 40c1ef18   r8 00004349 r9 00000000 10 000003f5 fp 00000000   ip ffffffff sp 418876a0 lr 400ff1b5 pc 400fb91c Stack Trace:   RELADDR FUNCTION FILE:LINE   0001791c __libc_android_abort+92 /home/b33651/proj/ics/bionic/libc/unistd/abort.c:82   00003f3e __android_log_assert+94 /home/b33651/proj/ics/system/core/liblog/logd_write.c:246   0006c436 android::OMXCodec::drainInputBuffer(android::OMXCodec::BufferInfo*)+138 /home/b33651/proj/ics/frameworks/base/media/libstagefright/OMXCodec.cpp:3181   0006cbc2 android::OMXCodec::drainInputBuffers()+102 /home/b33651/proj/ics/frameworks/base/media/libstagefright/OMXCodec.cpp:3125   0006f570 android::OMXCodec::read(android::MediaBuffer**, android::MediaSource::ReadOptions const *)+136 /home/b33651/proj/ics/frameworks/base/media/libstagefright/OMXCodec.cpp:4020   00051aba android::AudioPlayer::start(bool)+134 /home/b33651/proj/ics/frameworks/base/media/libstagefright/AudioPlayer.cpp:93   0005411e android::AwesomePlayer::startAudioPlayer_l(bool)+70 /home/b33651/proj/ics/frameworks/base/media/libstagefright/AwesomePlayer.cpp:953   0005554a android::AwesomePlayer::play_l()+202 /home/b33651/proj/ics/frameworks/base/media/libstagefright/AwesomePlayer.cpp:888   000558e0 android::AwesomePlayer::play()+20 /home/b33651/proj/ics/frameworks/base/media/libstagefright/AwesomePlayer.cpp:837   00027f4e android::StagefrightPlayer::start()+6 /home/b33651/proj/ics/frameworks/base/media/libmediaplayerservice/StagefrightPlayer.cpp:90   00024dda android::MediaPlayerService::decode( int , long long , long long , unsigned int *, int *, int *)+206 /home/b33651/proj/ics/frameworks/base/media/libmediaplayerservice/MediaPlayerService.cpp:1428 So, you get more reason logs. Note: The Android directory must have built once. The crash log better aligns with your Android build environment.
View full article
Wi-Fi Android IMX53 QSB enable WIFI android How to Support New WiFi Card in Android How to enable PCIe WiFi into i.MX6 Android Release? WiFi.zip
View full article
If Android device has Internet access, it can download and install TTS library automatically. However, sometimes in a developer environment, Internet may not be available. Download TTS library from Eyes-Free project, [1] Unzip all files into VFAT partition (of SDCard). It will create two directories: daiane@b19406:/media$ sudo ls disk-3/ -l total 231552 drwx------ 6 daiane root      4096 2010-05-24 15:46 espeak-data drwx------ 2 daiane root      4096 2010-05-24 15:46 svox daiane@b19406:/media$ mount /dev/sdd5 on /media/disk-1 type ext3 (rw,nosuid,nodev,uhelper=hal) /dev/sdd2 on /media/system type ext3 (rw,nosuid,nodev,uhelper=hal) /dev/sdd6 on /media/disk-2 type ext3 (rw,nosuid,nodev,uhelper=hal) /dev/sdd1 on /media/disk-3 type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1001,utf8,umask=077,flush) /dev/sdd4 on /media/recovery type ext3 (rw,nosuid,nodev,uhelper=hal)
View full article
Ramdisk is unnecessary thing for some embedded systems, but it's required for Android . You can develop an Android system with no ramdisk (initrd/initramfs), just follow these steps: 1) Remove RAMDISK support from kernel: General setup  --->             [ ] Initial RAM filesystem and RAM disk (initramfs/initrd) support Create a single rootfs: cd myandroid/out/target/product/imx51_BBG mkdir rootfs sudo cp -a system rootfs/ sudo cp -a root/* rootfs/ sudo cp -a recovery rootfs/ Since you are using a single filesystem, then comment out these lines from rootfs/init.rc: #mount ext3 /dev/block/mmcblk0p2 /system #mount ext3 /dev/block/mmcblk0p2 /system ro remount #mount ext3 /dev/block/mmcblk0p5 /data nosuid nodev #mount ext3 /dev/block/mmcblk0p6 /cache nosuid nodev Create just one partition into your MMC or Flash memory: Partition 1: 200MB+ as EXT3 will be used as system(rootfs). Remember to skip 4MB to save kernel. It is a good idea to create a second partition (VFAT) to mount as /data to save user files. Mount that "system" partition and copy all content of rootfs: sudo mount /dev/sdb1 -t ext3 /mnt sudo cp -a .../target/product/imx51_BBG/rootfs/* /mnt sudo umount /mnt Now just setup your bootloader parameter correctly (i.e. MMC Partition 1): setenv bootargs_base 'setenv bootargs root=/dev/mmcblk0p1 rootfstype=ext3 console=ttymxc0,115200 noinitrd'
View full article
logcat Logcat is the most powerful debug tool for Android. Logcat is to Android what the dmesg is to kernel. It shows messages logs from system and applications. logcat can be used directly on board console or via adb. $ logcat directly on board console. It gives the complete log message list and waits for any new log message. $ logcat & board console. It gives log list and run in background. Any new log message will be displayed. # adb logcat Using adb you can get log messages through Ethernet or USB connection. $ logcat -d > logcat.txt it sends log messages to logcat.txt file and exits. $ logcat *:W it filters expression displays all log messages with priority level "warning" and higher, on all tags * * http://developer.android.com/guide/developing/debugging/debugging-log.html
View full article
The getevent function shows kernel events like press button events, touchscreen events, sensor events (like accelerometers or magnetometers). bash-3.2# getevent -h Usage: getevent [-t] [-n] [-s switchmask] [-S] [-v [mask]] [-p] [-q] [-c count] [-r] [device]       -t: show time stamps       -n: don't print newlines       -s: print switch states for given bits       -S: print all switch states       -v: verbosity mask (errs=1, dev=2, name=4, info=8, vers=16, pos. events=32)       -p: show possible events (errs, dev, name, pos. events)       -q: quiet (clear verbosity mask)       -c: print given number of events then exit       -r: print rate events are received Bellow an example of all events on some board bash-3.2# getevent -p add device 1: /dev/input/event2   name:    "mxc_ts"   events:       SYN (0000): 0000  0001  0003       KEY (0001): 014a       ABS (0003): 0000  value 0, min 0, max 0, fuzz 0 flat 0                         0001  value 0, min 0, max 0, fuzz 0 flat 0                         0018  value 0, min 0, max 0, fuzz 0 flat 0 could not get driver version for /dev/input/mouse0, Not a typewriter add device 2: /dev/input/event1   name:    "mxc_power_key"   events:     SYN (0000): 0000  0001     KEY (0001): 003e add device 3: /dev/input/event0   name:    "mxckpd"   events:     SYN (0000): 0000  0001     KEY (0001): 0002  0003  0004  0005  003b  003c  003d  003e                       0066  0067  0069  006a  006c  008b  009e  0161 could not get driver version for /dev/input/mice, Not a typewriter For example, some touchscreen event. Any touchscreen press-up or press-down will return a vector of values related with the event (please, see include/linux/input.h for detail) bash-3.2# getevent /dev/input/event2 0003 0000 0000020e 0003 0001 0000014a 0003 0018 00000037 0001 014a 00000001 0000 0000 00000000 0003 0000 00000209 0003 0001 00000147
View full article
ADB ADB is a tool for Android debugging. With ADB, you can install applications from you PC, copy files to/from your device, access console. You can access your device using an USB Cable, or through network (using an IP address). You can take ADB from SDK [1] or inside <my_android>/out/host/linux-x86/bin/adb I cannot see my device First checkpoint must be for ADBD. It´s the ADB daemon, and if it´s not running on your device, you will not be able to access it. Install and configure any USB driver [2] [3] Double check connection (USB cable, ethernet) Double check if debugging is on Double check if USB config is right (see how on User Guide) Tips and Tricks Turning on Remember to turn debugging mode on: Settings->Applications->Development->USB debugging No Permission When you get "no permissions" from ADB, you need to start server with your root user: $ sudo /usr/share/android-sdk-linux_86/tools/adb devices List of devices attached ????????????    no permissions $ sudo /usr/share/android-sdk-linux_86/tools/adb shell error: insufficient permissions for device $ sudo /usr/share/android-sdk-linux_86/tools/adb kill-server $ sudo /usr/share/android-sdk-linux_86/tools/adb start-server * daemon not running. starting it now * * daemon started successfully * $ sudo /usr/share/android-sdk-linux_86/tools/adb devices List of devices attached 0123456789ABCDEF    device $ sudo /usr/share/android-sdk-linux_86/tools/adb shell # ls dev etc
View full article
Setting up your machine Exporting variables Edit your ~/.bashrc and add these 2 lines export ARCH=arm export CROSS_COMPILE=/opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi- To build and debug android you will need to install some packages and services in the host machine,this how-to assumes that you are using Ubuntu 9.04 or greater. Installing packages sudo apt-get install nfs-kernel-server patch g++ rpm zlib1g-dev m4 bison libncurses5-dev gettext build-essential tcl intltool libxml2-dev minicom tftpd  xinetd For a complete list, depending on system type, refer to Installing required packages Set serial port Setting TFTP Setting NFS Compile Android Download the SDK from our internal repository cd /opt wget http://android.maxtrack.com.br/imx-android-r6.tar.gz tar xvfz imx-android-r6.tar.gz cd imx-android-r6/code tar xzvf R6.tar.gz cd ~ mkdir myandroid cd myandroid curl http://android.git.kernel.org/repo > ./repo chmod a+x ./repo ./repo init -u git://android.git.kernel.org/platform/manifest.git -b donut * If you are behind a firewall or proxy try this one:./repo init -u http://android.git.kernel.org/platform/manifest.git -b donut cp /opt/imx-android-r6/code/R6/default.xml .repo/manifests/default.xml ./repo sync Preparing cross compiling tools cd /opt/imx-android-r6/tool tar xzvf gcc-4.1.2-glibc-2.5-nptl-3.tar.gz -C /opt export ARCH=arm export CROSS_COMPILE=/opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi- Download the kernel source git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.28.y.git kernel_imx Download U-Boot cd bootable/bootloader git clone git://git.denx.de/u-boot.git uboot-imx       Patching the environment Previously we decompressed the SDK at "/opt/imx-android-r6/code/R6" there we can find all the patches needed to iMX51 cd ~/myandroid . /opt/imx-android-r6/code/R6/and_patch.sh c_patch /opt/imx-android-r6/code/R6 imx_R6 Build Uboot cd ~/myandroid/bootable/bootloader/uboot-imx make mx51_bbg_android_config make Build Android cd ~/myandroid make PRODUCT-imx51_BBG-eng 2>&1 | tee build_imx51_BBG_android.log For i.MX51 BBG build, it will generate the compiled environment under myandroid/out/target/product/imx51_BBG. These 4 folders can be used to create your Android file system for NFS mounting, i.e., "root/" -> "/", "system/" -> "/system", "data/" -> "/data" root/ : root file system (including init, init.rc, etc). Will be mounted at "/" system/:  Android system binary/libraries. Will be mounted at "/system" data/: Android data area. Will be mounted at "/data" recovery/: root file system when booting in "recovery" mode. Not directly used. Image files to use with SD cards ramdisk.img: Ramdisk image generated from "root/". Not directly used. system.img: EXT3 image generated from "system/". Can be programmed to "SYSTEM" partition on SD card with "dd" userdata.img: EXT3 image generated from "data/". recovery.img: EXT3 image generated from "recovery/". Can be programmed to "RECOVERY" partition on SD card with "dd" Build uRamdisk Assuming that you had already built uboot, "mkimage" was generated under myandroid//bootable/bootloader/uboot-imx/tools/ cd ~/myandroid/out/target/product/imx51_BBG ~/myandroid/bootable/bootloader/uboot-imx/tools/mkimage -A arm -O linux -T ramdisk -C none -a 0x90308000 -n "Android Root Filesystem" -d ./ramdisk.img ./uramdisk.img Build Kernel Image If you want to run Android via NFS or from SD, you can build kernel with default configuration now: cd ~/myandroid/kernel_imx       make imx51_android_defconfig      make uImage After compiling the image can be found at ~/myandroid/kernel_imx/arch/arm/boot/uImage. Since we are using Uboot we will need to do this step: cd myandroid/kernel_imx/arch/arm/boot ~/myandroid/bootable/bootloader/uboot-imx/tools/mkimage -A arm -O linux -T kernel -C none -a 0x90008000 -e 0x90008000 -n "Android Linux Kernel" -d ./zImage ./uImage Boot FS from SDcard Partioning the SD Card Insert your SD card/cardreader to the Linux PC (you need root privileges for programming SD), you can use dmesg to check the SD device, in our how-to we will consider that the sdcard is detected as /dev/sdb, so be careful to not mess up your own file system. To boot the entire FS from SDcard you must follow this partition schema: File:Pt.png To achieve this, we are going to use fdisk to create the partition table: # sudo fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x1787490d. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Listing the partition talbe (in our example the SDcard does not have a partition schema): Command (m for help): p Disk /dev/sdb: 3965 MB, 3965190144 bytes 122 heads, 62 sectors/track, 1023 cylinders Units = cylinders of 7564 * 512 = 3872768 bytes Disk identifier: 0x1787490d    Device Boot      Start         End      Blocks   Id  System If you have any previous partition, please delete it using the "d" command. Pay attention that each sdcard block has 3872768 bytes (this size usually changes for each type of sdcard) so the first step is to jump at least 8 MB to store uboot, kernel and ramdisk ( as shown in the partition schema ) With that advice in mind, create a 10 MB primary partition that will store the media (/sdcards): Command (m for help): n Command action    e   extended    p   primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1023, default 1): +8M Last cylinder, +cylinders or +size{K,M,G} (2-1023, default 1023): +10M List the partition table to check if the partition was correctly created: Command (m for help): p Disk /dev/sdb: 3965 MB, 3965190144 bytes 122 heads, 62 sectors/track, 1023 cylinders Units = cylinders of 7564 * 512 = 3872768 bytes Disk identifier: 0x1787490d     Device Boot      Start         End      Blocks   Id  System /dev/sdb1               2            5       15128   83  Linux Note that the first partition does not start in the first cylinder; the first cylinder and the second one will store uboot, kernel and ramdisk. Now we need to change the partition label to vfat: Command (m for help): t Selected partition 1 Hex code (type L to list codes): b Changed system type of partition 1 to b (W95 FAT32) Command (m for help): p Disk /dev/sdb: 3965 MB, 3965190144 bytes 122 heads, 62 sectors/track, 1023 cylinders Units = cylinders of 7564 * 512 = 3872768 bytes Disk identifier: 0x1787490d     Device Boot      Start         End      Blocks   Id  System /dev/sdb1               2           5       15128    b  W95 FAT32 Create another 80 MB primary partition with 80 MB storage capacity; this partition will store the system's files. This partition must start in the cylinder that follows the last cylinder of the former partition. Command (m for help): n Command action    e   extended    p   primary partition (1-4) p Partition number (1-4): 2 First cylinder (1-1023, default 1): 6 Last cylinder, +cylinders or +size{K,M,G} (6-1023, default 1023): +80M Command (m for help): p Disk /dev/sdb: 3965 MB, 3965190144 bytes 122 heads, 62 sectors/track, 1023 cylinders Units = cylinders of 7564 * 512 = 3872768 bytes Disk identifier: 0x1787490d    Device Boot      Start         End      Blocks   Id  System /dev/sdb1               2           5       15128    b  W95 FAT32 /dev/sdb2               6          28       86986   83  Linux Now you must create an extended partition big enough to store other 2 logic partitions ( DATA partition with 20 MegaBytes and CACHE partition with 10 MB): Command (m for help): n Command action    e   extended    p   primary partition (1-4) e Partition number (1-4): 3 First cylinder (1-1023, default 1): 29 Last cylinder, +cylinders or +size{K,M,G} (29-1023, default 1023): +30M Command (m for help): p Disk /dev/sdb: 3965 MB, 3965190144 bytes 122 heads, 62 sectors/track, 1023 cylinders Units = cylinders of 7564 * 512 = 3872768 bytes Disk identifier: 0x1787490d     Device Boot      Start         End      Blocks   Id  System /dev/sdb1               2           5       15128    b  W95 FAT32 /dev/sdb2               6          28       86986   83  Linux /dev/sdb3              29          37       34038    5  Extended Now create the logic partitions: Command (m for help): n Command action    l   logical (5 or over)    p   primary partition (1-4) l First cylinder (29-37, default 29): Using default value 29 Last cylinder, +cylinders or +size{K,M,G} (29-37, default 37): +20M Command (m for help): p Disk /dev/sdb: 3965 MB, 3965190144 bytes 122 heads, 62 sectors/track, 1023 cylinders Units = cylinders of 7564 * 512 = 3872768 bytes Disk identifier: 0x1787490d     Device Boot      Start         End      Blocks   Id  System /dev/sdb1               2           5       15128    b  W95 FAT32 /dev/sdb2               6          28       86986   83  Linux /dev/sdb3              29          37       34038    5  Extended /dev/sdb5              29          34       22661   83  Linux Command (m for help): n Command action    l   logical (5 or over)    p   primary partition (1-4) l First cylinder (35-37, default 35): Using default value 35 Last cylinder, +cylinders or +size{K,M,G} (35-37, default 37): Using default value 37 At last, you must create a primary partition to store the /recovery: Command (m for help): n Command action    l   logical (5 or over)    p   primary partition (1-4) p Selected partition 4 First cylinder (1-1023, default 1): 38 Last cylinder, +cylinders or +size{K,M,G} (38-1023, default 1023): +10M Command (m for help): p Disk /dev/sdb: 3965 MB, 3965190144 bytes 122 heads, 62 sectors/track, 1023 cylinders Units = cylinders of 7564 * 512 = 3872768 bytes Disk identifier: 0x1787490d     Device Boot      Start         End      Blocks   Id  System /dev/sdb1               2           5       15128    b  W95 FAT32 /dev/sdb2               6          28       86986   83  Linux /dev/sdb3              29          37       34038    5  Extended /dev/sdb4              38          41       15128   83  Linux /dev/sdb5              29          34       22661   83  Linux /dev/sdb6              35          37       11315   83  Linux Saving the partition table: Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks. Now you are ready to start flashing the SDcard: Flashing SDcard Flashing Uboot cd ~/myandroid/bootable/bootloader/uboot-imx sudo dd if=your_bootloader_binfile of=/dev/sdb bs=1K seek=1 Usually we use this no-padding uboot image in SD card, i.e. program this no-padding uboot image into 1KB offset of SD card so that we will NOT overwrite the MBR (including partition table) within 1st 512B on SD card. Formatting the SD Do not copy and paste the commands; wait for the complete output. sudo mkfs.vfat /dev/sdb1 sudo mkfs.ext3 /dev/sdb2 sudo mkfs.ext3 /dev/sdb4 sudo mkfs.ext3 /dev/sdb5 sudo mkfs.ext3 /dev/sdb6 Flashing Kernel cd ~/myandroid/kernel_imx/arch/arm/boot sudo dd if=uImage of=/dev/sdb bs=1M seek=1 Flashing FS cd ~/myandroid/out/target/product/imx51_BBG sudo dd if=uramdisk.img of=/dev/sdb bs=4M seek=1 sudo dd if=system.img of=/dev/sdb2  (Program system.img into SYSTEM partition which will be mounted as "/system") sudo dd if=recovery.img of=/dev/sdb4 (Program recovery.img into RECOVERY partition which will mounted as "/" in recovery mode) Configure Uboot After inserting the SD card in the board (the slot is located at the inferior portion of the board), plugging in the serial cable and start a configured minicom session, you should turn on the iMX51 board and see in your console something like this: U-Boot 2009.08-00046-gf91e287 (Jan 18 2010 - 12:32:32) CPU:   Freescale i.MX51 family 2.5V at 400 MHz mx51 pll1: 800MHz mx51 pll2: 665MHz mx51 pll3: 216MHz ipg clock     : 66500000Hz ipg per clock : 665000000Hz uart clock    : 66500000Hz cspi clock    : 54000000Hz Board: MX51 BABBAGE 3.0 [POR] Boot Device: MMC DRAM:  512 MB MMC:   FSL_ESDHC: 0 In:    serial Out:   serial Err:   serial Press home + power to enter recovery mode ... Net:   FEC0 [PRIME] Hit any key to stop autoboot:  0 BBG U-Boot > Copy and paste these configurations, line by line: setenv bootcmd 'run bootcmd_SD1 bootcmd_SD2' setenv bootcmd_SD1 'run bootargs_base bootargs_android bootargs_SD' setenv bootcmd_SD2 'mmc read 0 ${loadaddr} 0x800 0x1280;mmc read 0 ${rd_loadaddr} 0x2000 0x258;bootm ${loadaddr} ${rd_loadaddr}' setenv bootargs_base 'setenv bootargs console=ttymxc0,115200' setenv bootargs_SD 'setenv bootargs ${bootargs}' setenv bootargs_android 'setenv bootargs ${bootargs} init=/init androidboot.console=ttymxc0 wvga calibration' setenv loadaddr 0x90800000 setenv rd_loadaddr 0x90B00000 saveenv Reboot the board: reset Additional Resources All Board Android ADB All Board Android Getevent All Board Android logcat All Board Android Without Ramdisk All Boards Debugging Android [Android] Fatal exception happens when preview size does not match video snapshot size Android Data Partition Encryption on i.MX6 Android GDB for Native Code Android Graphic UI with GPU hardware acceleration Android HTML5 Video Android Memory Usage Tool: Procrank Build Android 4.0 ICS under Ubuntu 11.10 Build Linphone Android for i.MX6 How to find the crash point: Android Native crash How to debug memory leakage in media server in Android How to Enable LDO Bypass Based on i.MX6 Android ICS How to Enable PCIe WiFi into i.MX6 Android Release? How to Install Android on SD Card How to play a file with 2 audio tracks: DTS &amp; AC3 on i.MX6/Android How to play a media file/stream from console in Android How to port new audio codec into Android.docx How to Print Function Caller Stack in Android Log File How to Support New WiFi Card in Android How to Use Proxy to Access Network in Android i.MX6 Android 13.4.1.03 Patch Release i.MX6 Android R13.4.1.04 patch release i.MX6 D/Q and i.MX6 DL/S Android JB4.2.2_1.0.0-GA release iMX6QD How to Add 24-bit LVDS Support in Android i.MX6 Android R13.4-GA.03 patch release IoT Solutions: Cloud Connector for Android Memory Management on i.MX6 Android New Android SD Card Demo Image for the i.MX6Q SABRE Board for Smart Devices New Android SD Card Demo Image for the i.MX6Q SABRE Platform for Smart Devices Sabre-l Setup Memo Video - Bye-Bye Standby Power - Ubiquitous QuickBoot with Android on NetWalker Video - Efika MX Smartbook Android Flash
View full article