〖Android〗编译CyanogenMod 10.2的操作步骤(详解)

1. 安装好Linux的32位运行库(有部分软件是32位的)
    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install ia32-libs

2. 安装编译Android4.2.2及以上所依赖的环境 
    sudo apt-get install git-core gnupg flex bison python rar original-awk gawk p7zip-full gperf libsdl1.2-dev libesd0-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool libc6-dev x11proto-core-dev libx11-dev libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils g++-multilib lib32z1-dev ia32-libs lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib g++-multilib ctags xsltproc

3. 创建存放CyanogenMod源代码的目录
    mkdir -p ~/bin/
    mkdir -p ~/cm10.2/

4. 更新hosts,为正常访问Google等网站
    wget -c http://smarthosts.googlecode.com/svn/trunk/hosts >> /etc/hosts

5. 下载repo命令,给予对应的权限(第三句最好写入~/.bashrc文件中)
    curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    chmod a+x ~/bin/repo
    export PATH=${PATH}:~/bin

6. 同步CyanogenMod源代码
    cd ~/cm10.2/
    repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
    repo sync -j4

7. 代码同步完成之后,编译前,先下载一些未开源的二进制文件
    cd ~/cm10.2/vendor/cm/
    ./get-prebuilts

8. 克隆远程的MI2的cm10.2的代码至本地
    cd ~/cm10.2/
    git clone git@github.com:scue/android_device_xiaomi_aries.git ~/cm10.2/device/xiaomi/aries

9. 开始编译MI2的cm10.2
    cd ~/cm10.2/device/xiaomi/aries/
    git checkout cm-10.2 # 切换至cm-10.2分支
    ./extract-files.sh # 从手机上拉取文件,需要连接米2手机,这会写文件至vendor/xiaomi/aries
    cd ~/cm10.2/
    . build/envsetup.sh
    breakfast aries
    brunch aries > out.txt 2>&1 &
    tail -f out.txt # 查看输出信息

10. 相关链接:
    http://cdimage.debian.org/debian-cd/7.1.0/amd64/iso-cd/
    http://wiki.cyanogenmod.org/w/Doc:_porting_intro
    http://wiki.cyanogenmod.org/w/Build_for_i9300
    https://github.com/mitwo-dev/android_device_xiaomi_aries

11. VirtualBox相关
    sudo apt-get install -y dkms linux-headers-$(uname -r)
    sudo gpasswd vboxusers -a $USER

 

posted @ 2013-08-24 18:58  scue  阅读(3373)  评论(1编辑  收藏  举报