自己编译Lineage OS for LG G7

博主咕咕咕了,暂不更新

0x00 准备依赖&拉取源码

先换掉并添加需要的软件源
sudo sed -i 's|security.debian.org/debian-security|mirrors.ustc.edu.cn/debian-security|g'/etc/apt/sources.list
sudo sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
sudo echo "deb http://mirrors.ustc.edu.cn/debian/ stretch main" >> /etc/apt/sources.list
sudo echo "deb-src http://mirrors.ustc.edu.cn/debian/ stretch main" >> /etc/apt/sources.list
sudo apt-get update

sudo apt-get install aptitude -y
sudo aptitude install bc bison build-essential ccache curl flex g++-multilib gcc-multilib gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev
sudo aptitude install -y openjdk-8-jdk
编译使用OpenSSL的git,改善pull的问题
sudo apt-get install fakeroot dpkg-dev
sudo apt-get build-dep git
sudo apt-get install libcurl4-openssl-dev
mkdir ~/git-openssl
cd ~/git-openssl
apt-get source git #git源码
cd git-2.17.1/ #根据你的git源码版本切换
sed -i 's/libcurl4-gnutls-dev/libcurl4-openssl-dev/g' debian/control #将debian/control文件中libcurl4-gnutls-dev全部替换为libcurl4-openssl-dev
sed -i 's/TEST =test//g' debian/rules #删除debian/rules文件中TEST =test
sudo dpkg-buildpackage -rfakeroot -b #生成安装包
cd ..
sudo dpkg -i git_2.17.1-1ubuntu0.3_amd64.deb #安装对应版本的git

mkdir lineage&&cd lineage
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip
unzip platform-tools-latest-linux.zip -d ~&&rm platform-tools-latest-linux.zip
vi ~/.profile
加入:

# add Android SDK platform tools to path
if [ -d "$HOME/lineage/platform-tools" ] ; then
    PATH="$HOME/lineage/platform-tools:$PATH"
fi

source ~/.profile

mkdir -p ./bin
mkdir -p ./android/lineage

curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ./bin/repo
chmod +x ./bin/repo
vi ~/.profile
加入:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/lineage/bin" ] ; then
    PATH="$HOME/lineage/bin:$PATH"
fi

source ~/.profile

cd ~/android/lineage
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
repo init -u https://github.com/LineageOS/android.git -b lineage-17.1
设置git用户名和邮箱
git config --global user.name ryank231231
git config --global user.email ryank231231@gmail.com
优化网络链接
git config --global http.postBuffer 100000000
git config --global ssh.postBuffer 100000000
sudo echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
sudo echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sudo sysctl -p

nano ./.repo/manifests/default.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://aosp.tuna.tsinghua.edu.cn"

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

改成

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

repo sync

P.S: find -name tmp_pack_* -delete 清理repo产生的垃圾文件

0x02 配置源码

0x03 编译源码

参考

https://www.dreamoftime0.com/2018/10/21/%E4%BD%BF%E7%94%A8git-clone%E6%88%96push%E5%87%BA%E7%8E%B0ssl%E9%94%99%E8%AF%AF%E7%9A%84%E8%A7%A3%E5%86%B3/

最后修改:2020 年 07 月 19 日 11 : 00 AM

发表评论