oneplus6-build.md

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
相关推荐
ziix22 天前
copyq禁止访问网络(ubuntu cgroup)
xxx