Ubuntu20.0编译LineageOs14刷入小米8Lite(青春版)流程与踩坑记录

本文记录了作者在Ubuntu环境下编译LineageOS时遇到的错误及解决过程,包括adb和fastboot的安装、repo的初始化、清华源的配置等问题。遇到的主要错误包括python软链接错误、repo下载失败和网络超时,通过调整python软链接、指定repo-url以及修改manifest.xml文件中的源地址,最终成功进行仓库同步。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文全是个人经历与踩坑记录,不同机型配置可能不一样

全文踩坑内容错误加粗
编写时间:2022.5.24-14:53
机型配置:

虚拟机
4核心 每核心2线程
手机
小米8Lite
设备代号:platina(铂金)

参考大佬文章

https://blog.youkuaiyun.com/weixin_46160898/article/details/122966746
https://mirrors.tuna.tsinghua.edu.cn/help/lineageOS/
https://wiki.lineageos.org/devices/platina/build
https://blog.youkuaiyun.com/xiaokeweng/article/details/46743409

引用一句话:

我们都是站在巨人的肩膀上,致敬所有开源人和分享者的精神

1-开始

首先需要安装adb和fastboot
官网下载
https://dl.google.com/android/repository/platform-tools-latest-linux.zip
然后解压

unzip platform-tools-latest-linux.zip -d ~

配置环境变量,打开~./profile

vim ~/.profile

然后添加如下代码段

if [ -d "$HOME/platform-tools" ] ; then
    PATH="$HOME/platform-tools:$PATH"

配置好后刷新环境变量

source ~/.profile

2-拉去代码(使用清华源)

下载 repo 工具:

mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

切换目录

mkdir ~/android/lineageos
cd ~/android/lineageos

:goto1 初始化仓库 错误案例:

repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android.git -b cm-14.1

报错了

/usr/bin/env: “python”: 没有那个文件或目录

这是由于系统本机没有python环境或者没有名为“python"环境
可能你的python配置的是名为python3的软连接,
人话:
就是你输入python没有环境,输入python3或者2却有环境。
解决
没环境安装环境,我这里的问题是python软连接指向的不对

#我在这里先解除了原python的软连接
unlink python
#配置新的软连接
ln -s /usr/bin/python3.8(你的python目录) python

再次执行**:goto1**标记处init
又报错。。。

Downloading Repo source from https://gerrit.googlesource.com/git-repo
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
fatal: error [Errno 110] Connection timed out
fatal: double check your --repo-rev setting.
fatal: cloning the git-repo repository failed, will remove '.repo/repo' 

根据了解这回错误的原因是因为repo在初始化仓库的时候会先拉去repo自身的代码(据说下载的repo是不完整的 类似像下载器那样)拉取自身代码的时候由于网络问题很容易失败
:goto1 初始化仓库 错误案例的解决方案:
在init后面加上
–repo-url=https://gerrit-googlesource.proxy.ustclug.org/git-repo
使用清华源的repo,正确完整指令如下

repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android.git -b cm-14.1 --repo-url=https://gerrit-googlesource.proxy.ustclug.org/git-repo

3-配置清华源

打开.repo/manifest.xml,

 <remote  name="github"
           fetch=".."
           review="review.lineageos.org" />

改成

  <remote  name="github"
           fetch="https://github.com/" />

  <remote  name="lineage"
           fetch="https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/"
           review="review.lineageos.org" />

<remote  name="aosp"
           fetch="https://android.googlesource.com"

改成

  <remote  name="aosp"
           fetch="https://mirrors.tuna.tsinghua.edu.cn/git/AOSP"

  <default revision="..."
           remote="github"

改成

  <default revision="..."
           remote="lineage"

按指示来到这里我又遇到一个小问题

<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT EDIT THIS FILE!  It is generated by repo and changes will be discarded.
If you want to use a different manifest, use `repo init -m <file>` instead.

If you want to customize your checkout by overriding manifest settings, use
the local_manifests/ directory instead.

For more information on repo manifests, check out:
https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md
-->
<manifest>
  <include name="default.xml" />
</manifest>

我的相对于目录下根本没有所谓的defult、remote这些节点
翻译上文注释
<-- 不要编辑此文件!它由回购生成,更改将被丢弃。 如果要使用不同的清单,请改用“repo init-m<file>”。 如果要通过覆盖清单设置自定义签出,请使用 改为本地\u清单/目录。 有关回购清单的更多信息,请查看: https://gerrit.googlesource.com/git-repo/+/标题/文档/清单格式。md公司 -->
根据一番寻找最终在.repo/mainfests/default目录下找到相关文件
这里并不确定是否是这个文件 大概有70%的把握是的
配置好之后

<remote  name="github"
	     fetch="https://github.com/" />
<remote  name="lineage"
  fetch="https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/"
		 review="review.lineageos.org" />
<remote  name="private"
        fetch="ssh://git@github.com" />
<remote  name="aosp"
fetch="https://mirrors.tuna.tsinghua.edu.cn/git/AOSP"
          review="android-review.googlesource.com"
          revision="refs/tags/android-7.1.2_r36" />
<default revision="refs/heads/cm-14.1"
           remote="lineage"
           sync-c="true"
           sync-j="4" />
-->

回到~/android/lieageos目录下
运行

repo sync

漫长等待中 之后再更新我也在等

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值