To build LineageOS for Samsung devices powered by the SM8350 SoC, such as the Samsung Galaxy S21 FE (r9q), follow the steps below.
- Operating System: A 64-bit Linux distribution (e.g., Ubuntu 20.04 LTS) is recommended.
- Hardware: At least 16 GB of RAM and 200 GB of free storage.
- Tools: Ensure
adb
andfastboot
are installed and configured on your system.
-
Install Required Packages:
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
-
Install Repo Tool:
mkdir -p ~/bin curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo export PATH=~/bin:$PATH
-
Configure Git:
git config --global user.name "Your Name" git config --global user.email "[email protected]"
-
Initialize the Repo:
mkdir -p ~/android/lineage cd ~/android/lineage repo init -u https://github.com/LineageOS/android.git -b lineage-22.0
-
Create a Roomservice Manifest:
Ensure the
.repo/local_manifests/
directory exists:mkdir -p .repo/local_manifests
Create a file named
roomservice.xml
in the.repo/local_manifests/
directory with the following content:<?xml version="1.0" encoding="UTF-8"?> <manifest> <!-- Samsung SM8350 Common Trees --> <project name="samsung-sm8350/android_device_samsung_sm8350-common" path="device/samsung/sm8350-common" remote="github" revision="lineage-22" /> <project name="samsung-sm8350/android_kernel_samsung_sm8350" path="kernel/samsung/sm8350" remote="github" revision="lineage-22" /> <!-- Dependencies --> <project name="samsung-sm8350/android_device_qcom_common" path="device/qcom/common" remote="github" revision="lineage-22" /> <project name="samsung-sm8350/android_hardware_samsung" path="hardware/samsung" remote="github" revision="lineage-22.0" /> <!-- Vendor Tree --> <project name="samsung-sm8350/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="lineage-22" /> <!-- Samsung Galaxy S21 FE (r9q) [SM-G990B] --> <project name="samsung-sm8350/android_device_samsung_r9q" path="device/samsung/r9q" remote="github" revision="lineage-22" /> </manifest>
Fetch Roomservice Manifest:
curl -o .repo/local_manifests/roomservice.xml https://raw.githubusercontent.com/samsung-sm8350/.github/refs/heads/main/manifests/roomservice.xml
-
Sync the Source Code:
repo sync
- Paste following commands for basic setup:
export USE_CCACHE=1 export CCACHE_EXEC=/usr/bin/ccache ccache -M 50G ccache -o compression=true
-
Set Up the Build Environment:
source build/envsetup.sh
-
Choose the Target:
lunch lineage_r9q-ap3a-eng
-
Start the Build:
mka bacon
The compiled ROM will be located in the out/target/product/r9q/
directory.