Skip to content

Flamefire/lineageos_lilac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LineageOS for Sony Xperia XZ1 Compact (lilac)

How to build LineageOS

Initial setup

  • Make a workspace:

    mkdir -p ~/lineageos
    cd ~/lineageos

    Or use a subfolder for a specific version of LineageOS in a root folder, e.g.

    mkdir -p /lineageos/repo17
    cd /lineageos/repo17
  • Initialize the repo:

    repo init -u https://github.com/LineageOS/android.git -b lineage-17.1

    Instead of lineage-17.1 one can also use lineage-18.1 or lineage-19.1 for a different LineageOS version.

  • Create local manifests, e.g. by checking out a copy of this project and symlinking the files from the appropriate folder according to the LineageOS version used:

    git clone https://github.com/Flamefire/lineageos_lilac.git
    mkdir .repo/local_manifests
    cd .repo/local_manifests
    ln -s ../../lineageos_lilac/manifests/17.1/*.xml .
    cd -
  • Sync the repo:

    repo sync
  • Tell git about Change-Id trailers

    git config --global --get-regexp 'trailer\.' | grep -qF 'Change-Id' || git config --global trailer.changeid.key "Change-Id"

Build procedure

  • Get newer Clang compiler(s)

    LineageOS 17 & 18 only! Skip this step when building a newer LineageOS.

    For better performance/battery life, we use a newer version of the Clang compiler. So e.g. for the kernel you need to get the folder r416183b1 (at the time of writing) into prebuilts/clang/host/linux-x86. You can check other branches (e.g. for r416183b1 the branch is android-12.1.0_r22) and checkout only that folder or otherwise copy or symlink it from anywhere into prebuilts/clang/host/linux-x86.

    To simplify/automate this you can copy/symlink the clang-update-17.1.xml manifest to your .repo/local_manifests (or the corresponding file for LOS 18) and do another repo sync.

    The make below will abort with a more or less descriptive error if you miss this, so just try.

    This also requires applying at least the new Clang patches below (--minclang option).

    Alternatively you can comment out the TARGET_KERNEL_CLANG_VERSION := line in device/sony/yoshino-common/BoardConfigPlatform.mk.

  • Copy dumped firmware blobs into place for the build

    cd device/sony/lilac
    ./extract-files.sh /path/to/dumped/firmware

    We currently use the latest Sony stock, which is 47.2.A.11.228, so the file will be named like G8441_*_47.2.A.11.228-*.

  • (Semi-)optionally apply patches

    Some of the patches in this repo fix a few bugs or issues in LineageOS while others make the build deviate a lot from the "vanilla build". So this is only for advanced users!

    device/sony/lilac/patches/applyPatches.sh

    To apply only the minimal (required & security fix) patches:

    device/sony/lilac/patches/applyPatches.sh --minimal

    To apply only the minimal & new Clang patches:

    device/sony/lilac/patches/applyPatches.sh --minclang
  • Setup the environment

    source build/envsetup.sh
    lunch lineage_lilac-userdebug
  • Build LineageOS

    mka bacon

When completed, the built files will be in the out/target/product/lilac directory.

Helper scripts

To simplify the build process I use scripts which are in the build_scripts folder, so you can simply run build.sh. They have some assumptions specific to my setup (such as absolute paths) in setup.sh which may need adjustments for you. The main build script has some additional steps and checks to avoid mistakes in the semi-automated build, but does mostly what is outlined above.

About

Build LineageOS for Sony Xperia XZ1 Compact (lilac)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages