imx515 开发板Android源代码编译过程

Android requires the following system packages:

flex: This lexical analyzer generator is used to read a given input file for a description of a scanner to generate.

bison: This is a general-purpose parser generator.

gperf: This is a perfect hash function generator.

libesd0-dev: This enlightened sound daemon (dev files) is used to mix digitized audio streams for playback by a single device.

libwxgtk2.6-dev: This package provides GUI components and other facilities for many different platforms.

build-essential: This package contains a list of packages considered fundamental to building Debian packages.

linuxidc.com@lnuxidc-laptop:/$sudo apt-get install flex bison gperf libesd0-dev libwxgtk2.6-dev zlib1g-dev build-essential

安装好jdk 1.5.0

并在/etc/profile中设置好导出的环境变量

# Begin set java environment

export JAVA_HOME=/opt/java/jdk1.5.0_22

export JRE_HOME=/opt/java/jdk1.5.0_22/jre

export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH

export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

# End set java environment

Unpack i.MX Android Release Package

After you setup a Linux PC, unpack the FSL i.MX Android Release Package using the following commands:

$ cd

/opt (or any other directory you like)

$ tar xzvf

imx-android-r8.tar.gz

$ cd imx-android-r8/code

$ tar xzvf r8.tar.gz

Assume you had unzipped i.MX

Android release package to /opt/imx-android-r8/.

$ cd /opt

/imx

-android

-r8/tool

$ tar xzvf

gcc

-4.1.2-glibc

-2.5-nptl

-3.tar.gz

-C /opt

Now you can find your cross compiler at /opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin

设置要导出的编译器相关的环境变量

#Freescale CrossCompiler Env

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-

export PATH=/opt/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin:$PATH

#

Prebuilt Image for uboot :

i.MX51 BBG3 board

Booting from SD

bootloader : imx51_BBG/u-boot.bin

kernel: imx51_BBG/uImage

Android file system:

"/":  imx51_BBG/SD/uramdisk.img

"/system":  imx51_BBG/SD/system.img

"/data" : imx51_BBG/SD/userdata.img. Not provided as it's empty.

"/recovery" : imx51_BBG/SD/recovery.img

Booting from TFTP/NFS

bootloader :

bootloader in SD: Same as "Booting from SD"

bootloader in SPI NOR: imx51_BBG/u-boot.bin

kernel: same as "Booting from SD"

Android file system: all in imx51_BBG/NFS/android_fs.tar.gz

下面开始repo代码打patch

Get Android Source Code (Android /Kernel /uboot )

the Android source code is maintained as more than 100 gits in an Android repository (Visit GitWeb from browser).

To get the Android source code from Google repo , follow the steps:

Assume you had unzipped i.MX

Android release package to /opt/imx-android-r8/.

$ cd

~

$ mkdir

myandroid

$ cd

myandroid

$ curl > ./repo

$ chmod

a+x

./repo

$ ./repo

init -u git://android.git.kernel.org/platform/manifest.git

-b eclair

$ cp /opt/imx-android-r8/code/r8/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:

$ cd

myandroid

$ git

clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.31.y.git kernel_imx

If you use uboot as your bootloader , then you need get a clean source code base from the original git :

$ cd myandroid/bootable/bootloader

$ git clone git://git.denx.de/u-boot.git uboot-imx

Patch Code for i.MX  

Apply all i.MX Android patches using following steps:

Assume you had unzipped i.MX

Android release package to /opt/imx-android-r8/.

$ cd

~/myandroid

$ . /opt/imx-android-r8/code/r8/and_patch.sh

$ help

Now you should see "c_patch

" function is available for you

$ c_patch /opt/imx-android-r8/code/r8 imx_r8

Here "/opt/imx-android-r8/code/r8" is the location of the patches (i.e. directory created when you unzip release package)

"imx_r8" 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_r8".

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

**************************************************************

Note: The patch script ( and_patch.sh ) utalizes  some basic utilities like awk/sed . If they are not available on your LinuxPC , install them in advance.

Build uboot

$ cd ~/myandroid/bootable/bootloader/uboot-imx

$ echo $ARCH && echo $CROSS_COMPILE

Make sure you have those 2 environment variables set

Command to build for i.MX51 BBG3 board is:

$ make mx51_bbg_android_config

$ make

"u-boot.bin " is generated if you have a successful build.

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwfjfp.html