Phase 1: Setting up the compilation environment using Linux Phase 2: Downloading the LineageOS source code
Phase 3: Setting up the GSI compilation target Unlike device-specific (breakfast) compilation, GSI compilation uses special compilation targets to compile system images in a generic, non-device-specific way.
- Setting up the environment Go back to your source code directory and set up the compilation environment.
Bash
cd lineage # Navigate to your source code directory if it's not already there source build/envsetup.sh 2. Selecting the target architecture GSI builds are distinguished by their target architecture (e.g., ARM64, x86) and whether they are "native" (AOSP-like) or include Google services (this is not standard for official LineageOS builds).
The primary targets for modern devices are ARM64. You typically need to compile two targets: a system image and a vendor image (for older Treble devices) or just the system image (for modern devices).
Common GSI LineageOS targets:
lineage_arm64_bv: GSI LineageOS for ARM64, vendor-packed (for newer, most common devices).
lineage_arm64_bg: GSI LineageOS for ARM64, Google-packed (includes proprietary GApps applications, generally not used for pure GSI).
- Starting the Compilation Process
Use the
lunchcommand to select the target, then use themakecommand to begin compiling.
Bash
lunch lineage_arm64_bv Bash
make systemimage -j$(nproc) Alternatively, you can build the entire GSI product:
Bash
make -j$(nproc)
Stage 4: Results If the build is successful, the output GSI file will be in the same output directory structure:
out/target/product/generic_arm64/ The main output file will be named system.img (or a similar name depending on the target).
This system.img file is the file you will load into a compatible Treble-enabled device, usually using the fastboot command:
Bash
fastboot flash system system.img