LineageOS in Android Oreo flavor is finally here, I guess it is time to update the guide I wrote a while back.
Most of the stuff is exactly the same, for the sake of simplicity this guide will be pretty much a copy and paste of the old one with just some bits changed here and there.
Required packages on Fedora are (rpmfusion repo must be previously installed):
$ sudo dnf install screen java-1.8.0-openjdk-devel git schedtool ncurses-devel ncurses-libs ncurses-compat-libs ImageMagick-devel libstdc++-devel bison gnupg lzma
For some reason the compilation process stores some temporary files in /tmp which, in Fedora, is mounted on a tmpfs ramdisk.
In case the ramdisk runs out of space for some retarded reason the build process instead of halting will go on like nothing happens and produce borked binaries as output.
To keep /tmp mounted on HDD run:
systemctl mask tmp.mount
Download the SDK (sdk-tools-linux) and extract the files, if building on an headless machine just get the command line tools: https://developer.android.com/studio/index.html#downloads
$ mkdir android-sdk-linux $ mv sdk-tools-linux-3859397.zip $ cd android-sdk-linux $ unzip sdk-tools-linux-3859397.zip $ vi ~/.bash_profile --- export ANDROID_HOME=/home/user/android-sdk-linux export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH:$ANDROID_HOME/platform-tools --- $ source .bash_profile
Download the latest version of “Android SDK Tools”, “Android SDK Platform-tools”, “Android SDK Build-tools” and “SDK Plattform Android”:
### list available downloads $ sdkmanager --list $ sdkmanager "platform-tools" "tools"
Get repo utility and create a directory where Android’s source code will be downloaded.
Screen utility might come in handy since the download will likely take some time (it is around 60 GB).
$ sudo curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo $ sudo chmod a+x /usd/bin/repo $ mkdir -p ~/android/system $ cd android/system ### replace cm-14.1 with the desired branch $ repo init -u git://github.com/LineageOS/android.git -b lineageos-15.1 $ repo sync -j16
Now it is time to download the source code needed to compile for a specific device, which is a Oneplus 3 in my case.
Before actually compiling it is a good idea to run “make clobber” to clean the system from all the temp files created the previous time Android was compiled.
While this should not be necessary and makes the compilation procedure much longer it should ensure that everything is recompiled correctly every time even if some binary blobs have changed:
$ make clobber $ source build/envsetup.sh $ breakfast oneplus3
Double check that all the needed repository are actually present in roomservice.xml file:
<?xml version="1.0" encoding="UTF-8"?> <manifest> <project name="LineageOS/android_device_oneplus_oneplus3" path="device/oneplus/oneplus3" remote="github" revision="lineage-15.1" /> <project name="LineageOS/android_device_oppo_common" path="device/oppo/common" remote="github" revision="lineage-15.1" /> <project name="LineageOS/android_kernel_oneplus_msm8996" path="kernel/oneplus/msm8996" remote="github" revision="lineage-15.1" /> <project name="LineageOS/android_packages_resources_devicesettings" path="packages/resources/devicesettings" remote="github" revision="lineage-15.1" /> <project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" revision="lineage-15.1" /> <project name="LineageOS/android_external_sony_boringssl-compat" path="external/sony/boringssl-compat" remote="github" revision="lineage-15.1" /> <project name="LineageOS/android_external_stlport" path="external/stlport" remote="github" revision="lineage-15.1" /> <project name="TheMuppets/proprietary_vendor_oneplus" path="vendor/oneplus" remote="github" revision="lineage-15.1" /> </manifest>
Google’s Android compilation guide suggest the user to enable gcc ccache, I prefer to keep it disabled because it can cause corrupted output (it already happened more than once to me).
Set jack server’s allocated memory (-Xmx flag) to as much RAM you can spare for it:
$ repo sync #$ export USE_CCACHE=1 #$ prebuilts/misc/linux-x86/ccache/ccache -M 50G $ export ANDROID_JACK_VM_ARGS="-Xmx8192m -Dfile.encoding=UTF-8 -XX:+TieredCompilation" #set this environmental variable to include su binaries $ export WITH_SU=true $ brunch oneplus3
The compiled binaries can be found in ~/android/system/out/target/product/oneplus3/, it will all be compressed in an archive named “lineage-version-date-UNOFFICIAL-oneplus3” that can then be flashed from recovery.
This LineageOS build procedure can be extended to any other device, the only thing that needs to be adjusted are the repositories present in roomservice.xml file.
.:. How to install
The correct procedure to install this ROM on Oneplus 3 is comprised of the following steps:
1. Download and install the latest release of TWRP recovery from here: https://twrp.me/oneplus/oneplusthree.html
2. Power off the phone and boot into recovery.
3. Upgrade the baseband firmware to the latest version, the best and safest way to get those is by extracting them directly from Oneplus own ROM.
4. Flash LineageOS 15.1