1. Setup
$ cd /opt (or any other directory you like) $ tar xzvf imx-android-r10.tar.gz $ cd imx-android-r10/code $ tar xzvf r10.tar.gz |
Assume you had unzipped i.MX Android release package to /opt/imx-android-r10/.
$ 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 gingerbread
$ cp /opt/imx-android-r10/code/r10/default.xml .repo/manifests/default.xml
(To avoid loading unnecessary gits from Google repo, meanwhile load some gits from Google repo which is not included in default manifest)
$ ./repo sync |
Get a clean kernel source code from kernel.org, and checkout the tag of 2.6.35.3:
$ cd myandroid $ git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.35.y.git kernel_imx $ cd kernel_imx
$ git checkout v2.6.35.3 |
$ cd myandroid/bootable/bootloader $ git clone git://git.denx.de/u-boot.git uboot-imx |
Assume you had unzipped i.MX Android release package to /opt/imx-android-r10/.
$ cd ~/myandroid $ . /opt/imx-android-r10/code/r10/and_patch.sh $ help Now you should see "c_patch" function is available for you
$ c_patch /opt/imx-android-r10/code/r10 imx_r10 Here "/opt/imx-android-r10/code/r10" is the location of the patches (i.e. directory created when you unzip release package) "imx_r10" is the branch which will be created automatically for you to hold all patches (only in those existing Google gits).
You can choose any branch name you like instead of "imx_r10". If everything is OK, "c_patch" will generate the following output to indicate successful patch:
************************************************************** Success: Now you can build android code for FSL i.MX platform
************************************************************** |
$ cd ~/myandroid/bootable/bootloader/uboot-imx
$ export ARCH=arm $ export CROSS_COMPILE=~/myandroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- Command to build for i.MX51 BBG3 board is: $ make distclean $ make mx51_bbg_android_config $ make Command to build for i.MX53 SMD board is: $ make distclean $ make mx53_smd_android_config $ make "u-boot.bin" is generated if you have a successful build. The above u-boot.bin has 1024KB padding at the head of file,for example first executable instruction is at the offset 1KB. If you want to generate a no-padding image, you need do below dd command in host. $ sudo dd if=./u-boot.bin of=./u-boot-no-padding.bin bs=1024 skip=1; sync Usually this no-padding uboot image is used in the SD card, for example, program this no-padding uboot image into 1KB offset of SD card so that we do not overwrite the MBR (including partition table) within first 512B on the SD card. Note: Any image which must be loaded by uboot must have an unique image head, for example, some data must be added at the head of loaded image to tell uboot about the image (for example, it's a kernel, or ramfs, etc) and how to load the image (for example, load/execute address). Therefor before you can load any image into RAM by uboot, you need a tool to add this information to generate a new image which can be recognized by uboot. Fortunately, this tool is delivered together with uboot. After you make uboot using the above steps, you can find the tool (mkimage) under tools/. Later the document will describe how to use mkimage to generate the image (for example kernel image, ramfs image) to be loaded by uboot. |
Assume you had already built uboot. mkimage was generated under myandroid/bootable/bootloader/uboot-imx/tools/ and it's in your PATH
$ export PATH=~/myandroid/bootable/bootloader/uboot-imx/tools:$PATH $ cd ~/myandroid/kernel_imx $ echo $ARCH && echo $CROSS_COMPILE Make sure you have those 2 environment variables set If the two variables have not set, please set the as: $ export ARCH=arm $ export CROSS_COMPILE=~/myandroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
$ make imx5_android_defconfig
Generate ".config" according to default config file under arch/arm/configs. $ make uImage |
$ cd ~/myandroid/kernel_imx/arch/arm/boot For i.MX51 BBG Board: $ ~/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 For i.MX53 SMD Board: $ ~/myandroid/bootable/bootloader/uboot-imx/tools/mkimage -A arm -O linux -T kernel -C none -a 0x70008000 -e 0x70008000 -n "Android Linux Kernel" -d ./zImage ./uImage During boot, when uboot try to load above "uImage", it will know to load it (without image head added by mkimage tool) into 0x90008000 or 0x70008000 (specified by "-a"), and then jump to 0x90008000 or 0x70008000 (specified by "-e") to execute it. "-C none" means no compression when generating "uImage". This is because the original zImage is already a compressed one. |
$ cd ~/myandroid $ export CROSS_COMPILE=~/myandroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
Command to build for i.MX51 BBG3 board is: $ make PRODUCT-imx51_bbg-eng 2>&1 | tee build_imx51_bbg_android.log "imx51_BBG" is the product names (see ~/myandroid/device/fsl/product) After build, check build_*_android.log to make sure no build error. |
For i.MX53 SMD build, the following outputs are generated as default under myandroid/out/target/product/imx53_smd :
root/ : root file system (including init, init.rc, etc). Mounted at /
system/: Android system binary/libraries. Mounted at /system
data/: Android data area. Mounted at /data
Above three folders can be used to create your Android file system for NFS mounting, i.e. root/ > /, system/ > /system, data/ > /data
recovery/: root file system when booting in "recovery" mode. Not directly used.
ramdisk.img: Ramdisk image generated from "root/". Not directly used.
system.img: EXT4 image generated from "system/". Can be programmed to "SYSTEM" partition on SD card with "dd"
userdata.img: EXT4 image generated from "data/".
recovery.img: EXT4 image generated from "recovery/". Can be programmed to "RECOVERY" partition on SD card with "dd"
The following steps generate a RAMDISK image recognized by uboot:
Assume 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 or $ cd myandroid/out/target/product/imx53_smd $ ~/myandroid/bootable/bootloader/uboot-imx/tools/mkimage -A arm -O linux -T ramdisk -C none -a 0x70308000 -n "Android Root Filesystem" -d ./ramdisk.img ./uramdisk.img |
Switch |
S-1 |
S-2 |
S-3 |
S-4 |
S-5 |
S-6 |
S-7 |
S-8 |
S-9 |
S-10 |
S1 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
ON |
Switch |
D1 |
D2 |
D3 |
D4 |
D5 |
D6 |
D7 |
D8 |
SW26 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
SW28 |
OFF |
OFF |
ON |
ON |
OFF |
OFF |
OFF |
OFF |
Switch |
D1 |
D2 |
D3 |
D4 |
D5 |
D6 |
D7 |
D8 |
SW5 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
SW4 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
SW3 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
Switch |
S-1 |
S-2 |
S-3 |
S-4 |
S-5 |
S-6 |
S-7 |
S-8 |
S-9 |
S-10 |
S1 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
ON |
ON |
OFF |
OFF |
Switch |
D1 |
D2 |
D3 |
D4 |
D5 |
D6 |
D7 |
D8 |
SW26 |
OFF |
ON |
OFF |
OFF |
ON |
ON |
ON |
OFF |
SW28 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
ON |
Switch |
D1 |
D2 |
D3 |
D4 |
D5 |
D6 |
D7 |
D8 |
SW26 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
ON |
OFF |
SW28 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
Switch |
D1 |
D2 |
D3 |
D4 |
D5 |
D6 |
D7 |
D8 |
SW5 |
OFF |
ON |
OFF |
OFF |
ON |
OFF |
OFF |
OFF |
SW4 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
SW3 |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
OFF |
Partition Type/Index | Name | Start Offset | Size | File System | Content |
N/A | BOOT | 0 | 10MB | N/A | bootloader/kernel/uramdisk images |
Primary 1 | MEDIA | 11MB | User Defined | VFAT. Mount as /sdcards |
Media file storage |
Primary 2 | SYSTEM | follow MEDIA | >= 200MB | EXT4. Mount as /system (with read only) | Android system bin/libs (system.img) |
Logic 5 (Extended 3) | DATA | follow SYSTEM | > 200MB | EXT4. Mount as /data | Android data (e.g. installed app) |
Logic 6 (Extended 3) | CACHE | follow DATA | > 10MB | EXT4. Mount as /cache | Android cache |
Primary 4 | RECOVERY | follow CACHE | > 20MB | EXT4. Mount as / in recovery mode | Root file system for recovery mode (recovery.img) |
# mkfs.vfat /dev/sdx1 # mkfs.ext4 /dev/sdx2 -O ^extent -L system # mkfs.ext4 /dev/sdx4 -O ^extent -L recovery # mkfs.ext4 /dev/sdx5 -O ^extent -L data # mkfs.ext4 /dev/sdx6 -O ^extent -L cache |
Download the uboot image: # sudo dd if=u-boot.bin of=/dev/sdx bs=1K skip=1 seek=1; sync Or If you're using no padding uboot image: # sudo dd if=u-boot-no-padding.bin of=/dev/sdx bs=1K seek=1; sync Download the kernel image: # sudo dd if=uImage of=/dev/sdx bs=1M seek=1; sync Download the initramfs image: # sudo dd if=uramdisk.img of=/dev/sdx bs=1M seek=6; sync Download the android system root image: # sudo dd if=system.img of=/dev/sdx2; sync Download the android recovery image: # sudo dd if=recovery.img of=/dev/sdx4; sync |
BBG U-Boot > fastboot fastboot is in init......USB Mini b cable Connected! fastboot initialized USB_SUSPEND USB_RESET USB_RESET |
> fastboot flash bootloader images\u-boot-no-padding.bin > fastboot flash kernel images\uImage > fastboot flash uramdisk images\uramdisk.img > fastboot flash system images\system.img > fastboot flash recovery images\recovery.img > fastboot reboot |
U-Boot > setenv ethaddr 00:04:9f:00:ea:d3 [setup the MAC address]
U-Boot > setenv fec_addr 00:04:9f:00:ea:d3 [setup the MAC address]
U-Boot > setenv loadaddr <kernel load addr> [0x90800000 for i.MX51, 0x70800000 for i.MX50/3]
U-Boot > setenv rd_loadaddr <ramdisk load addr> [0x90C00000 for i.MX51, 0x70C00000 for i.MX50/3]
U-Boot > setenv bootcmd 'run bootcmd_SD; bootm ${loadaddr} ${rd_loadaddr}'
U-Boot > setenv bootcmd_SD 'mmc read 0 ${loadaddr} 0x800 0x2000; mmc read 0 ${rd_loadaddr} 0x3000 0x300;' [load kernel and ramdisk from MMC/SD or eMMC]
[About the eMMC boot, please use the "mmc read 1" replace the "mmc read 0"]
U-Boot > setenv bootargs <SD/MMC bootargs> [For different platforms, please refer to below table]
U-Boot > saveenv [Save the environments]
|
Platform | Bootargs |
i.MX51 BBG with WVGA |
console=ttymxc0 init=/init androidboot.console=ttymxc0 di1_primary calibration ip=dhcp gpu_memory=16M |
i.MX53 SMD with LVDS |
console=ttymxc0 init=/init androidboot.console=ttymxc0 video=mxcdi1fb:RGB666,XGA ldb di1_primary ip=dhcp gpu_memory=64M |
i.MX50 RDP with E-Ink |
console=ttymxc0 init=/init androidboot.console=ttymxc0 ip=dhcp keypad |
After you setup the TFTP/NFS server, please put the kernel image into the tftp server root directory and the Android file system files into the NFS server root directory.
For kernel image, use uImage instead of zImage
* If you are using a prebuilt image, make sure you pick up the correct uImage (see "Prebuilt image for using uboot")
* If you are building your own image, make sure you generated a uImage (see "Generate uImage to be loaded by u-boot").
Copy uImage to the TFTP server root directory. For example:
$ cp your_uImage /opt/tftproot/ |
$ cd /opt/imx-android-r10/image/imx5x_BOARD/NFS $ tar xzvf ./android_fs.tar.gz $ cd android_fs $ rm -rf /opt/nfsroot/* $ cp -r * /opt/nfsroot/* |
$ cd myandroid $ rm -rf /opt/nfsroot/* $ cp -r out/target/product/imx5x_BOARD/root/* /opt/nfsroot/ $ cp -r out/target/product/imx5x_BOARD/system/* /opt/nfsroot/system/ |
U-Boot > setenv ethaddr 00:04:9f:00:ea:d3 [setup the MAC address]
U-Boot > setenv fec_addr 00:04:9f:00:ea:d3 [setup the MAC address]
U-Boot > setenv loadaddr <kernel load addr> [0x90800000 for i.MX51, 0x70800000 for i.MX50/3]
U-Boot > setenv bootfile uImage
U-Boot > setenv serverip <your server ip> [Your TFTP/NFS server ip]
U-Boot > setenv nfsroot <your rootfs> [Your rootfs]
U-Boot > setenv bootcmd 'dhcp;bootm' [load kernel from TFTP and boot]
U-Boot > setenv bootargs <NFS bootargs> [For different platforms, please refer to below table; do not add '']
U-Boot > saveenv [Save the environments]
|
Platform | Bootargs |
i.MX51 BBG with WVGA |
console=ttymxc0 init=/init androidboot.console=ttymxc0 root=/dev/nfs nfsroot=${serverip}:${nfsroot} rw ip=dhcp di1_primary gpu_memory=16M |
i.MX53 SMD with LVDS |
console=ttymxc0 init=/init androidboot.console=ttymxc0 root=/dev/nfs nfsroot=${serverip}:${nfsroot} rw ip=dhcp video=mxcdi1fb:RGB666,XGA ldb di1_primary gpu_memory=64M |
i.MX50 RDP with E-Ink |
console=ttymxc0 init=/init androidboot.console=ttymxc0 root=/dev/nfs nfsroot=${serverip}:${nfsroot} rw ip=dhcp keypad |
|
I.MX51 BBG |
I.MX53 EVK |
I.MX50 RD |
loadaddr |
0x90800000 |
0x70800000 |
0x70800000 |
rd_loadaddr |
0x90C00000 |
0x70C00000 |
0x70C00000 |
Kernel Parameter | Description | Typical Value | Used When |
console | where to output kernel log by printk | console=ttymxc0 | All case |
androidboot.console | indicate Android shell where to put log | androidboot.console=ttymxc0 | All case for Android (with this parameter, you can use Ctrl-C in Android shell) |
init | tell kernel where is the init file | init=/init | All case for Android. "init" in Android is located in "/" instead of in "/sbin" |
ip | tell kernel how/whether to get IP address |
ip=none or ip=dhcp or ip=static_ip_address |
"ip=dhcp" or "ip=static_ip_address" is mandatory in "boot from TFTP/NFS" |
nfsroot | where is NFS server/directory | rootfs=ip_address:/opt/nfsroot,v3,tcp | Used in "boot from tftp/NFS" together with "root=/dev/nfs" |
root | indicate where is the root file system |
root=/dev/nfs or root=/dev/mmcblk0p2 |
Used in "boot from tftp/NFS" (i.e. root=/dev/nfs); Used in "boot from SD" (i.e. root=/dev/mmcblk0p2) if no ramdisk is used for root fs |
video | tell kernel/driver which resolution/depth and refresh rate should be used | video=mxcdi0fb:1024x768M-16@60 | Used when display on DVI (i.MX51 BBG3 board). Please check "Display Settings" table below for detail. |
di1_primary | tell kernel/driver using DI1 display | di1_primary | Used to tell kernel which display interface is the default on for UI. |
calibration | tell kernel/driver to do touch panel calibration when 1st boot | calibration | Used when touch panel is needed. i.e. when you display everything on DVI or multitouch screen, no need for this. |
gpu_memory | GPU shared memory used by driver | gpu_memory=16M | It's 16MB on MX51 BBG, but 64M on MX53 SMD |
keypad (for i.mx50) |
Use the keypad on E-ink panel board |
keypad |
Use the keypad on E-ink panel board |
|
MX51 |
|
|
MX53 |
|
|
Display device |
Interface | Format | Video Mode |
Interface |
Format |
Video Mode |
DVI | di0 |
RGB24 |
mxcdi0fb:800x600M-16@60 |
di0 |
RGB24 |
mxcdi0fb:800x600M-16@60 |
DVI-HDMI |
di0 |
RGB24 |
mxcdi0fb:720P60 |
di0 |
RGB24 |
mxcdi0fb:720P60 |
LVDS |
di0 |
LVDS666 |
mxcdi0fb:XGA |
di0/1 |
RGB666 |
mxcdixfb:RGB666,XGA ldb |
WVGA LCD |
di1 |
RGB565 |
mxcdi1fb:800x480M-16@55 |
di0 |
RGB565 |
mxcdi0fb:800x480M-16@55 |
TV Encoder |
di1 |
YUV444 |
mxcdi1fb:TV-NTSC mxcdi1fb:TV-PAL mxcdi1fb:720P60 |
di1 |
YUV444 |
mxcdi1fb:TV-NTSC mxcdi1fb:TV-PAL mxcdi1fb:720P60 |
Environment.getExternalSDStorageDirectory()Environment.getExternalUDiskStorageDirectory()Environment.getExternalExtSDStorageDirectory()Environment.getExternalSDStorageState()Environment.getExternalUDiskStorageState()Environment.getExternalExtSDStorageState()
Change the BOARD_WLAN_CHIP in device/fsl/imx51_bbg/BoardConfig.mk to AR6002
BOARD_WLAN_CHIP := AR6002
Remove the former built ar6000.ko
rm out/target/product/imx51_bbg/system/lib/modules/ar6000.ko
Rebuild android project again.
setprop rw.SECOND_DISPLAY_CONNECTED 1setprop sys.SECOND_DISPLAY_ENABLED 1
setprop rw.SECOND_DISPLAY_CONNECTED 0setprop sys.SECOND_DISPLAY_ENABLED 0
The key mapping for a Dell USB keyboard used with the BBG3 board (defined in /system/usr/keylayout/Dell_Dell_USB_Keyboard.kl) is as follows:
Key Act as ESC BACK F1 MENU F2 SOFT_RIGHT F3 CALL F4 ENDCALL F5 ENDCALL F8 HOME F9 DPAD_CENTER UP DPAD_UP DOWN DPAD_DOWN BACK DEL ENTER ENTER
The key map of the keypad on the BBG3 add-on peripheral board (defined in /system/usr/keylayout/mxckpd.kl) is as follows:
POWER N/A CALL VOLUME_UP
DPAD_LEFT
MENU
DPAD_DOWN DPAD_CENTER DPAD_UP HOME CAMERA N/A ENDCALL VOLUME_DOWN
DPAD_RIGHT
BACK
The key map of the keypad on the i.MX508 (defined in /system/usr/keylayout/mxckpd.kl) is as follows:
Key Act as PREV(SW2) BACK F1(SW5) MENU F9(SW15) ENTER 9(SW24) DPAD_LEFT 0(SW25) DPAD_RIGHT O(SW34) DPAD_UP P(SW35) DPAD_DOWN POWER(SW70) POWER RESET(SW71) RESET NXT1(SW3)/NXT2(SW4) DPAD_CENTER
For imx53_EVK/imx50_PD, the "power key" on board support the suspend/resume operation.
Main Menu > Settings > Sound > Volume
Main Menu > Settings > Display > Brightness
Main Menu > Settings > Display > Screen timeout > 30 minutes
In linux environment, the "idVendor" must be set. Now, the "idVendor" is "0x0bb4".
# Log in as root and create this file: /etc/udev/rules.d/51-android.rules.
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
# Now execute:
chmod a+r /etc/udev/rules.d/51-android.rules
fsl@fsl-desktop:~/recovery$zip recovery.zip -r ./META-INF ./system ./res |
fsl@fsl-desktop:~/recovery$ cd ~/myandroid
fsl@fsl-desktop:~/myandroid$ make signapk
fsl@fsl-desktop:~/myandroid$ cd ~/recovery
fsl@fsl-desktop:~/recovery$ java -jar ~/myandroid/out/host/linux-x86/framework/signapk.jar -w ~/myandroid/build/target/product/security/testkey.x509.pem ~/myandroid/build/target/product/security/testkey.pk8 recovery.zip recovery_signed.zip
|
fsl@fsl-desktop:~/recovery$ adb push recovery_signed.zip /sdcard/update.zip
|
$ setprop debug.sf.enable_hgl 0
$ setprop debug.egl.hw 0
$ setprop debug.sf.showfps 1
fastboot.exe reboot
TARGET_KERNEL_2G := true
* Install Dante - a socks client $ sudo apt-get install dante-client * Configure Dante by adding below lines into /etc/dante.conf route { from: 0.0.0.0/0 to: . via: DNS_OR_IP_OF_YOUR_SOCKS_SERVER port = PORT_OF_YOUR_SOCKS_SERVER proxyprotocol: socks_v5 } resolveprotocol: fake * Set environment variable for http proxy and socks $ export http_proxy=... $ export SOCKS_USER=... $ export SOCKS_PASSWD=... * Download Android code from google $ curl http://android.git.kernel.org/repo > ./repo $ chmod a+x ./repo $ socksify ./repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo $ cp /opt/imx-android-r10/code/r10/default.xml .repo/manifests/default.xml $ socksify ./repo sync |
$ ping IP_OF_YOUR_BOARD (run "netcfg" on board to get IP address) $ export ADBHOST=IP_OF_YOUR_BOARD "adb" is a host tool created during Android build.It's under out/host/linux-x86/bin/. Make sure you set path properly. $ adb kill-server (not sure why need this step. Just re-start adb daemon on board) $ adb shell # NOW YOU ARE IN ANDROID SHELL ON BOARD |