1 安装ubuntu12.04[size=11.0000pt](如果使用下载明远智睿的虚拟机,请直接跳到 下载源码并解压 这一节)[size=11.0000pt]
[size=11.0000pt]在这里建议用户使用64bit的ubuntu12.04的操作系统,已经真机编译验证过。
[size=11.0000pt]
2 安装JDK1.6 SE[size=11.0000pt]登陆[size=11.0000pt]h[size=11.0000pt]tt[size=11.0000pt]tp[size=11.0000pt]:[size=11.0000pt]//www。[size=11.0000pt]m[size=11.0000pt]yzr。Com[size=11.0000pt]。cn的下载专区,下载jdk-6u45-linux-x64.bin文件[size=11.0000pt]
[size=11.0000pt]$ cd /usr[size=11.0000pt]
[size=11.0000pt]$ sudo mkdir java[size=11.0000pt]
[size=11.0000pt]$ cd java[size=11.0000pt]
[size=11.0000pt]$ sudo cp ~ /jdk-6u45-linux-x64.bin ./[size=11.0000pt]
[size=11.0000pt]$ sudo chmod 777 ./jdk-6u45-linux-x64.bin[size=11.0000pt]
[size=11.0000pt]$ sudo ./jdk-6u45-linux-x64.bin[size=11.0000pt]
[size=11.0000pt]$ sudo gedit /etc/profile[size=11.0000pt]
[size=11.0000pt]增加以下环境变量[size=11.0000pt]
[size=11.0000pt]export JAVA_HOME=/usr/java/jdk1.6.0_45[size=11.0000pt]
[size=11.0000pt]export JRE_HOME=$JAVA_HOME/jre[size=11.0000pt]
[size=11.0000pt]export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH[size=11.0000pt]
[size=11.0000pt]export PATH=$JAVA_HOME/bin:$PATH:$JRE_HOME/bin[size=11.0000pt]
[size=11.0000pt]$ source /etc/profile[size=11.0000pt]
[size=11.0000pt]$ java –version[size=11.0000pt]
[size=11.0000pt](看到版本为1.6.0_45就表示成功)
[size=11.0000pt]
3 安装编译Android系统所需要的库[size=11.0000pt]$ sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386[size=11.0000pt]
[size=11.0000pt]$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so[size=11.0000pt]
[size=11.0000pt]$ sudo apt-get install gcc:i386 linux-libc-dev:i386[size=11.0000pt]
[size=11.0000pt]$ sudo apt-get install uuid uuid-dev[size=11.0000pt]
[size=11.0000pt]$ sudo apt-get install zlib1g-dev liblz-dev[size=11.0000pt]
[size=11.0000pt]$ sudo apt-get install liblzo2-2 liblzo2-dev[size=11.0000pt]
[size=11.0000pt]$ sudo apt-get install uuid-dev:i386[size=11.0000pt]
[size=11.0000pt]$ sudo apt-get install liblzo2-dev:i386[size=11.0000pt]
[size=11.0000pt]$ sudo ln -sf /lib/i386-linux-gnu/libuuid.so.1 /usr/lib/libuuid.so
[size=11.0000pt]
4 下载源码并解压源码4.1 下载源码[size=11.0000pt]登陆[size=11.0000pt]h[size=11.0000pt]tt[size=11.0000pt]tp[size=11.0000pt]:[size=11.0000pt]//www。[size=11.0000pt]m[size=11.0000pt]yzr。Com[size=11.0000pt]。cn下载专区下载Android4.2源码[size=11.0000pt]
[size=11.0000pt]Android4.2的源码包:myzr_android4_2_2_1_1_0.tar.bz2
[size=11.0000pt]
4.2 解压源码[size=11.0000pt]$ mkdir ~/myandroid[size=11.0000pt]
[size=11.0000pt]$ cd ~[size=11.0000pt]
[size=11.0000pt]$ tar -jxvf myzr_android4_2_2_1_1_0.tar.bz2 –C ~/myandroid
[size=11.0000pt]
4.3 编译源码(Android系统)4.3.1 设置环境变量[size=11.0000pt]$ export ARCH=arm[size=11.0000pt]
[size=11.0000pt]$ export CROSS_COMPILE=~/myandroid/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi- $ export PATH=~/myandroid/bootable/bootloader/uboot-imx/tools:$PATH
[size=11.0000pt]
4.3.2 编译uboot[size=11.0000pt]$ cd ~/myandroid/bootable/bootloader/uboot-imx[size=11.0000pt]
[size=11.0000pt]$ make distclean[size=11.0000pt]
[size=11.0000pt]$ make mx6q_sabresd_android_config[size=11.0000pt]
[size=11.0000pt]$ make
[size=11.0000pt]
4.3.3 编译kernel[size=11.0000pt]$ cd ~/myandroid/kernel_imx[size=11.0000pt]
[size=11.0000pt]$ make imx6_android_defconfig[size=11.0000pt]
[size=11.0000pt]$ make uImage
[size=11.0000pt]
4.3.4 编译bootimg (uImagel和ramdisk)[size=11.0000pt]$ cd ~/myandroid[size=11.0000pt]
[size=11.0000pt]$ source build/envsetup.sh[size=11.0000pt]
[size=11.0000pt]$ lunch sabresd_6dq-eng (此为调试版本,发布版本改成lunch sabresd_6dq-usr)[size=11.0000pt]
[size=11.0000pt]$ make bootimage
[size=11.0000pt]
4.3.5 编译system[size=11.0000pt]$ cd ~/myandroid[size=11.0000pt]
[size=11.0000pt]$ source build/envsetup.sh[size=11.0000pt]
[size=11.0000pt]$ lunch sabresd_6dq-eng (此为调试版本,发布版本改成lunch sabresd_6dq-usr)[size=11.0000pt]
[size=11.0000pt]$ make
[size=11.0000pt]
|