Build LineageOS for Nexus 5

  1. dependences
  2. Get source code
  3. 添加私有库
  4. 编译
  5. 刷机

dependences

To build LineageOS, you’ll need:

For Ubuntu 14.04:
bc bison build-essential ccache curl flex g++-multilib gcc-multilib git gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev

For Ubuntu 16.04 (xenial), substitute:
libwxgtk3.0-dev → libwxgtk2.8-dev
Java
Different versions of LineageOS require different JDK (Java Development Kit) versions.

LineageOS 14.1: OpenJDK 1.8 (install openjdk-8-jdk)
LineageOS 11.0-13.0: OpenJDK 1.7 (install openjdk-7-jdk)

Enter the following to download the repo binary and make it executable (runnable):
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

Get source code

$ repo init -u https://github.com/LineageOS/android.git -b cm-14.1
$ repo sync

Prepare the device-specific code

$ source build/envsetup.sh
$ breakfast hammerhead

Turn on caching to speed up build

Make use of ccache if you want to speed up subsequent builds by running:

$ export USE_CCACHE=1

and adding that line to your ~/.bashrc file. Then, specify the maximum amount of disk space you want ccache to use by typing this:

$ ccache -M 50G

添加私有库

vim .repo/local_manifests/lge.xml

<!-- nexus5 -->
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="TheMuppets/proprietary_vendor_lge.git" path="vendor/lge" remote="github" />
</manifest>
<!-- nexus6p -->
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="TheMuppets/proprietary_vendor_huawei.git" path="vendor/huawei" remote="github" />
</manifest>

之后再 repo sync 一次。

编译

export WITH_SU=true //打开root
brunch hammerhead

刷机

adb reboot bootloader
source build/envsetup.sh

#fastboot oem ramdump enable //如果bootloader download 模式未打开
breakfast hammerhead
fastboot -w flashall

PS:
关于科学上网:
1.将repo文件 https://android.googlesource.com/ 全部使用 https://aosp.tuna.tsinghua.edu.cn/ 代替。
2.替换已有的 AOSP 源代码的 remote,将 .repo/manifest.xml 把其中的 aosp 这个 remote 的 fetch 从 https://android.googlesource.com 改为 https://aosp.tuna.tsinghua.edu.cn/。

<manifest>
   <remote  name="aosp"
-           fetch="https://android.googlesource.com"
+           fetch="https://aosp.tuna.tsinghua.edu.cn"
            review="android-review.googlesource.com" />
   <remote  name="github"

同时,修改 .repo/manifests.git/config,将
url = https://android.googlesource.com/platform/manifest
更改为
url = https://aosp.tuna.tsinghua.edu.cn/platform/manifest


转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 450603622@qq.com

文章标题:Build LineageOS for Nexus 5

文章字数:427

本文作者:steinswang

发布时间:2018-01-05, 12:05:21

最后更新:2020-02-03, 11:15:26

原始链接:http://yoursite.com/2018/01/05/Build-LineageOS-for-Nexus-5/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录