本帖最后由 Anxyuuu 于 2019-1-25 11:52 编辑
1 安装ubuntu12.04[size=11.0000pt]
[size=11.0000pt](如果使用下载明远智睿的虚拟机,请直接跳到 下载源码并解压 这一节)[size=11.0000pt]
[size=11.0000pt]在这里建议用户使用64bit的ubuntu12.04的操作系统,已经真机编译验证过。
[size=11.0000pt]
2 安装openjdk1.7
[size=12.0000pt]运行一下命令安装openjdk1.7[size=12.0000pt]
[size=12.0000pt]sudo add-apt-repository "deb http://archive.canonical.com/lucid partner"[size=12.0000pt]
[size=12.0000pt]sudo apt-get update[size=12.0000pt]
[size=12.0000pt]sudo apt-get install openjdk-7-jdk[size=12.0000pt]
[size=12.0000pt]$ sudo gedit /etc/profile[size=12.0000pt]
[size=12.0000pt]增加以下环境变量[size=12.0000pt]
[size=12.0000pt]export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/[size=12.0000pt]
[size=12.0000pt]export JRE_HOME=$JAVA_HOME/jre[size=12.0000pt]
[size=12.0000pt]export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH[size=12.0000pt]
[size=12.0000pt]export PATH=$JAVA_HOME/bin:$PATH:$JRE_HOME/bin[size=12.0000pt]
[size=12.0000pt]$ source /etc/profile[size=12.0000pt]
[size=12.0000pt]$ java –version[size=12.0000pt]
[size=12.0000pt](看到版本为1.7.0_101就表示成功)
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 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 lzop[size=11.0000pt]
[size=11.0000pt]$ sudo apt-get install git-core curl[size=11.0000pt]
[size=11.0000pt]$ sudo apt-get install u-boot-tools[size=11.0000pt]
[size=11.0000pt]$ sudo apt-get install mtd-utils[size=11.0000pt]
[size=11.0000pt]$ sudo apt-get install android-tools-fsutils
[size=11.0000pt]
4 下载源码并解压源码
4.1 下载源码
[size=11.0000pt]登陆http://www。[size=11.0000pt]M[size=11.0000pt]yzr。com.CN下载专区下载Android5.1源码[size=11.0000pt]
[size=11.0000pt]Android5.1.1的分卷压缩解压后的源码包:myzr_android-5.1.1.tar.bz2
[size=11.0000pt]
4.2 解压源码
[size=11.0000pt]$ mkdir ~/myandroid5.1[size=11.0000pt]
[size=11.0000pt]$ cd ~[size=11.0000pt]
[size=11.0000pt]$ tar -jxvf myzr_android-5.1.1_r1.tar.bz2
[size=11.0000pt]
4.3 编译源码(Android系统)
4.3.1 设置环境变量
[size=11.0000pt]$ export ARCH=arm[size=11.0000pt]
[size=11.0000pt]$ export CROSS_COMPILE=~/myandroid5.1/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-[size=11.0000pt]
[size=11.0000pt]$ export PATH=~/myandroid5.1/bootable/bootloader/uboot-imx/tools:$PATH
[size=11.0000pt]
4.3.2 编译uboot
[size=11.0000pt]$ cd ~/myandroid5.1/bootable/bootloader/uboot-imx[size=11.0000pt]
[size=11.0000pt]$ make distclean[size=11.0000pt]
[size=11.0000pt]$ make myimx6ek200-6q_android_defconfig (EK200-6Q-1G配置)[size=11.0000pt]
[size=11.0000pt]或 $ make myimx6ek200-6q-2g_android_defconfig (EK200-6Q-2G配置)[size=11.0000pt]
[size=11.0000pt]或 $ make myimx6ek200-6qp_android_defconfig (EK200-6QP-1G配置)[size=11.0000pt]
[size=11.0000pt]或 $ make myimx6ek200-6s-1g_android_defconfig (EK200-6S-1G配置)[size=11.0000pt]
[size=11.0000pt]或 $ make myimx6ek200-6u_android_defconfig (EK200-6U-1G配置)[size=11.0000pt]
[size=11.0000pt]或 $ make myimx6ek314-6q-2g_android_defconfig (EK314-6Q-2G配置)[size=11.0000pt]
[size=11.0000pt]或 $ make myimx6ek314-6q_android_defconfig (EK314-6Q-1G配置)[size=11.0000pt]
[size=11.0000pt]或 $ make myimx6ek314-6u_android_defconfig (EK314-6U-2G配置)[size=11.0000pt]
[size=11.0000pt]$ make
[size=11.0000pt]
4.3.3 编译kernel
[size=11.0000pt]$ cd ~/myandroid5.1/kernel_imx[size=11.0000pt]
[size=11.0000pt]$ cp myzr.config .config[size=11.0000pt]
[size=11.0000pt]$ make uImage LOADADDR=0x10008000
[size=11.0000pt]
4.3.4 编译bootimg (uImage和ramdisk)
[size=11.0000pt]$ cd ~/myandroid5.1[size=11.0000pt]
[size=11.0000pt]$ source build/envsetup.sh[size=11.0000pt]
[size=11.0000pt]$ lunch myimx6ek_6dq-user [size=11.0000pt]
[size=11.0000pt]$ make bootimage
[size=11.0000pt]
4.3.5 编译system
[size=12.0000pt]$ cd ~/myandroid5.1[size=12.0000pt]
[size=12.0000pt]$ source build/envsetup.sh[size=12.0000pt]
[size=12.0000pt]$ lunch myimx6ek_6dq-user [size=12.0000pt]
[size=12.0000pt]$ make[size=12.0000pt]
[size=12.0000pt]结果如下图所示:
[size=12.0000pt]注意:生成的u-boot.imx在~/myandroid/bootable/bootloader/uboot-imx目录下,boot.img和recovery.img和system.img在~/myandroid/out/target/product/myimx6ek_6dq目录下。
[size=12.0000pt]
5 启动环境变量设置
5.1 单屏显示
5.1.1 LVDS设置
[size=11.0000pt]setenv bootargs console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M(不能用调试串口)[size=11.0000pt]
[size=11.0000pt]setenv bootargs console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32[size=11.0000pt]
[size=11.0000pt]video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M androidboot.selinux=disabled androidboot.dm_verity=disabled(可以用调试串口)
[size=11.0000pt]
5.1.2 HDMI设置
[size=11.0000pt]setenv bootargs console=ttymxc0,115200 androidboot.console=ttymxc0 consoleblank=0 vmalloc=256M init=/init video=mxcfb0:dev=hdmi,1920x1080M@60,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off androidboot.hardware=freescale cma=384M[size=11.0000pt]
[size=11.0000pt](不能用调试串口)[size=11.0000pt]
[size=11.0000pt]setenv bootargs console=ttymxc0,115200 androidboot.console=ttymxc0 consoleblank=0 vmalloc=256M init=/init video=mxcfb0:dev=hdmi,1920x1080M@60,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off androidboot.hardware=freescale cma=384M[size=11.0000pt]
[size=11.0000pt]androidboot.selinux=disabled androidboot.dm_verity=disabled(可以用调试串口)
[size=11.0000pt]
5.2 双屏显示
5.2.1 LVDS+HDMI设置
[size=11.0000pt]setenv bootargs console=ttymxc0,115200 androidboot.console=ttymxc0 consoleblank=0 vmalloc=256M init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:dev=hdmi,[size=11.0000pt]
[size=11.0000pt]1920x1080M@60,bpp=32 video=mxcfb2:off video=mxcfb3:off androidboot.hardware=freescale cma=384M (不能用调试串口)
[size=11.0000pt]setenv bootargs console=ttymxc0,115200 androidboot.console=ttymxc0 consoleblank=0 vmalloc=256M init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:dev=hdmi,1920x1080M@60,bpp=32 video=mxcfb2:off video=mxcfb3:off androidboot.hardware=freescale cma=384M androidboot.selinux=disabled androidboot.dm_verity=disabled (可以用调试串口)
[size=11.0000pt]
|