lineage-19.1/oneplus6-build.md
修复内核崩溃
经过此两修改后, 编译出的OTA包 刷入手机,
手机重启正常越过logo 进入android, 但卡在LineageOS-19的弧形进度界面,
没有此两修改时, 根本进不到android, 只到开机logo就黑屏 亮呼吸灯 , 串口处于900E(高通ramdump模式),
因此此两修改有用,但问题还没完毕
1. 根据lineageOS-19.1官方OTA包和我ota包的vendor内容对比,补充缺少的文件
修改记录:TheMuppets-v/proprietary_vendor_oneplus.git/718403
参考 ota-compare-my-to-official/file_ls_not_in_my_otaZip.txt
对 TheMuppets/proprietary_vendor_oneplus.git : vendor/oneplus/sdm845-common/sdm845-common-vendor.mk 的 PRODUCT_COPY_FILES
新增以下行:
makefile
PRODUCT_COPY_FILES += \
#...
#新增以下行:
vendor/oneplus/sdm845-common//proprietary/product/priv-app/HotwordEnrollmentOKGoogleWCD9340_SDM845/HotwordEnrollmentOKGoogleWCD9340_SDM845.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/product/priv-app/HotwordEnrollmentOKGoogleWCD9340_SDM845/HotwordEnrollmentOKGoogleWCD9340_SDM845.apk \
vendor/oneplus/sdm845-common//proprietary/product/priv-app/HotwordEnrollmentXGoogleWCD9340_SDM845/HotwordEnrollmentXGoogleWCD9340_SDM845.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/product/priv-app/HotwordEnrollmentXGoogleWCD9340_SDM845/HotwordEnrollmentXGoogleWCD9340_SDM845.apk \
vendor/oneplus/sdm845-common//proprietary/system/frameworkc/qcnvitems.jar:$(TARGET_COPY_OUT_VENDOR)/proprietary/system/frameworkc/qcnvitems.jar \
vendor/oneplus/sdm845-common//proprietary/system/framework/tcmclient.jar:$(TARGET_COPY_OUT_VENDOR)/proprietary/system/framework/tcmclient.jar \
vendor/oneplus/sdm845-common//proprietary/system/framework/WfdCommon.jar:$(TARGET_COPY_OUT_VENDOR)/proprietary/system/framework/WfdCommon.jar \
vendor/oneplus/sdm845-common//proprietary/system_ext/app/NxpNfcNci/NxpNfcNci.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/app/NxpNfcNci/NxpNfcNci.apk \
vendor/oneplus/sdm845-common//proprietary/system_ext/app/QtiTelephonyService/QtiTelephonyService.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/app/QtiTelephonyService/QtiTelephonyService.apk \
vendor/oneplus/sdm845-common//proprietary/system_ext/app/SoterService/SoterService.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/app/SoterService/SoterService.apk \
vendor/oneplus/sdm845-common//proprietary/system_ext/framework/com.android.hotwordenrollment.common.util.jar:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/framework/com.android.hotwordenrollment.common.util.jar \
vendor/oneplus/sdm845-common//proprietary/system_ext/framework/com.nxp.nfc.jar:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/framework/com.nxp.nfc.jar \
vendor/oneplus/sdm845-common//proprietary/system_ext/framework/com.qti.dpmframework.jar:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/framework/com.qti.dpmframework.jar \
vendor/oneplus/sdm845-common//proprietary/system_ext/framework/dpmapi.jar:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/framework/dpmapi.jar \
vendor/oneplus/sdm845-common//proprietary/system_ext/framework/qcrilhook.jar:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/framework/qcrilhook.jar \
vendor/oneplus/sdm845-common//proprietary/system_ext/framework/vendor.qti.hardware.alarm-V1.0-java.jar:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/framework/vendor.qti.hardware.alarm-V1.0-java.jar \
vendor/oneplus/sdm845-common//proprietary/system_ext/priv-app/IFAAService/IFAAService.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/priv-app/IFAAService/IFAAService.apk \
vendor/oneplus/sdm845-common//proprietary/system_ext/priv-app/ims/ims.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/priv-app/ims/ims.apk \
vendor/oneplus/sdm845-common//proprietary/system_ext/priv-app/qcrilmsgtunnel/qcrilmsgtunnel.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/priv-app/qcrilmsgtunnel/qcrilmsgtunnel.apk \
vendor/oneplus/sdm845-common//proprietary/system_ext/priv-app/WfdService/WfdService.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/system_ext/priv-app/WfdService/WfdService.apk \
vendor/oneplus/sdm845-common//proprietary/vendor/app/CneApp/CneApp.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/app/CneApp/CneApp.apk \
vendor/oneplus/sdm845-common//proprietary/vendor/app/IWlanService/IWlanService.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/app/IWlanService/IWlanService.apk \
vendor/oneplus/sdm845-common//proprietary/vendor/app/TimeService/TimeService.apk:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/app/TimeService/TimeService.apk \
vendor/oneplus/sdm845-common//proprietary/vendor/etc/vintf/manifest/android.hardware.gnss@2.1-service-qti.xml:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/etc/vintf/manifest/android.hardware.gnss@2.1-service-qti.xml \
vendor/oneplus/sdm845-common//proprietary/vendor/etc/vintf/manifest/android.hardware.neuralnetworks@1.3-service-qti.xml:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/etc/vintf/manifest/android.hardware.neuralnetworks@1.3-service-qti.xml \
vendor/oneplus/sdm845-common//proprietary/vendor/etc/vintf/manifest/manifest_android.hardware.drm@1.3-service.widevine.xml:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/etc/vintf/manifest/manifest_android.hardware.drm@1.3-service.widevine.xml \
vendor/oneplus/sdm845-common//proprietary/vendor/etc/vintf/manifest/vendor.qti.gnss@4.0-service.xml:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/etc/vintf/manifest/vendor.qti.gnss@4.0-service.xml \
vendor/oneplus/sdm845-common//proprietary/vendor/lib/libfastcvopt.so:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/lib/libfastcvopt.so \
vendor/oneplus/sdm845-common//proprietary/vendor/lib/libthermalclient.so:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/lib/libthermalclient.so \
vendor/oneplus/sdm845-common//proprietary/vendor/lib64/libfastcvopt.so:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/lib64/libfastcvopt.so \
vendor/oneplus/sdm845-common//proprietary/vendor/lib64/libthermalclient.so:$(TARGET_COPY_OUT_VENDOR)/proprietary/vendor/lib64/libthermalclient.so
2. 解决编译错误Prebuilt apk found in PRODUCT_COPY_FILES BUILD_PREBUILT instead
修改记录:LineageOS-v/android_build.git/83a47c
mka showcommands bacon
时报错 Prebuilt apk found in PRODUCT_COPY_FILES BUILD_PREBUILT instead
解决
LineageOS/android_build.git : build/make/core/Makefile
函数check-product-copy-files
中 : $(error
改为 $(waring
makefile
define check-product-copy-files
$(if $(filter-out $(TARGET_COPY_OUT_SYSTEM_OTHER)/%,$(2)), \
- $(if $(filter %.apk, $(2)),$(error \
+ $(if $(filter %.apk, $(2)),$(waring \
Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!))) \
参考1: https://blog.csdn.net/qq_44844314/article/details/130132581
参考2: https://blog.csdn.net/kc58236582/article/details/53364239
(不奏效,待排查)记录android崩溃日志,增加logcat命令脚本作为服务
修改点
- LineageOS/android_system_core.git : /app4/lineage19_oneplus6/system/core
txt
/app4/lineage19_oneplus6/system/core/libcutils/fs_config.cpp
/app4/lineage19_oneplus6/system/core/rootdir/init.rc
- TheMuppets/proprietary_vendor_oneplus.git /sdm845-common: /app4/lineage19_oneplus6/vendor/oneplus/sdm845-common
txt
/app4/lineage19_oneplus6/vendor/oneplus/sdm845-common/sdm845-common-vendor.mk
/app4/lineage19_oneplus6/vendor/oneplus/sdm845-common/myLogScript.sh
参考1: 新增android日志服务: https://blog.csdn.net/xuanyulevel6/article/details/140018074
android12启动卡死在android门口(Lineage弧形图标) 修改x.cr排查死在哪
现状: oneplus6手机刷入我编译的LineageOS19.1(android12) ,内核正常启动, 卡死在android门口(Lineage弧形图标)
排查方案: 修改x.rc排查死在哪
步骤1.利用twrp的adb shell
修改x.rc
grep yyy /system_root/system/etc/init/hw/init.rc
write /system/yyy02-on-init 1
write /system/yyy04-on-early-fs 1
write /mnt/user/0/yyy03-on-post-fs 1
write /system/yyy05-on-post-fs 1
write /system/bin/yyy06-on-late-fs 1
write /system/bin/yyy07-on-post-fs-data 1
write /data/yyy08-on-post-fs-data 1
write /data/system/yyy09-on-post-fs-data 1
write /data/yyy10-on-post-fs-data 1
mkdir /data/apex/yyy11-mkdir-on-post-fs-data
mkdir /data/yyy12-mkdir-on-post-fs-data
mkdir /data/yyy13-on-post-fs-data
write /data/yyy16-on-boot 1
write /system/yyy17-on-boot 1
write /system/yyy15-on-charger 1
步骤2. 正常启动手机 引发LineageOS19.1卡死在弧形图标
步骤3. 进twrp观看x.rc修改点执行效果
fastboot boot twrp-3.7.0_11-0-enchilada.img | twrp-3.5.2_9-0-enchilada.img
(twrp启动后可能要等一会儿才能连的上adb shell
)
twrp界面操作: Mount --> data 、 system
adb shell
:
mount | grep system
/dev/block/sda13 on /system_root type ext4 (ro,seclabel,relatime)
/dev/block/sda13 on /system type ext4 (ro,seclabel,relatime)
(被执行到的修改点)find / -name yyy* 2>/dev/null
/data/yyy13-on-post-fs-data
/data/yyy16-on-boot
/data/yyy12-mkdir-on-post-fs-data
/data/yyy10-on-post-fs-data
/data/apex/yyy11-mkdir-on-post-fs-data
/data/yyy08-on-post-fs-data
对比 x.rc ,发现有不少修改点没有被执行到
oneplus6-build
bash
#解决 repo sync 时 可能的报错
sudo apt install -y git-lfs
#git-lfs filter-process --skip: 1: git-lfs: not found
#fatal: 远端意外挂断了
#error.GitError: Cannot checkout LineageOS/android_external_chromium-webview_prebuilt_arm: Cannot initialize work tree for LineageOS/android_external_chromium-webview_prebuilt_arm
#error: Cannot checkout LineageOS/android_external_chromium-webview_prebuilt_arm
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o /app/bin/repo
chmod a+x /app/bin/repo
export PATH_BASE=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/bin/
export PATH=$PATH_BASE
D=/app4/lineage19_oneplus6
mkdir -p $D && cd $D
GitBranch=lineage-19.1
DevName=enchilada #oneplus6==enchilada
Github=githubfast
#oneplus6 第三方厂商驱动(vendor) 、 linux4.9内核
#https://github.com/TheMuppets/proprietary_vendor_oneplus.git /enchilada : vendor/oneplus/enchilada
#https://github.com/LineageOS/android_device_oneplus_enchilada.git : device/oneplus/enchilada
#https://github.com/LineageOS/android_device_oneplus_sdm845-common.git : device/oneplus/sdm845-common
#https://github.com/LineageOS/android_kernel_oneplus_sdm845.git : kernel/oneplus/sdm845
#https://github.com/LineageOS/android_hardware_oneplus.git : hardware/oneplus
#命名样式? github.com/LineageOS/android_x_y_z.git : x/y/z
grep devicesettings android/snippets/lineage.xml # snippets/lineage.xml 中 已经定义 android_packages_resources_devicesettings ,不再需要 单独clone
# <project path="packages/resources/devicesettings" name="LineageOS/android_packages_resources_devicesettings" />
proprietary_vendor_oneplus=$D/TheMuppets----proprietary_vendor_oneplus
git clone --depth=30 https://$Github.com/TheMuppets/proprietary_vendor_oneplus.git --branch $GitBranch $proprietary_vendor_oneplus
#大仓库,只克隆 该分支lineage-19.1 为起点的 1个提交
mkdir -p $D/vendor/oneplus
ln -s $proprietary_vendor_oneplus/$DevName $D/vendor/oneplus/$DevName
ln -s $proprietary_vendor_oneplus/sdm845-common $D/vendor/oneplus/sdm845-common
git clone --branch $GitBranch https://$Github.com/LineageOS/android_device_oneplus_enchilada.git $D/device/oneplus/$DevName
git clone --branch $GitBranch https://$Github.com/LineageOS/android_device_oneplus_sdm845-common.git $D/device/oneplus/sdm845-common
#$D/device/oneplus/?sdm845-common?common?
git clone --branch $GitBranch https://$Github.com/LineageOS/android_kernel_oneplus_sdm845.git $D/kernel/oneplus/sdm845
#https://github.com/LineageOS/android_hardware_oneplus.git 最低版本为 lineage-18.1
git clone --branch $GitBranch https://github.com/LineageOS/android_hardware_oneplus.git $D/hardware/oneplus
#手工将以上5个仓库 x/.git/config 中 '[remote "origin"]'/url 中的 githubfast 改回 github
#参照 "报错解决记录/0.找不到`webview.apk`" 解决该报错
#初始化仓库群.
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
grep tsing $D/.repo/repo/.git/config #REPO_URL变量只对repo命令起作用
# url = https://mirrors.tuna.tsinghua.edu.cn/git/git-repo
#$D/repo/manifests/default.xml
#<remote name="aosp" fetch="https://android.googlesource.com" fetch替换为 "https://mirrors.tuna.tsinghua.edu.cn/git/AOSP"
_xmlP="$D/.repo/manifests/default.xml"
_xmlS1='fetch="https://android.googlesource.com"'
_xmlS2='fetch="https://mirrors.tuna.tsinghua.edu.cn/git/AOSP"'
grep -Hn "$_xmlS1" $_xmlP
( p="$_xmlP" \
s1="$_xmlS1" \
s2="$_xmlS2" \
python3 -c 'import os,pathlib; d=os.environ; p=d["p"]; s1=d["s1"]; s2=d["s2"]; f=pathlib.Path(p); f.write_text(f.read_text().replace(s1,s2))' ;)
grep -Hn "$_xmlS2" $_xmlP
#/app4/lineage19_oneplus6/.repo/manifests/default.xml:12: fetch="https://mirrors.tuna.tsinghua.edu.cn/git/AOSP"
repo sync --current-branch --no-tags --prune
#编译步骤正文开始
source build/envsetup.sh
#export V=1
export LC_ALL=C
export ALLOW_MISSING_DEPENDENCIES=true
lunch lineage_$DevName-userdebug && mka showcommands bacon # lineage_enchilada-userdebug | lineage_enchilada-eng
#编译步骤正文结束
备注1 : mka bacon
的排错形式是 m V=1 -j 1 bacon
oneplus6-OTA-flash
oneplus6-OTA线刷包 刷机
bash
ls -lh $D/out/target/product/enchilada/lineage-19.1-20241105-UNOFFICIAL-enchilada.zip
#-rwxrwxrwx 767M /app4/lineage19_oneplus6/out/target/product/enchilada/lineage-19.1-20241105-UNOFFICIAL-enchilada.zip
adb reboot bootloader
fastboot boot twrp-3.5.2_9-0-enchilada.img
adb sideload /app4/lineage19_oneplus6/out/target/product/enchilada/lineage-19.1-20241105-UNOFFICIAL-enchilada.zip
重启, 走过logo、没进android、呼吸灯常亮并崩溃
且 强制关机再开机 并进按音量加(音量减?) 进入fastboot 执行 fastboot boot twrp-3.5.2_9-0-enchilada.img
也一样 走过logo、没进android、呼吸灯常亮并崩溃
报错解决记录
0.找不到webview.apk
报错
bash
m V=1 -j 1 bacon
#报错如下:
#... cp external/chromium-webview/prebuilt/arm64/webview.apk out/target/product/enchilada/obj/APPS/webview_intermediates/package.apk ...
# FAILED: out/target/product/enchilada/obj/APPS/webview_intermediates/package.apk
# zip2zip.go:82: zip: not a valid zip file
解决
bash
#理论上应该 git clone --branch android12L https://android.googlesource.com/platform/external/chromium-webview , 但是由于该仓库巨大34GB且科学上网太慢, 所以只clone以下小仓库 且 不管分支
git clone https://github.com/LineageOS/android_external_chromium-webview.git /tmp/
# https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android_external_chromium-webview
#/tmp/android_external_chromium-webview/.git/config
webview_arm64_F=/tmp/android_external_chromium-webview/prebuilt/arm64/webview.apk # ls -lh $webview_arm64_F #91MB
md5sum $webview_arm64_F
# 717afb18c5a27c4d610f3edfb767689f prebuilt/arm64/webview.apk
cp $webview_arm64_F $D/external/chromium-webview/prebuilt/arm64/webview.apk
1. LineageOS-19.1(android12)
中 不要手工cloneandroid_packages_resources_devicesettings.git
, 否则导致报错 'git: unsupported checkout state'
在LineageOS-19.1(android12)
中 估计已经在 manifest.xml(即android/default.xml
) 中描述了 android_packages_resources_devicesettings.git
, 因此 若手工clone该仓库,反而会报错
报错
bash
git clone --branch $GitBranch https://$Github.com/LineageOS/android_packages_resources_devicesettings.git $D/packages/resources/devicesettings
repo sync --current-branch --no-tags --prune
#error.GitError: Cannot checkout LineageOS/android_packages_resources_devicesettings: /app4/lineage19_oneplus6/packages/resources/devicesettings/.#git: unsupported checkout state
#error: Cannot checkout LineageOS/android_packages_resources_devicesettings
解决
bash
rm -fr $D/packages/resources/devicesettings
cd $D
repo sync LineageOS/android_packages_resources_devicesettings --force-sync
2. android_device_oneplus_enchilada : device/oneplus/enchilada/.git: unsupported checkout state
报错
bash
lunch lineage_$DevName-userdebug
# error.GitError: Cannot checkout LineageOS/android_device_oneplus_enchilada: /app4/lineage19_oneplus6/device/oneplus/enchilada/.git: unsupported checkout state
# error: Cannot checkout LineageOS/android_device_oneplus_enchilada
# error: Unable to fully sync the tree
# error: Checking out local projects failed.
# Failing repos:
# device/oneplus/enchilada
解决
bash
repo sync --current-branch LineageOS/android_device_oneplus_enchilada --force-sync
3. 'repo init --depth=x' 导致 'mka bacon' 报错'android_common does not provide a dex boot jar'
报错
bash
repo init --depth=x # '--depth=x' 会导致 'mka bacon' 报错如下
# error: frameworks/base/boot/Android.bp:44:1: module "platform-bootclasspath" variant "android_common" does not provide a dex boot jar
解决
去掉repo init --depth=x
中的--depth=x
4. 'mka bacon' 报错 'namespace hardware/oneplus does not exist'
报错
bash
m V=1 -j 1 bacon
# error: device/oneplus/sdm845-common/Android.bp:1:1: module "soong_namespace": namespace hardware/oneplus does not exist
解决
猜测 hardware/oneplus
应该是 对应 组织github.com/LineageOS
下仓库形如*hardware_oneplus*
,
搜索github.com/LineageOS/hardware_oneplus 得到 LineageOS/android_hardware_oneplus.git
从而解决办法为
bash
git clone --branch lineage-19.1 https://github.com/LineageOS/android_hardware_oneplus.git $D/hardware/oneplus
5. module "platform-bootclasspath" variant "android_common": module WfdCommon does not provide a dex boot jar
WfdCommon
==Wi-Fi Display Common
报错
bash
m -j 1 bacon #报错
#module "platform-bootclasspath" variant "android_common": module WfdCommon does not provide a dex boot jar
排查过程
bash
find $D -type f -size -1024k -not -path "*/.repo/*" | xargs -I@ bash -c " grep -Hn 'does not provide a dex boot jar' '@' && echo '@' "
#/app4/lineage19_oneplus6/build/soong/java/dexpreopt_bootjars.go:492: ctx.ModuleErrorf("module %s does not provide a dex boot jar", name)
google搜索WfdCommon
得到 4、出现错误:"internal error: failed to find dex jar path for module "WfdCommon"
仿照其修改如下
bash
grep -Hn -A 1 -B 1 WfdCommon $D/device/oneplus/sdm845-common/*.mk
#/app4/lineage19_oneplus6/device/oneplus/sdm845-common/common.mk:463: PRODUCT_BOOT_JARS += \
# :464: WfdCommon
解决
删除 /app4/lineage19_oneplus6/device/oneplus/sdm845-common/common.mk
中的 PRODUCT_BOOT_JARS += WfdCommon
6. multiple definition of `yylloc'
报错
bash
m V=1 -j 1 bacon #'mka bacon' 的排错形式
# /usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
解决
bash
echo 'HOSTCFLAGS += -fcommon' >> $D/kernel/oneplus/sdm845/Makefile