oneplus3t-lineageos-16.1编译-android9
oneplus3t 前提
-
debian11(标准GNU工具集) arm 工具盘(chroot 风格rootfs, 含有 比如sshd 、gdb) : tinan/eadb.git
本仓库开发已经完毕,使用请直接从4.2开始
** LineageOS16_oneplus3t仓库群克隆 、 编译 、 刷机**
- 编译过程若
ctrl+c
强制终止,请重新从头编译
LineageOS16_oneplus3t仓库群克隆过程
LineageOS16_oneplus3t仓库群克隆过程描述: LineageOS16_oneplus3t_gitRepoLs_clone_desc.pdf
0_clone_me
git clone --branch zzz-stable https://gitlab.com/lineage16_oneplus3t/manifest-parser/git-repo.git /app4/git-repo
#/app4/git-repo/.git/config
1_lineageOS16_android9_repo_pull
仅开发时执行,产物已在本仓库,用户无需执行
此步骤执行了修改的repo命令,从而获得LineageOS-16.0–oneplus3t仓库群
执行内容
bash -x <(curl https://gitlab.com/lineage16_oneplus3t/manifest-parser/git-repo/-/raw/zzz-stable/projGit_ls/lineageOS16_android9_repo_pull.sh)
lineageOS16(android9)代码仓库拉取 ( 执行展开 ),
输入
manifest/lineageos-android–oneplus3t/lineage-16.0/default.xml
产物
-
仓库群描述 : projGit_ls/gen
/[projGit_ls.*.json|projGit_ls.*.md]
-
本地目录下仓库群 中 的 软链接命令、复制文件命令 : projGit_ls/gen
/[projCopyAndSoftLinkLs_ls.*.sh]
2_gitlabWebBatchImportReqXmlFile_gen
仅开发时执行,产物已在本仓库,用户无需执行
gitlab网页端批量导入请求生成
执行内容
bash /app4/git-repo/projGit_ls/json__to__gitlabWebBatchImportReqXmlFile/main.sh
( main.sh )
输入
即上一步产物: projGit_ls/gen/[projGit_ls.*.json|projGit_ls.*.md]
产物
gitlabWebBatchImportReq/*.xml
3_gitlabWebBatchImport
仅开发时执行, 产物已在本仓库,用户无需执行
gitlab网页批量导入LineageOS-16.0–oneplus3t仓库群**
执行内容
浏览器人工打开此网页批量导入仓库: gitlab网页批量导入
输入
即上一步产物: gitlabWebBatchImportReq/*.xml
产物
https://gitlab.com/lineage16_mirror
4_lineage16_clone
4.1
准备
仓库群描述 转换为 仓库群克隆文件
仅开发时执行, 产物已在本仓库,用户无需执行
产物 projGit_ls/gen/gitCloneCmd.sh
已在本仓库 。
bash /app4/git-repo/projGit_ls/json__to__cloneCmd/main.sh
4.2
执行内容
克隆LineageOS-16.0–oneplus3t仓库群
#克隆LineageOS-16.0--oneplus3t仓库群 , gitCloneCmd.sh 中 已写明 --depth=1 (只要以指定分支为起点的1个提交,以减小仓库尺寸)
root_dir=/app4/lineage16_oneplus3t_newdir bash /app4/git-repo/projGit_ls/gen/gitCloneCmd.sh
projGit_ls/json__to__cloneCmd/main.sh
输入
即 步骤2_gitlabWebBatchImportReqXmlFile_gen
的产物: gitlabWebBatchImportReq/*.xml
产物
5_projCopyAndSoftLinkLs
本地目录下仓库群 中 的 软链接命令、复制文件命令 执行
root_dir=/app4/lineage16_oneplus3t_new bash -x /app4/git-repo/projGit_ls/gen/projCopyAndSoftLinkLs_ls.*.sh
#比如 projCopyAndSoftLinkLs_ls.1730372866.43542.sh
projGit_ls/gen//projCopyAndSoftLinkLs_ls.*.sh
LineageOS16_oneplus3t仓库群 编译
6_build
已在前几步完成 保留注释作为警醒
本文中注释掉的部分 都已在前几步完成了,保留注释只是为了保持警醒
主要由以下几处 完成了注释中的内容
- https://gitlab.com/lineage16_oneplus3t/manifest/lineageos-android/-/blob/lineage-16.0/default.xml
- https://gitlab.com/lineage16_oneplus3t/resource
### '已在前几步完成 保留注释作为警醒' 开始
#curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o /app/bin/repo
#export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
#repo init --manifest-url https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android.git --manifest-branch $GitBranch # GitBranch=lineage-16.0
#解决报错, resource layout/preference_category_material_settings (aka org.lineageos.settings.device:layout/preference_category_material_settings) not found
#git clone -b lineage-16.0 https://githubfast.com/LineageOS/android_packages_resources_devicesettings.git $D/packages/resources/devicesettings
#git clone https://github.com/TheMuppets/proprietary_vendor_oneplus.git/oneplus3 -b lineage-16.0 $D/vendor/oneplus/oneplus3
#$D/repo/manifests/default.xml
#<remote name="aosp" fetch="https://android.googlesource.com" fetch替换为 "https://mirrors.tuna.tsinghua.edu.cn/git/AOSP"
#repo sync --current-branch --no-tags --prune
#oneplus3t linux内核、第三方厂商vendor
#git clone -b $GitBranch https://github.com/LineageOS/android_device_oneplus_oneplus3.git $D/device/oneplus/oneplus3
#git clone -b $GitBranch https://github.com/LineageOS/android_device_oppo_common.git $D/device/oppo/common
#git clone -b $GitBranch https://github.com/LineageOS/android_kernel_oneplus_msm8996.git $D/kernel/oneplus/msm8996
#git clone -b $GitBranch https://github.com/LineageOS/android_packages_resources_devicesettings.git $D/packages/resources
#解决编译错误, /usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x50): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
### '已在前几步完成 保留注释作为警醒' 结束
编译步骤正文
#编译步骤正文开始
export PATH_BASE=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/bin/
export PATH=$PATH_BASE
D=/app4/lineage16_oneplus3t_new
cd $D
#GitBranch=lineage-16.0
source build/envsetup.sh
#export V=1
export LC_ALL=C
export ALLOW_MISSING_DEPENDENCIES=true
lunch lineage_oneplus3-userdebug && mka showcommands bacon # lineage_oneplus3-eng
#编译步骤正文结束
参考: gitee/android_framework/oneplus3/lineage-build-simple-manual.md
某次编译产物举例
-
编译完成消耗时长为 53分钟(电脑配置: intel-12代i7+16GB内存),
-
获得的OTA全量卡刷包
lineage-16.0-20241101-UNOFFICIAL-oneplus3.zip
尺寸为630MB
-
/app4
占据空间128GB
,out
目录大小为77GB, 源码目录大小为50GB
cat /proc/cpuinfo | grep 'model name' | uniq
#model name : 12th Gen Intel(R) Core(TM) i7-12650H
sudo dmidecode -t memory #16GB内存
#Package Complete: /app4/lineage16_oneplus3t/out/target/product/oneplus3/lineage-16.0-20241101-UNOFFICIAL-oneplus3.zip
# build completed successfully (53:32 (mm:ss)) ####
ls -lh /app4/lineage16_oneplus3t/out/target/product/oneplus3/lineage-16.0-20241101-UNOFFICIAL-oneplus3.zip
#-rwxrwxrwx 630M 2024年11月1日 22点18分 /app4/lineage16_oneplus3t/out/target/product/oneplus3/lineage-16.0-20241101-UNOFFICIAL-oneplus3.zip
df -h /app4
#Filesystem Size Used Avail Use% Mounted on
#/dev/nvme0n1p1 239G 128G 111G 54% /app4
###编译产物中的调试符号 比如 libandroid_runtime.so.debug
find out/ -type f -path "*/oneplus3*/*/libandroid_runtime.so*"
#out/target/product/oneplus3/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/libandroid_runtime.so.debug
#out/target/product/oneplus3/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/libandroid_runtime.so
#pwd==/app4/lineage16_oneplus3t/
#out目录大小为77GB
du --threshold=1G --max-depth=1 --human-readable out/
#4.9G out/host
#30G out/soong
#42G out/target
#77G out/
#源码目录大小为50GB
du --exclude=out --threshold=1G --max-depth=1 --human-readable .
#1.4G ./cts
#8.3G ./external
#2.5G ./frameworks
#31G ./prebuilts
#2.3G ./tools
#50G .
LineageOS16_oneplus3t仓库群 刷机
7_OTA_package_flush
刷机(OTA全量卡刷包)
前提: 已获得root 、 已解锁OEM
adb reboot bootloader
fastboot boot /app4/twrp-3.5.2_9-0-oneplus3.img
#twrp界面 进入 sideload等待: Advance -> 'adb sideload' -> 清除 'davld cache' 、 `user cache' (双请) -> 底部进度条拉到右端
adb sideload /app4/lineage16_oneplus3t/out/target/product/oneplus3/lineage-16.0-20241101-UNOFFICIAL-oneplus3.zip
缺少依赖的报错解决记录
libncurses.so.5: cannot open shared object file
报错现象
m V=1 -j 1 bacon # 或mka showcommands bacon
报错如下
prebuilts/clang/host/linux-x86/clang-3289846/bin/clang.real: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
报错解决
apt-file search libncurses.so.5
#libncurses5: /lib/x86_64-linux-gnu/libncurses.so.5
sudo apt install libncurses5
m4: command not found
sudo apt install -y build-essential m4
libtinfo.so.5: cannot open shared object file
报错现象
m V=1 -j 1 bacon # 或mka showcommands bacon
报错如下
prebuilts/clang/host/linux-x86/clang-4691093/bin/clang++.real: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory
报错解决
apt-file search libtinfo.so.5
#libtinfo5: /lib/x86_64-linux-gnu/libtinfo.so.5
sudo apt install -y libtinfo5
The boot animation could not be generated, as ImageMagick is not installed in your system.
报错现象
m V=1 -j 1 bacon # 或mka showcommands bacon
报错如下
The boot animation could not be generated
as ImageMagick is not installed in your system.
报错解决
apt-file search ImageMagick
sudo apt install -y imagemagick
其他报错解决记录
aarch64-linux-android-gcc: No such file or directory
报错现象
m V=1 -j 1 bacon # 或mka showcommands bacon
报错如下
/OP3TLos16Build/kernel/oneplus/msm8996/Makefile:671: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
make[1]: aarch64-linux-android-gcc: No such file or directory
报错分析
aarch64-linux-android-gcc是个python2.7脚本,且指定了需要解释器路径为#!/usr/bin/python
head -n 1 /OP3TLos16Build/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc
##!/usr/bin/python
/OP3TLos16Build/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc
#-bash: /OP3TLos16Build/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc: /usr/bin/python: bad interpreter: No such file or directory
报错解决
sudo apt install -y python2.7
sudo ln -s /usr/bin/python2.7 /usr/bin/python
which python #/usr/bin/python
cp: preserving permissions for
报错现象
m V=1 -j 1 bacon # 或mka showcommands bacon
报错如下
/bin/bash -c "(rm -f /app4/lineage16_oneplus3t/out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates//classes*.dex ) && (cp -fp /app4/lineage16_oneplus3t/out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/dex-hiddenapi//classes*.dex /app4/lineage16_oneplus3t/out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/ )"
cp: preserving permissions for '/app4/lineage16_oneplus3t/out/target/common/obj/JAVA_LIBRARIES/apache-xml_intermediates/classes.dex': Operation not permitted
报错解决
/app4
所在分区挂载选项中增加 uid=1000,gid=1000,
,其中的数值是举例(表示ubuntu22当前登陆的用户的)