Skip to content

Instantly share code, notes, and snippets.

@7wells
Last active March 15, 2024 18:09
Show Gist options
  • Save 7wells/ab7b61276e9b2fa048dd231341e55c02 to your computer and use it in GitHub Desktop.
Save 7wells/ab7b61276e9b2fa048dd231341e55c02 to your computer and use it in GitHub Desktop.
How to build Lineage OS 17.1 for Lenovo Tab4 10 Plus (TBX704)
#### How to build Lineage OS 17.1 for Lenovo Tab4 10 Plus (TBX704)
## References
# https://wiki.lineageos.org/devices/bacon/build
# https://xdaforums.com/t/how-to-build-lineageos-17-1-for-the-lenovo-tab4-10-plus.4275983
# Credits to: Ecthelion4 (see 2nd link)
## Prerequisites
# Check if python command is available. If it's python3, create symlink
sudo ln -s /usr/bin/python3 /usr/bin/python
# Download and install Google platform tools (adjust path/file name appropriately)
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip
unzip platform-tools-latest-linux.zip -d ~
# Add platform tools to path by adding following lines in ~/.profile
if [ -d "$HOME/platform-tools" ] ; then
PATH="$HOME/platform-tools:$PATH"
fi
# Reload ~/.profile
source ~/.profile
# Install needed tools (building environment)
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 bc lib32ncurses5-dev libncurses5 libncurses5-dev
## Building
# Create directories
mkdir -p ~/bin
mkdir -p ~/android/lineage
# Download repo command and make it executable
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
# Reload ~/.profile
source ~/.profile
# Setup user email and name for git commands (adjust appropriately)
git config --global user.email "your@email.org"
git config --global user.name "your name"
# Check out code
cd ~/android/lineage
repo init -u https://github.com/LineageOS/android.git -b lineage-17.1
repo sync
# Set up build environment and create directory for local manifests
source build/envsetup.sh
mkdir .repo/local_manifests
# Create manifest file specific for Lenovo Tab4 10 Plus (TBX704) ...
nano .repo/local_manifests/TBX704.xml
# ... with following content
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="LineageOS/android_device_lenovo_TB8703" path="device/lenovo/TB8703" remote="github" />
<project name="LineageOS/android_device_lenovo_TB8704" path="device/lenovo/TB8704" remote="github" />
<project name="LineageOS/android_device_lenovo_TBX704" path="device/lenovo/TBX704" remote="github" />
<project name="LineageOS/android_device_lenovo_tb-common" path="device/lenovo/tb-common" remote="github" />
<project name="lenovo-devs/android_kernel_lenovo_msm8953" path="kernel/lenovo/msm8953" remote="github" />
<!-- Vendor -->
<project name="lenovo-devs/proprietary_vendor_lenovo" path="vendor/lenovo" remote="github" revision="lineage-17.1-gxfp" />
</manifest>
# Reload build/envsetup.sh (not sure if needed here again)
source build/envsetup.sh
# Not sure if the previous `repo sync` (without -c parameter) above was necessary - here it is
repo sync -c
# Prepare and start building process
lunch lineage_TBX704-userdebug
mka bacon
# Notes (quoted from Ecthelion4 in 2nd link under references):
# This will take some hours. You might have noticed that I skipped setting up ccache,
# which is done in the official documentation. This is not a necessary but an optional step.
# For the first build this won't matter. For subsequent builds activating ccache might speed up the build.
# But it also uses up some space on the hard drive (the recommendation in the build docs is 50GB, or 20GB
# when activating compression). Once the build was finished successfully, you should find the zip file
# with the LOS image in `out/target/product/TBX704/`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment