1:
Detailed instructions for Ubuntu and MacOS follow. In general you will need:
-
Python 2.6 -- 2.7, which you can download from python.org.
-
GNU Make 3.81 -- 3.82, which you can download from gnu.org,
-
JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both fromjava.sun.com.
-
Git 1.7 or newer. You can find it at git-scm.com.
sudo add-apt-repository ppa:eugenesan/java
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" $ sudo apt-get update $ sudo apt-get install sun-java6-jdk
使用上面的命令安装不了,我用这个: sudo add-apt-repository ppa:eugenesan/java sudo apt-get updatesudo apt-get install sun-java6-jdk 手动安装命令 chmod +x jdk-6u45-linux-x64.bin sudo ./jdk-6u45-linux-x64.bin sudo mkdir -p /usr/lib/jvm/ sudo mv jdk1.6.0_45/ /usr/lib/jvm/ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1 sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1 sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1 sudo update-alternatives --config jar sudo update-alternatives --config java sudo update-alternatives --config javac sudo update-alternatives --config javaws sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 1 sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk1.6.0_45/bin/javah 1 sudo update-alternatives --install /usr/bin/java_vm java_vm /usr/lib/jvm/jdk1.6.0_45//jre/bin/java_vm 1 sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk1.6.0_45/bin/javap 1 sudo update-alternatives --config javah sudo update-alternatives --config java_vm sudo update-alternatives --config javadoc sudo update-alternatives --config javap
sudo add-apt-repository ppa:git-core/ppa sudo apt-get update echo y | sudo apt-get install git git config --global user.email "quanguoheme@gmail.com" git config --global user.name "guojin_he"
3.1 Get Android Source Code (Android/Kernel/U-Boot)
The Android source code is maintained as more than 100 gits in the Android repository (android.googlesource.com).
To get the Android source code from Google repo, follow the steps below:
Assume you had unzipped i.MX Android release package to /opt/android_jb4.2.2_1.0.0-
ga_source/.
$ cd ~
$ mkdir myandroid
$ cd myandroid
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ./repo
$ chmod a+x ./repo
$ ./repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1
$ ./repo sync # this command loads most needed repos. Therefore, it can take a while to loaGet jb4.2.2_1.0.0-ga kernel source code from Freescale open source git:
上方的方法下载源码总是失败,因为谷歌下载需要认证方法2:
d到谷歌权限申请 登陆谷歌帐号出现权限编码.
复制machine 后面的2行到 ~/.netrc 。然后最好在根目录也创建一个/.netrc $ mkdir ~/bin PATH=~/bin:$PATH $ cd ~/bin $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo $ chmod a+x ~/bin/repo $ mkdir ~/WORKING_DIRECTORY $ cd ~/WORKING_DIRECTORY repo init -u https://android.googlesource.com/a/platform/manifest -b android-4.0.4_r1.1 // -b android-4.2.2_r1
repo sync -f -j4
$ cd myandroid
$ git clone git://git.freescale.com/imx/linux-2.6-imx.git kernel_imx # the kernel repo is
heavy. Therefore, this process can take a while.
$ cd kernel_imx
$ git checkout jb4.2.2_1.0.0-ga
NOTE
If you are behind proxy, use socksify to set socks proxy for git protocol.
If you use U-Boot as your bootloader, then you can clone the U-Boot git repository from Freescale open source git:
$ cd myandroid/bootable
$ cd bootloader
$ git clone git://git.freescale.com/imx/uboot-imx.git uboot-imx
$ cd uboot-imx
$ git checkout jb4.2.2_1.0.0-ga
编辑.bashrc
export USE_CCACHE=1
export CCACHE_DIR=<path-to-your-cache-directory>
在myandroid目录中输入
prebuilts/misc/linux-x86/ccache/ccache -M 50G
3.2 Patch Code for i.MX
Apply all i.MX Android patches by using the following steps:
Assume you had unzipped i.MX Android release package to /opt/android_jb4.2.2_1.0.0-ga_source.
$ cd ~/myandroid
$ source /opt/android_jb4.2.2_1.0.0-ga_source/code/jb4.2.2_1.0.0-ga/and_patch.sh
$ help
Now you should see that the "c_patch" function is available
$ c_patch /opt/android_jb4.2.2_1.0.0-ga_source/code/jb4.2.2_1.0.0-ga imx_jb4.2.2_1.0.0-ga
Here "/opt/android_jb4.2.2_1.0.0-ga_source/code/jb4.2.2_1.0.0-ga" is the location of the
patches (i.e. directory created when you unzip release package)
"imx_jb4.2.2_1.0.0-ga" 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_jb4.2.2_1.0.0-ga".
If everything is OK, "c_patch" will generate the following output to indicate successful
patch:
**************************************************************
Success: Now you can build the Android code for FSL i.MX platform
*************************************************************
译过程中会发现内存不够,最好增加交换区的空间,我是增加到了5G多 sudo apt-get install sed awk 这个我机器上已经有了,不需要安装。不过具体最好看下有没有 一些有用的调试命令:dpkg -L packageName dpkg -s soName 如果有些包,没有,可以到网上下载:http://packages.debian.org/sid/i386/liblzo2-2/download 不能完全按照官网的来,我写了个脚本,有些地方不同。主要是x86包和x64包的不同的问题 echo "________________0_____________________________" sudo add-apt-repository ppa:eugenesan/java sudo apt-get purge openjdk* sudo apt-get update echo 'y' | sudo apt-get install sun-java6-jdk echo 'y' | sudo apt-get dist-upgrade sudo apt-get purge openjdk* echo 'y' | sudo apt-get install mountmanager synaptic echo 'y' | sudo apt-get install vim nfs-kernel-server samba samba-common system-config-samba cifs-utils echo "________________1_____________________________" echo 'y' | sudo apt-get install gcc-4.4 gcc-4.4-multilib echo 'y' | sudo apt-get install g++-4.4 g++-4.4-multilib ls -l /usr/bin/gcc* cd /usr/bin pwd sudo mv gcc gcc.bak sudo ln -s gcc-4.4 gcc ls -l /usr/bin/gcc* ls -l /usr/bin/g++* sudo mv g++ g++.bak sudo ln -s g++-4.4 g++ ls -l /usr/bin/g++* echo "gcc g++ 4.4 install finish" echo "_________________2____________________________" echo 'y' | sudo apt-get install uuid-dev liblzo2-dev uboot-mkimage echo 'y' | sudo apt-get install git gnupg flex bison gperf build-essential echo 'y' | sudo apt-get install zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev echo 'y' | sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 echo 'y' | sudo apt-get install libgl1-mesa-dev g++-multilib mingw32 tofrodos echo 'y' | sudo apt-get install python-markdown libxml2-utils xsltproc zlib1g-dev:i386 sudo ls echo "__________________3___________________________" ls -l /usr/bin/gcc* cd /usr/bin pwd sudo mv gcc gcc.bak sudo ln -s gcc-4.4 gcc ls -l /usr/bin/gcc* ls -l /usr/bin/g++* sudo mv g++ g++.bak sudo ln -s g++-4.4 g++ ls -l /usr/bin/g++* echo "_________________4____________________________" echo 'y' | sudo apt-get remove uuid-dev liblzo2-dev echo 'y' | sudo apt-get install uuid-dev:i386 liblzo2-dev:i386 echo "android environment install finish"libgl1-mesa-glx:i386是个大问题,如果安装的话,会导致开机失败,因为他会删除xserver。直接从别的机器copy一个即可这里可以下载一个:http://download.csdn.net/detail/quanguoheme/5876425 git@linode.boundarydevices.com===================================================================================================================================================================================================