Ultimate how-to guide: Unofficial Builds using repo style for using lineage or other aosp sources that are not supported by /e/OS
Requirements:
To prepare everything you need please have a look here how to install platform-tools and repo and everything else you need to build yourself the Repo Sync way.
You can look at the lineageos webpage for a device, in this case for the Nothing Phone (1) but any other device would also work:
https://wiki.lineageos.org/devices/Spacewar/build
Please read carefully and ensure you installed all needed programs.
In this example /e/OS-T version is used (Android 13 / Lineage 20)
For current (and older) /e/OS releases you can refer here:
https://gitlab.e.foundation/e/os/releases/-/tags
First you create a folder where you want to put the latest /e/OS sources and run the following command in the terminal:
repo init -u https://gitlab.e.foundation/e/os/android.git -b v1-t
Futher examples:
For /e/OS-S you need to enter:
repo init -u https://gitlab.e.foundation/e/os/android.git -b v1-s
and for /e/OS-U:
repo init -u https://gitlab.e.foundation/e/os/android.git -b v1-u
If you want to use a specific version you can use this command (in this example /e/OS version 2.5-T)
`repo init -u https://gitlab.e.foundation/e/os/releases.git -b refs/tags/v2.5-t`
Start download: (this will take a while, depending on your internet connection it might took some hours)
repo sync
In case you receive notifications or errors during the download:
Ensure all is downloaded and if not do repo sync again with eg the following command:
repo sync -j1 --fail-fast
There should be no errors otherwise your build environment might be not fully working
To download the prebuilt apps of /e/OS:
repo forall -c 'git lfs pull'
Case 1: Device is supported officially by LineageOS but not for /e/OS
As example I took the Nokia 8 (NB1) for LineageOS 21 (/e/OS-U)
https://wiki.lineageos.org/devices/NB1/
After your building environment is setup you need to initialize the build environment with the envsetup.sh script:
source build/envsetup.sh
Then choose the build target, in this case NB1 for the Nokia 8
breakfast NB1
Sources for the NB1 will be downloaded from the lineageOS github, however vendor files are still missing und you’ll get an error message that those are missing
You need to go to
and download
https://github.com/TheMuppets/proprietary_vendor_nokia_NB1
https://github.com/TheMuppets/proprietary_vendor_nokia_msm8998-common
Then copy the vendor files in your build environment:
eg. when you build environment is in directory eOS_U
/vendor/nokia/NB1
/vendor/nokia/msm8998-common
Type breakfast NB1
again any you should receive now no error message.
Start the build with:
brunch NB1
If everything goes well you find the ROM in /out/target/product/NB1
Case 2: Device is not supported officially by LineageOS
A good source to find unsupported devices is the XDA forum.
In this case I took the Samsung Galaxy Tab S3 as example using LineageOS 18.1 (Android 11/Android R)
That mean you need to use the /e/OS-R sources.
In that above link you find the GitHub sources for this device which you need to download
These are the Sources:
Device Tree
gts3l-common: https://github.com/awesometic/android_device_samsung_gts3l-common
gts3llte: https://github.com/awesometic/android_device_samsung_gts3llte
gts3lwifi: https://github.com/awesometic/android_device_samsung_gts3lwifi
Kernel: https://github.com/awesometic/android_kernel_samsung_msm8996
Vendor: https://github.com/awesometic/proprietary_vendor_samsung
git or via web download the respective sources. Just ensure you download the correct branch. In this case its lineage-18.1.
The device tree contain the respective device codes, here you have the ones for the Samsung Galaxy Tab S3 WIFI and LTE version. You have also a common device tree you need to download, ie you need to download the common device tree in every case and wifi or lte version as needed for the device you want to build.
Kernel is one file and contains the respective chipset for this device.
Vendor is similar to device tree and you need the common as well as the WIFI or LTE version.
In the /e/OS folder you created and were you put the /e/OS-R sources you copy now the device sources into:
The device files go into device/samsung, ie you have now device/samsung/gts3l-common and device/samsung/gts3llte and/or device/samsung/gts3lwifi
The kernel file goes into kernel/samsung/msm8996
The vendor files goes into vendor/samsung
Also you need the following to download from GitHub (ensure you download for the correct lineage version) in this case:
LineageOS/android_device_samsung_qcom-common
This file you put into folder: device/samsung/qcom-common
LineageOS/android_hardware_samsung
This file you put into folder: hardware/samsung
The device names and codes are the following:
Galaxy Tab S3 LTE (gts3llte, SM-T825)
Galaxy Tab S3 WiFi (gts3lwifi, SM-T820)
The manifest for the WIFI version is here: https://github.com/awesometic/android_device_samsung_gts3lwifi
The manifest for the LTE version is here: https://github.com/awesometic/android_device_samsung_gts3llte
You found the manifest information in the readme and need to copy the xml code into a file you can name eg. roomservice.xml
If you want to use the manifest file you find instructions to do so in the section for manifest file
Not in every case you find a manifest.xml for a device in the XDA forum. Then you need to create the manifest.xml your own.
After putting all the sources into the respective folders and store the manifest.xml file into the correct folder you run the following commands to build for the Galaxy Tab S3 WiFi:
source build/envsetup.sh
breakfast gts3lwifi
brunch gts3lwifi
Building will take a while depending on your CPU, RAM and SSD power. If all went fine you find the ROM here:
out/target/product/gts3lwifi
If you have the ROM you need to look at the install instructions for that device.
When you receive an error you need to address it and then you can restart with brunch gts3lwifi.
For the Galaxy Tab S3 LTE you need to use device code gts3llte.
Case 3: Device is not supported officially by LineageOS, but by another AOSP custom ROM (ideally lineage based)
Often one need only to adapt the device files. For some sources like for crDroid or iode in most cases even no aption is needed at all.
However, depending on the AOSP source it might be difficult or even not possible to build as some aosp custom ROMs have a lot of adaptions (eg. for Paranoid Android I cannot adapt, for Pixel-OS it is not easy but possible etc.)
Example:
https://github.com/franklin-albuquerque/derpfest_device_samsung_x1s
The S20 5G for Derpfest, device code is x1s
In this commits, one can see which adaptions usually are needed, in this case replace “derp” with “lineage”
One needs also to ensure also in the common device files if all “derp” (or other references like “aosp”) are replaced by “lineage”
If all adaptions are done, run breakfast and then you see which files are potentially still missing. For some aosp systems you can download them from their github repository, sometime its easy and you only need 1 or 2 files and then you don’t get any errors after running breakfast. If you still get errors after downloading more than 3 files, it might be very difficult to successfully build.
Commands you need to know (mandatory):
Initialize the environment with the envsetup.sh script:
source build/envsetup.sh
Choose a target (in this case its the Nothing Phone (1), Android code code is Spacewar)
breakfast Spacewar
Start the build where Spacewar is the device code in this case. The device code are different for every device.
brunch Spacewar
Build Options you should know:
Clean previous builds:
make clean
change to root directory of the project
croot
Caching to speed up build, here its set to 50GB:
export USE_CCACHE=1
ccache -M 50G
export CCACHE_COMPRESS=1
manifest.xml / roomservice.xml
If there exist an manifest.xml (might have other name like roomservice.xml or similar)
Good example:
https://github.com/K9100ii/gtaxl-manifests/blob/lineage-17.1/roomservice.xml
The manifest file needs to go into .repo/local_manifests folder. Ensure that this folder contains only one manifest file.
Run repo sync which should download all files into your building environment as defined in the manifest file
After downloading you can start your build
What if no vendor files are available:
Another way to get the vendor files is to extract them from the lineageOS ROM files. You need to download the lineageOS ROM for Spacewar and extract as outlined here:
https://wiki.lineageos.org/extracting_blobs_from_zips
Not in every case one can successfully extract the vendor files, if you receive a lot of error then something is either wrong or totally outdated vendor files.
You need to check if you have extracted really all system, product or vendor data and might try with the folder names
If you only have a few missing vendor files and which you start building you get errors you’ll see which files are still missing.
Then you might look eg here (Example for x1s)
https://dumps.tadiphone.dev/dumps/samsung/x1s
and search for the missing vendor files (check for correct Android version of dump!) and put it into respective folder
Sometime only one or a few files are missing and if downloaded and put into correct folder building will start
Patches
Sometime patches are mandatory to apply to the build environment to successfully build for a device and make it usable since without patches it might not even boot
Very good examples are the patches from Ivan:
https://github.com/8890q/patches
There are good instructions and one can apply the patches via script and even revert the patches. However if you want to use you build environment for other devices better make backups of the folders where the patches has been applied and copy the original folder back
If you run the apply script check that no error occurred. If you see an error try to copy respective patches into the folder and run
patch -p1 < patch.name
manually. Often it works, if you still get an error message you can check, and copy the changes manually, but in this case you should know what your are doing
The patches from Ivan are not only useful for the S7, but for many other devices (eg. I use them for the Samsung S3 Tab build for /e/OS-S and /e/OS-T)
Another good example are the Samsung exynos 7420 patches
https://github.com/samsungexynos7420/7420_patches
Another possibility is to replace certain folders in your building environment with the patched folders. A good example is this manifest file
https://github.com/K9100ii/gtaxl-manifests/blob/lineage-19.1/gtaxl.xml
For example you see that framework native folder (LineageOS/android_frameworks_native) is replaces by adapted native folder with patches (K9100ii/android_frameworks_native)
So you can replace most of the folders, but ensure you backup the original folders and copy the .git folder of the original folders into the adapted folders
Just be careful with important folder like framework base where you mostly cannot replace the folder.
Check if only a few commits are in the framework base and manually apply then to your original folder. A good example again it his one:
Sometimes you need to replace the qcom hardware files for a specific device. You will see it in the manifest.xml file or in the sources that
hardware_qcom_display, hardware_qcom_media or hardware_qcom_audio files are available and needed.
You then need to create symlinks as in example below or copy the respective files from the common folder:
Add necessary symlinks
ln -s …/…/common/os_pickup_audio-ar.mk hardware/qcom-caf/sm6225/audio/Android.mk
ln -s …/common/os_pickup.mk hardware/qcom-caf/sm6225/Android.mk
ln -s …/common/os_pickup_qssi.bp hardware/qcom-caf/sm6225/Android.bp
Sometime you need also to adapt file(s) in the common folder, often respective source file like android_hardware_qcom-caf_common or instructions are available
Theoretically with a good manifest.xml this might work if you put it into your local_manifest folder and run repo sync
If you need to apply a git revert you need to got to respective folder and run e.g.
git revert 7ad5797272c40c2b83b0df5a57a0f248a210091b
If you need to apply at git cherry-pick, you also need to be in respective folder and run e.g.
git init
git cherry-pick af02e0b --no-commit
Sometimes you need to apply a patch as per instructions eg.
repopick -f 331661
Just ensure you run source build/envsetup.sh prior to run repopick.
Usefull links:
https://gitlab.com/the-muppets
https://wiki.lineageos.org/extracting_blobs_from_zips
https://dumps.tadiphone.dev/dumps
Tipps & Tricks:
Check that no old manifest.xml files are in your .repo/local_manifests folder, this might lead to errors. Best delete all files in this folder unless you are currently using a manifest.xml file for the device you are currently building
LineageOS 14.1 based /e/OS-nougat
This is often shown when using LineageOS 14.1 and running out of memory, I don’t know if this is still applicable for newer LineageOS versions:
export ANDROID_JACK_VM_ARGS=“-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G”
Flex issues
Fixed with using command:
export LC_ALL=C
Jack SSL issues
After the two steps below were applied, the AOSP was successfully built.
Remove TLSv1, TLSv1.1 from jdk.tls.disabledAlgorithms in */etc/java-8-openjdk/security/*java.security file
Restart the jack server:
*cd /prebuilts/sdk/tools/ *
*./jack-admin kill-server *
./jack-admin start-server
or reboot computer…
If you have an AMD CPU and get this error during the build: ERROR: Dex2oat failed to compile a boot image.
export CPU_SSE42=false
I got a linker error you needed to address with the following command. In most cases the setup is not correct but can be easily fixed by letting the building environment know how to find it, e.g. if you got an error that clang-r383902b could not be found
error: unable to execute command: Executable “ld” doesn’t exist!
ln -s lld /mnt/media/e/eos_R/prebuilts/clang/host/linux-x86/clang-r383902b/bin/ld
If the ROM is bigger than the space left on the device you will get an error like this:
Out of space? Out of inodes? The tree size of /home/antec/android/e/R/out/soong/.temp/tmp9wfvCO is 1909398528 bytes (1820 MB), with reserved space of 0 bytes (0 MB).
The max image size for filesystem files is 1572864000 bytes (1500 MB), out of a total partition size of 1572864000 bytes (1500 MB).
So here you see, you need to somehow save over 300MB of space and get rid of e.g. some prebuilt apps.
Depending on your version you will find the configuration file e.g here:
/vendor/lineage/config in common.mk file (example for /e/OS-R, other versions might differ, newer /e/OS-version this is in eos folder in vendor).
You need to adapt the common.mk file (make a backup!).
So here you can remove non mandatory apps, I would start by removing the MINIMAL_APPS section (or set it to “true”) and then remove apps not mandatory like notes, mail etc…some apps are however mandatory like the Bliss launcher
If you are on /e/OS-R or higher you can restart to build and hope that you have now enough place and successfully build. If you are on /e/OS-Q or lower you need to make clean and restart build (might be a way to avoid this but I don’t know it)
If you receive this error message, about 0 MB left:
Out of space? Out of inodes? The tree size of out/target/product/tb128fu/tmpczh2zsqb is 4096 bytes (0 MB), with reserved space of 0 bytes (0 MB).
The max image size for filesystem files is 112248791040 bytes (107048 MB), out of a total partition size of 112248791040 bytes (107048 MB).
You need to check in the device BoardConfig.mk file for following entry:
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
and change to:
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := ext4
If you receive that fmt/chrono.h is missing, then copy from external/fmtlib all files into /fmt folder
If you receive an error about broken ELF file(s), then try this:
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true in BoardConfig.mk.
If you get this error:
Error: “libqsapshim (SHARED_LIBRARIES android-arm) missing libqsap_sdk (SHARED_LIBRARIES android-arm)”
https://github.com/LineageOS/android_system_qcom
Sometimes you get error message that something is already defined elsewhere, often you can delete the redundant folder. But not in every case, be careful if this error refers to standard build environment and not to additional files downloaded previously. This example e.g. should be ok to delete vendor/realme/RMX2185 if you build for another device:
build/make/core/base_rules.mk:325: error: packages/apps/FMRadio/jni/fmr: MODULE.TARGET.SHARED_LIBRARIES.libfmjni already defined by vendor/realme/RMX2185.
Easy to fix and pretty common are error message that kernel sources are not found afer starting build. You see than in the error message and need to adapt your kernel folder name for this device. Of course you can look into your BoardConfig.mk file in the device files and check for following entry:
TARGET_KERNEL_SOURCE := kernel/samsung/universal9830
Same for kernel config files, if you get an error message check if in BoardConfig.mk the config file and path is set correctly, e.g…
TARGET_KERNEL_CONFIG := exynos9830-z3sxxx_defconfig
Sometimes the kernel config is just in a different sub folder and can be copied into correct folder (or you adapt TARGET_KERNEL_CONFIG … )
If you get framework matrix errors you can try to add in the device common file:
PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := false
If one need to replace or add qcom-caf hardware sources and you still get error for missing packages then ad
QCOM_BOARD_PLATFORMS += msm8960
to device folder PlatformConfig.mk or BoardConfig.mk with the hardware chipset (in this case msm8960)
TO BE ENHANCED…