如何编译 cm12 (for 一加手机)


CN:准备编译

EN:Preparing System for Build


CN:通过APT-GET,安装以下d软件包

EN:Install the following items via apt-get.
Code:
sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

CN:如果是32位系统,清不要安装g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

EN:As per the instructions on the wiki for building CM, if you use a 32bit system, do not install g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev.


CN:安装最新版本JDK

EN:Install the latest version of Java's development kit using the following.
Code:
sudo apt-get install openjdk-7-jdk

CN:安装ADT

EN:Install the Android Development Kit using the following.

Code:
sudo apt-get install android androidsdk-uiautomatorviewer android-copyright android-src-vendor android-emulator android-tools-adb android-headers android-tools-adbd androidsdk-ddms  android-tools-fastboot androidsdk-hierarchyviewer android-tools-fsutils androidsdk-traceview

CN:执行以下指令

EN:Run the following in terminal.

Code:
mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

CN:重启系统,加载配置文件

EN:reboot your system or use the following in terminal to load the .profile file again.

Code:
. ~/.profile

CN: 获取源码

EN:Getting the source code.


CN:执行以下命令,获取CM12的源码

EN:Now we can get onto grabbing the source code of CM12.
      Run the following in terminal.
Code:
mkdir ~/cm
cd ~/cm
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.0
mkdir .repo/local_manifests
nano .repo/local_manifests/local_manifests.xml

CN: 当NANO打开之后,粘贴下面的内容,然后用ctrlx保存

When nano appears, paste the following into it and then exit using ctrl-x and choose to save.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_oneplus_bacon" path="device/oneplus/bacon" remote="github" />
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" />
<project name="CyanogenMod/android_device_oppo_msm8974-common" path="device/oppo/msm8974-common" remote="github" />
<project name="CyanogenMod/android_device_oppo_common" path="device/oppo/common" remote="github" revision="cm-12.0" />
<project name="CyanogenMod/android_kernel_oneplus_msm8974" path="kernel/oneplus/msm8974" remote="github" />
<project name="TheMuppets/proprietary_vendor_oppo" path="vendor/oppo" remote="github" />
<project name="TheMuppets/proprietary_vendor_oneplus" path="vendor/oneplus" remote="github" />
<project name="CyanogenMod/android_frameworks_opt_connectivity" path="frameworks/opt/connectivity" remote="github" revision="cm-11.0" />
</manifest>

CN: 执行以下代码,继续获取代码

EN:Continue getting the code using the following.

Code:
repo sync
cd vendor/cm
./get-prebuilts
cd ../..

CN: 编译 CM12

EN:Building CM12

Run the following commands to build CyanogenMod.
Code:
. build/envsetup.sh
breakfast bacon
brunch bacon

CN: 成功编译,从out/target/product/bacon/ 获取 cm-12-*-UNOFFICIAL-bacon.zip

EN:After successful build, you should be able to go about copying the built CyanogenMod and installing it into your phone. The CyanogenMod build is located in ~/cm/out/target/product/bacon/ named something like cm-12-*-UNOFFICIAL-bacon.zip


You can install folllowing:  http://forum.xda-developers.com/onep...s-one-t2940091

Re-building to update.
To re-build, you should just be able to run the following (Not yet tested myself, but makes logical sense).
Code:
make clobber
repo sync
cd vendor/cm
./get-prebuilts
cd ../..
. build/envsetup.sh
brunch bacon
Q&A
Q: Recieve error: fatal: duplicate path  device/qcom/sepolicy  in ~/cm/.repo/manifest.xml
A: edit .repo/local_manifests/local_manifests.xml to remove the item which matches the item located in bold.

Q: How big is the repo?
A: 20GB just source code and 40GB when built. Therefore you should aim to have about 60GB free on your system.
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值