Compile LineageOS for Oneplus 3 on Fedora 25
来源:互联网 发布:网络信息安全英语ppt 编辑:程序博客网 时间:2024/04/29 10:47
https://uwot.eu/blog/compile-lineageos-for-oneplus-3-on-fedora-25/
Android community is one big cancerous clusterfuck, it is no wonder that finding a decent guide on how to compile Android from source written in a somewhat comprehensible english is pretty much mission impossible.
Cyanogenmod Inc. shutting down their wiki and services overnight surely didn’t help either.
Required packages on Fedora 25 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 25, 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 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
tools_r25.2.3-linux.zip android-sdk-linux
$
cd
android-sdk-linux
$ unzip tools_r25.2.3-linux.zip
$
vi
~/.bash_profile
---
export
ANDROID_HOME=
/home/user/android-sdk-linux
export
PATH=$PATH:$ANDROID_HOME
/tools
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
$ android list sdk
$ android update sdk --no-ui --filter 1,2,3,33
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).
$ curl https:
//storage
.googleapis.com
/git-repo-downloads/repo
> ~
/bin/repo
$
chmod
a+x ~
/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 cm-14.1
$ repo
sync
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"
/>
<
project
name
=
"LineageOS/android_device_oppo_common"
path
=
"device/oppo/common"
remote
=
"github"
/>
<
project
name
=
"LineageOS/android_kernel_oneplus_msm8996"
path
=
"kernel/oneplus/msm8996"
remote
=
"github"
/>
<
project
name
=
"LineageOS/android_packages_resources_devicesettings"
path
=
"packages/resources/devicesettings"
remote
=
"github"
/>
<
project
name
=
"LineageOS/android_vendor_nxp-nfc_opensource_frameworks"
path
=
"vendor/nxp-nfc/opensource/frameworks"
remote
=
"github"
/>
<
project
name
=
"LineageOS/android_vendor_nxp-nfc_opensource_libnfc-nci"
path
=
"vendor/nxp-nfc/opensource/libnfc-nci"
remote
=
"github"
/>
<
project
name
=
"LineageOS/android_vendor_nxp-nfc_opensource_Nfc"
path
=
"vendor/nxp-nfc/opensource/Nfc"
remote
=
"github"
/>
<
project
name
=
"LineageOS/android_device_qcom_common"
path
=
"device/qcom/common"
remote
=
"github"
/>
<
project
name
=
"LineageOS/android_external_sony_boringssl-compat"
path
=
"external/sony/boringssl-compat"
remote
=
"github"
revision
=
"cm-14.1"
/>
<
project
name
=
"LineageOS/android_external_stlport"
path
=
"external/stlport"
remote
=
"github"
revision
=
"cm-14.1"
/>
<
project
name
=
"TheMuppets/proprietary_vendor_oneplus"
path
=
"vendor/oneplus"
remote
=
"github"
revision
=
"cm-14.1"
/>
<
project
name
=
"TheMuppets/proprietary_vendor_qcom_binaries"
path
=
"vendor/qcom/binaries"
remote
=
"github"
revision
=
"cm-14.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.
The recovery everyone suggest to use for oneplus3 can be found here: https://forum.xda-developers.com/oneplus-3/development/recovery-twrp-3-0-2-0-touch-recovery-t3402999
This procedure can be extended to any other device, the only thing that needs adjustment are the repositories present in roomservice.xml file.
To compile LineageOS for a LG G3 for the european market (codename: d855) run repo sync, breakfast d855 and add the correct binary blob repository to roomservice.xml:
<
project
name
=
"TheMuppets/proprietary_vendor_lge"
path
=
"vendor/d855"
remote
=
"github"
revision
=
"cm-14.1"
/>
d855 for some reason also needs lzma to compress the Linux kernel.
- Compile LineageOS for Oneplus 3 on Fedora 25
- compile static perl on fedora
- LineageOS 14.1 for Xiaomi Redmi 3/Prime
- Compile Android on Fedora 15 X86_64
- Compile FFmpeg on CentOS / RHEL / Fedora
- LineageOS 14.1 (Android 7.1.2) for Raspberry Pi 3
- Build compile environment for gingerbread on Ubuntu1104
- compile x264 for Android on Mac
- Compile Hadoop plugins for Eclipse on Centos
- compile x264 for Android on Mac
- compile boost for vs2015 on win10
- LineageOS
- compile command【 su 】 into LineageOS-14.1 ROM --- Update & Build Prep – LineageOS
- Compile ASOP Froyo for Dream on Ubuntu 10.4
- some collected compile error for firefox source on Ubuntu 10.04
- Octave compile on CentOS 5.5 for local user
- How To Build CyanogenMod Android (oneplus/bacon) On Linux
- how to compile android2.3 on ubuntu14
- 【Unity3D】中如何分配内存占用(解决内存占用过大问题)
- 基础练习 十六进制转十进制
- 妙啊
- js内存泄漏常见的四种情况
- java基础学习面向对象API中Math类random方法使用 五-5
- Compile LineageOS for Oneplus 3 on Fedora 25
- myeclipse 修改项目依赖的Libraries
- Ubuntu 16.04 建立QUME编译环境报错
- Oracle和MySQL的语法区别
- 压力测试工具
- Android存储访问及目录
- 用 Python 编写网络爬虫 笔记
- 用CSS实现箭头arrow
- spring学习(八)—AOP通过注解方式实现