Build LineageOS forGoogle Galaxy Nexus LTE (Sprint)

   日期:2024-12-27    作者:35wfx 移动:http://3jjewl.riyuangf.com/mobile/quote/63636.html

These instructions will hopefully assist you to start with a stock Google Galaxy Nexus LTE (Sprint), unlock the bootloader (if necessary), and then download the required tools as well as the very latest source code for LineageOS (based on Google’s Android operating system) for your device. Using these, you can build both a LineageOS installation zip and a LineageOS Recovery image and install them on your device.

It is difficult to say how much experience is necessary to follow these instructions. While this guide is certainly not for the extremely uninitiated, these steps shouldn’t require a PhD in software development either. Some readers will have no difficulty and breeze through the steps easily. Others may struggle over the most basic operation. Because people’s experiences, backgrounds, and intuitions differ, it may be a good idea to read through just to ascertain whether you feel comfortable or are getting over your head.

Remember, you assume all risk of trying this, but you will reap the rewards! It’s pretty satisfying to boot into a fresh operating system you baked at home :). And once you’re an Android-building ninja, there will be no more need to wait for “nightly” builds from anyone. You will have at your fingertips the skills to build a full operating system from code and install it to a running device, whenever you want. Where you go from there– maybe you’ll add a feature, fix a bug, add a translation, or use what you’ve learned to build a new app or port to a new device– or maybe you’ll never build again– it’s all really up to you.

  • A Google Galaxy Nexus LTE (Sprint).
  • A relatively recent x86_64 computer:
    • Linux, macOS, or Windows - these build instructions are only tested using Ubuntu 20.04 LTS, so we recommend going with that.
    • A reasonable amount of RAM (16 GB to build up to , 32 GB or more for and up). The less RAM you have, the longer the build will take. Enabling ZRAM can be helpful.
    • A reasonable amount of Storage (200 GB to build up to , 300 GB for and up). You might require more free space for enabling or building for multiple devices. Using SSDs results in considerably faster build times than traditional hard drives.
  • A decent internet connection and reliable electricity. :)
  • Some familiarity with basic Android operation and terminology. It may be useful to know some basic command line concepts such as , which stands for “change directory”, the concept of directory hierarchies, and that in Linux they are separated by , etc.

Let’s begin!

If you haven’t previously installed and , you can download them from Google. Extract it running:

Now you have to add and to your PATH. Open and add the following:

Then, run to update your environment.

Several packages are needed to build LineageOS. You can install these using your distribution’s package manager.

To build LineageOS, you’ll need:

To build LineageOS 13.0, you’ll also need:

For Ubuntu 23.10 (mantic), install from 23.04 (lunar) as follows:

While for Ubuntu versions older than 23.10 (mantic), simply install:

Additionally, for Ubuntu versions older than 20.04 (focal), install also:

While for Ubuntu versions older than 16.04 (xenial), install:

Java

Different versions of LineageOS require different JDK (Java Development Kit) versions.

  • LineageOS 18.1+: OpenJDK 11 (included in source download)
  • LineageOS 16.0-17.1: OpenJDK 1.9 (included in source download)
  • LineageOS 14.1-15.1: OpenJDK 1.8 (install )
    • NOTE: For building these versions you’ll need to remove and from in .
  • LineageOS 11.0-13.0: OpenJDK 1.7 (install )*

* Ubuntu 16.04 and newer do not have OpenJDK 1.7 in the standard package repositories. See the Ask Ubuntu question “How do I install openjdk 7 on Ubuntu 16.04 or higher?”. Note that the suggestion to use PPA openjdk-r is outdated (the PPA has never updated their offering of openjdk-7-jdk, so it lacks security fixes); skip that answer even if it is the most upvoted.

Python

Different versions of LineageOS require different default Python versions.

  • LineageOS 17.1+: Python 3 (install )
  • LineageOS 11.0-16.0: Python 2 (install )

If your default is , but you’re building branch that requires , there are various methods to using it, e.g. symlinking it manually or creating a virtualenv for it. We recommend the latter:

Generate the virtualenv once using . Afterwards, activate it in each terminal where you need as default by running .

The path can be chosen freely, this is just an example!

You’ll need to set up some directories in your build environment.

To create them:

The directory will contain the git-repo tool (commonly named “repo”) and the directory will contain the source code of LineageOS.

Enter the following to download the binary and make it executable (runnable):

In recent versions of Ubuntu, should already be in your PATH. You can check this by opening with a text editor and verifying the following code exists (add it if it is missing):

Then, run to update your environment.

Given that requires you to identify yourself to sync Android, run the following commands to configure your identity:

Due to their size, some repos are configured for or . To make sure your distribution is prepared for this, run:

To avoid duplicated trailers in commit messages, especially when cherry-picking changes, make a known trailer to git:

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

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

where corresponds to 50GB of cache. This needs to be run once. Anywhere from 25GB-100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you’re only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration.

You can also enable the optional compression. While this may involve a slight performance slowdown, it increases the number of files that fit in the cache. To enable it, run:

The following branches can be used to build for the Google Galaxy Nexus LTE (Sprint):

  • cm-13.0

Enter the following to initialize the repository:

To start the download of the source code to your computer, type the following:

The LineageOS manifests include a sensible default configuration for repo, which we strongly suggest you use (i.e. don’t add any options to sync). For reference, our default values are and . The part implies be four simultaneous threads/connections. If you experience problems syncing, you can lower this to or . On the other hand, makes repo to pull in only the current branch instead of all branches that are available on GitHub.

After the source downloads, ensure you’re in the root of the source code (), then type:

This will download your device’s device specific configuration and kernel.

Now ensure your Google Galaxy Nexus LTE (Sprint) is connected to your computer via the USB cable, with ADB and root enabled, and that you are in the folder. Then run the script:

The blobs should be pulled into the folder. If you see “command not found” errors, may need to be placed in .

Time to start building! Now, type:

The build should begin.

Assuming the build completed without errors (it will be obvious when it finishes), type the following in the terminal window the build ran in:

There you’ll find all the files that were created. The two files of more interest are:

  1. , which is the LineageOS recovery image.
  2. , which is the LineageOS installer package.

特别提示:本信息由相关用户自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。


举报收藏 0评论 0
0相关评论
相关最新动态
推荐最新动态
点击排行
{
网站首页  |  关于我们  |  联系方式  |  使用协议  |  隐私政策  |  版权隐私  |  网站地图  |  排名推广  |  广告服务  |  积分换礼  |  网站留言  |  RSS订阅  |  违规举报  |  鄂ICP备2020018471号