闲来无事 打算亲自给手上的SM-J3109编译一次lineageos Google如何编译并参考了一下博客之后(参考链接会放在最后) 折腾了三天终于是编译成功了 首先 需要一台装了Ubuntu系统的电脑(虚拟机也可以 但是还是建议电脑) 根据Ubuntu版本安装所需要的包
For Ubuntu 23.10 (mantic), install libncurses5 from 23.04 (lunar) as follows: wget http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.4-2_amd64.deb && sudo dpkg -i libtinfo5_6.4-2_amd64.deb && rm -f libtinfo5_6.4-2_amd64.deb wget http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses/libncurses5_6.4-2_amd64.deb && sudo dpkg -i libncurses5_6.4-2_amd64.deb && rm -f libncurses5_6.4-2_amd64.deb While for Ubuntu versions older than 23.10 (mantic), simply install: lib32ncurses5-dev libncurses5 libncurses5-dev Additionally, for Ubuntu versions older than 20.04 (focal), install also: libwxgtk3.0-dev While for Ubuntu versions older than 16.04 (xenial), install: libwxgtk2.8-dev
我的Ubuntu版本是22.04 所以运行 sudo apt update &&sudo apt install bc bison build-essential ccache curl flex g++-multilib gcc-multilib git git-lfs gnupg gperf imagemagick lib32readline-dev lib32z1-dev libelf-dev liblz4-tool libsdl1.2-dev libssl-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc zip zlib1g-dev python-is-python3sudo apt isntall lib32ncurses5-dev libncurses5 libncurses5-dev
接下来创建编译目录并下载所需要的repo工具添加到环境变量中 mkdir -p ~/binmkdir -p ~/android/lineagecurl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repocurl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo chmod a+x ~/bin/repo
添加~/bin目录到环境变量(Ubuntu22.04中已经自动添加了,这里是做演示) sudo vim ~/.profileif [ -d "$HOME /bin" ] ; then PATH="$HOME /bin:$PATH " fi soucre ~/.profile
接下来配置git git config --global user.email "you@example.com" git config --global user.name "Your Name"
由于其大小,一些存储库配置为lfs或Large File Storage。为了确保您的发行版为此做好准备,请运行:
开启编译缓存(加快反复编译的速度) vim ~/.bashrc export USE_CCACHE=1export CCACHE_EXEC=/usr/bin/ccacheccache -M 50G
初始化LineageOS源代码存储库 cd ~/android/lineagerepo init -u https://github.com/LineageOS/android.git -b lineage-17.1 --git-lfs repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/lineageOS/LineageOS/android.git -b lineage-17.1 --git-lfs
开始下载源代码 repo sync mkdir ~/android/lineage/.repo/manifests/ vim ~/android/lineage/.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://mirrors.tuna.tsinghua.edu.cn/git/AOSP" 将 <default revision="..." remote="github" 改成 <default revision="..." remote="lineage"
配置好镜像仓库后拉取源代码
J3LTECEC尚未进入LineageOS官方储存库,状态是unofficial,这里需要手动修改要下载的储存库。!(必须有代理才可以哦,不然会出现拉取失败的情况)
mkdir -p ~/android/lineage/.repo/local_manifests/vim ~/android/lineage/.repo/local_manifests/roomservice.xml
<?xml version="1.0" encoding="UTF-8" ?> <manifest> <project path="vendor/samsung" remote="github" name="Galaxy-MSM8916/proprietary_vendor_samsung" revision="lineage-17.1" /> <project path="device/samsung/j3-common" remote="github" name="Galaxy-MSM8916/android_device_samsung_j3-common" revision="lineage-17.1" /> <project path="device/samsung/j3ltectc" remote="github" name="Galaxy-MSM8916/android_device_samsung_j3ltectc" revision="lineage-17.1" /> <project path="device/samsung/msm8916-common" remote="github" name="Galaxy-MSM8916/android_device_samsung_msm8916-common" revision="lineage-17.1" /> <project path="device/samsung/qcom-common" remote="github" name="LineageOS/android_device_samsung_qcom-common" revision="lineage-17.1" /> <project path="hardware/samsung" remote="github" name="LineageOS/android_hardware_samsung" revision="lineage-17.1" /> <project path="kernel/samsung/msm8916" remote="github" name="Galaxy-MSM8916/android_kernel_samsung_msm8916" revision="lineage-17.1" /> </manifest>
因为这并非lineageOS官方库,所以没有网络代理的话 只能手动git拉取项目文件了(这里使用的是我搭建的github镜像站)
cd ~/android/lineage/vendor/samsunggit clone -b lineage-17.1 https://git.gtian.cf/Galaxy-MSM8916/proprietary_vendor_samsung.git mv proprietary_vendor_samsung/j3-common . mv proprietary_vendor_samsung/j3ltectc . mv proprietary_vendor_samsung/msm8916-common .rm -rf proprietary_vendor_samsungcd ~/android/lineage/device/samsung/qcom-commongit clone -b lineage-17.1 https://git.gtian.cf/LineageOS/android_device_samsung_qcom-common.git mv android_device_samsung_qcom-common/* .rm -rf android_device_samsung_qcom-commoncd ~/android/lineage/device/samsung/msm8916-commongit clone -b lineage-17.1 https://git.gtian.cf/Galaxy-MSM8916/android_device_samsung_msm8916-common.git mv android_device_samsung_msm8916-common/* .rm -rf android_device_samsung_msm8916-commoncd ~/android/lineage/device/samsung/j3-commongit clone -b lineage-17.1 https://git.gtian.cf/Galaxy-MSM8916/android_device_samsung_j3-common.git mv android_device_samsung_j3-common/* .rm -rf android_device_samsung_j3-commoncd ~/android/lineage/device/samsung/j3ltectcgit clone -b lineage-17.1 https://git.gtian.cf/Galaxy-MSM8916/android_device_samsung_j3ltectc.git mv android_device_samsung_j3-common/* .rm -rf android_device_samsung_j3-commoncd ~/android/lineage/hardware_samsunggit clone -b lineage-17.1 https://git.gtian.cf/LineageOS/android_hardware_samsung.git mv android_hardware_samsung/* .rm -rf android_hardware_samsungcd ~/android/lineage/device/kernel/samsung/msm8916git clone -b lineage-17.1 https://git.gtian.cf/Galaxy-MSM8916/android_kernel_samsung_msm8916.git mv android_kernel_samsung_msm8916/* .rm -rf android_kernel_samsung_msm8916
开始编译ROM以及核心 source build/envsetup.shbreakfast j3ltectc croot brunch j3ltectc
编译成功之后 打包好的ROM和boot.img在~/android/lineage/out/target/product
参考链接 https://ivonblog.com/posts/build-lineageos-20-sony-xperia-5-ii/ https://wiki.lineageos.org/devices/s3ve3gds/build