• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[GUIDE] How to build an unsupported rom using sources from other roms

Search This thread

malikwaqas758

Member
Jul 13, 2020
11
0
Sargodha
apkfinds.com
PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE legitimately

Determine Framework Compatibility Matrix Version in gadget show by adding an objective level ascribe to the root component <manifest>. In the event that PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE is 26 or 27, you can include "target-level"="1" to your gadget show.

how to actualize this?

---------- Post added at 06:01 AM ---------- Previous post was at 05:59 AM ----------

Thanks all of you to share your thoughts its very impressive and get my answer
 

ThePiGuy

Senior Member
Nov 5, 2017
1,305
1,247
PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE legitimately

Determine Framework Compatibility Matrix Version in gadget show by adding an objective level ascribe to the root component <manifest>. In the event that PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE is 26 or 27, you can include "target-level"="1" to your gadget show.

how to actualize this?

---------- Post added at 06:01 AM ---------- Previous post was at 05:59 AM ----------

Thanks all of you to share your thoughts its very impressive and get my answer
I'm sorry, I haven't encountered that so I don't know
 

ThePiGuy

Senior Member
Nov 5, 2017
1,305
1,247
Sorry for being such a noob I hope I'm not wasting your time. But it is the local makefile/manifest included in the Device tree or do we make it ourselves?
No worries, that's what this thread is here for ;)

The local manifest can either be created by you or supplied by a third party.

For example, this one for the LG G4 (https://github.com/LGgFour/local_manifests/tree/lineage-17.0) will let you build lineage 17, if you want to change it to a different rom you can just swap out the lineage references to the new ROM (assuming the repos exist like for like)

However sometimes these aren't provided and then you will need to make one yourself

Edit: in any case, it will not be supplied inside the device tree if it exists and will be provided in some other way, e.g a new GitHub repo
 

respectablenoob

Senior Member
May 10, 2020
86
8
No worries, that's what this thread is here for ;)

The local manifest can either be created by you or supplied by a third party.

For example, this one for the LG G4 (https://github.com/LGgFour/local_manifests/tree/lineage-17.0) will let you build lineage 17, if you want to change it to a different rom you can just swap out the lineage references to the new ROM (assuming the repos exist like for like)

However sometimes these aren't provided and then you will need to make one yourself

Edit: in any case, it will not be supplied inside the device tree if it exists and will be provided in some other way, e.g a new GitHub repo
So how do we include the device specific files? Do we git clone or manually download it and place it in .repo? Thanks:)
 

ThePiGuy

Senior Member
Nov 5, 2017
1,305
1,247
So how do we include the device specific files? Do we git clone or manually download it and place it in .repo? Thanks:)
It's up to you.

If you use a local manifest, repo sync will git clone to the appropriate location (kernel/<manufacturer>/<chipset>, device/<manufacturer>/<device model or common tree>)

If you clone manually, clone to those above locations
 
So how do we include the device specific files? Do we git clone or manually download it and place it in .repo? Thanks:)
The cleanest and more efficient way is to have one or more .xml file/s into .repo/local_manifests/
That way repo sync will pull all the project indicated into the xml and place where you want. Individual cloning is a nightmare IMHO.
 

ThePiGuy

Senior Member
Nov 5, 2017
1,305
1,247
The cleanest and more efficient way is to have one or more .xml file/s into .repo/local_manifests/
That way repo sync will pull all the project indicated into the xml and place where you want. Individual cloning is a nightmare IMHO.
Absolutely, I would definitely agree that using a local manifest is by far the best way to do it. Easier and whenever you repo sync they all get updated too
 

me98278

Member
Oct 14, 2012
7
3
Hi,

I'm trying to build the PixelExperience ROM for Nexus 7 2013 and I was able to do it successfully by referring to your guide.. Thank you so much for writing this !!

I used the following sources :

https://github.com/PixelExperience/manifest/tree/ten-plus
Device Tree: https://github.com/followmsi/android_device_asus_flo/tree/aex-10
Vendor Tree: https://github.com/followmsi/android_vendor/tree/flo-deb-lineage-17.1
Kernel Tree: https://github.com/followmsi/android_kernel_google_msm/tree/followmsi-10

I had to increase the system partition to 1.6 GB to accommodate the ROM and I have re partitioned the nexus 7 storage to create a bigger system partition .

I keep getting the following error while trying to flash the ROM :
-------------------------------------------------------------------------------------------------------
creating stash /cache/recovery/5a79362318d00cf4c316e86435b3ed38dd35082d
71118848 bytes free on /cache (0 needed)
/cache/recovery/last_command doesn't exist.
erasing 7086 blocks
BLKDISCARD ioctl failed: Invalid argument
failed to execute command [erase 2,402533,409619]
new data receiver is still available after executing all commands.
script aborted: E1001: Failed to update system image.
E1001: Failed to update system image.error: 1001
Updater process ended with ERROR: 7
I:Install took 0 second(s).
Error installing zip file '/sdcard/PixelExperience_Plus_flo-10.0-20201101-0407-UNOFFICIAL.zip'
-------------------------------------------------------------------------------------------------------------------

I have tried to flash the ROM via sideloading but that did not help.

Can you help me figure out this error ??
 
Last edited:

vikasrockz

Senior Member
Aug 15, 2015
109
190
28
Mumbai
Error after initiating build.

I am compiling Android Derpfest R version for my device. My device is officially supported by the maintainer dropped the support after Android 10. So I want to personally build R version for my device. I cloned all necessary trees and sources so after intiating build command. I get this error. Check the log. And screenshot attached.
https://del.dog/ukacrolitt
 

Attachments

  • IMG_20201105_204902.jpg
    IMG_20201105_204902.jpg
    263.3 KB · Views: 42

starbright_

Senior Member
Apr 11, 2010
1,340
223
I am new to this, I start building what a dev has been created. His instruction for building it is like that:
repo init ... -l lineage-17.1
git clone ... android_manifest_<device> .repo/local_manifests
repo sync ..
. build/envsetup.sh && lunch <device> && mka clean && mka api-stubs-docs && ... && mka test-api-stubs-docs && mka bacon.

Unfortunatly I can't ask dev. Maybe someone can explain me what is difference to just
breakfast bacon ?

Although I once was able to build it, now I get errors
(xxx.java: error cannot find symbols) while
mka system-api-stubs-docs

Once I heard that can be a memory issue - to less RAM!?!?
Thank you for any hints!
 
Last edited:

Hb20032003

Senior Member
Oct 22, 2015
175
361
Noida
I am new to this, I start building what a dev has been created. His instruction for building it is like that:
repo init ... -l lineage-17.1
git clone ... android_manifest_<device> .repo/local_manifests
repo sync ..
. build/envsetup.sh && lunch <device> && mka clean && mka api-stubs-docs && ... && mka test-api-stubs-docs && mka bacon.

Unfortunatly I can't ask dev. Maybe someone can explain me what is difference to just
breakfast bacon ?

Although I once was able to build it, now I get errors
(xxx.java: error cannot find symbols) while
mka system-api-stubs-docs

Once I heard that can be a memory issue - to less RAM!?!?
Thank you for any hints!
You can find the difference between mka and breakfast here http://www.trcompu.com/MySmartPhone/AndroidKitchen/Breakfast-Brunch-Lunch.html. As for the error please provide log of the error from FAILED.
 

Mighty

Senior Member
Mar 17, 2018
493
206
Samsung Galaxy Tab 2
Okay, i am building lineage os 15 for samsung galaxy tab 2 and i get this error

Code:
 ninja: error: 'libsrv_init', needed by '/home/mighty/Los/out/target/product/espresso3g/obj/EXECUTABLES/pvrsrvinit_intermediates/pvrsrvinit.o', missing and no known rule to make it
 

fromdetroit7

Member
Jan 17, 2010
27
2
I appreciate you offering to assist others to the best of your abilities. I'm interested in building a ROM from source or, if possible, just the boot image. However, before I spend a significant amount of time trying to complete the build, I'm hoping someone can tell me if what I want to achieve is even possible given the resources provided by the manufacturer. The device (Sony walkman nw-a105) runs on android 9 pie, the bootloader is unlocked, Sony has made available a copy of the GPL source, but they haven't provided a copy of the proprietary binaries. Is it possible to build a ROM, or at least a usable boot image, using just the Sony OSS code & AOSP? I am wanting to root by using Magisk to patch the boot.img. Because Sony doesn't provide a copy of the ROM to extract a boot image, is this a waste of time? If not, what do I need to be successful?
 

SteveWhoLikesThings

New member
Mar 23, 2021
1
0
127.0.0.1
So, I am trying to build AEX in Arch Linux, but it seems like, even after running the source command, the command brunch is not found. Please help me out.

EDIT: Well, as it turns out, the command is no longer brunch, its lunch
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 26
    Hello all and welcome to my first how-to guide

    I began the process of learning about ROM about 4 months ago (so excuse this post if there are any inaccuracies and please feel free to correct me in the comments - I will absolutely update this post to ensure it has the best information)

    Whilst I was trying to learn, I noticed there was a lack of information regarding how the actual build process works. Many roms will provide instructions allowing you to build your own unofficial version for one of their official devices, but very rarely do they inform you as to how you may do this for a device not officially supported.

    This is what I shall try and explain here.

    Building for a newer version of android is another challenge, so this guide will focus on building an unsupported rom from device sources that support the same version of android (e.g building Lineage oreo from AOSCP oreo sources etc)

    Requirements
    • A relatively fast PC with a least 4 cores (less may work but it will take a long time)
    • At least 8GB ram
    • A swap-file set up in the event that your ram is fully filled
    • A significant amount of storage (each build can take 150-200GB)

    Set up your PC for building
    Firstly, allocate Jack enough memory to complete the build process by running
    Code:
    export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
    And adding that line to your ~/.bashrc file

    Also (optional) enable ccache by running
    Code:
    export USE_CCACHE=1
    and adding that to your ~/.bashrc

    If you choose to use ccache, also allocate a set amount of memory to use with
    Code:
    ccache -M $G
    Where $ is a value of your choice between 50 and 100

    First things first, we need to download the main source code for the target rom

    Firstly you need to sync the sources from the manifest of your chosen rom. This will normally be called android, or manifest (or something similar) and will contain some xml files layed out like the example local manifest below

    Find this repo and copy the link. Then move to the location you wish the entire android code to be stored, and then perform the following command
    Code:
    repo init -u <url of manifest repo>.git -b <branch you want to build>
    e.g. for lineage 15.1 it would be
    Code:
    repo init -u https://github.com/LineageOS/android.git -b lineage-15.1

    Finally, run "repo sync" to download the source code. It is very large (approximately 30GB) so it will take a while. Should you need to cancel this, a simple CTRL+C will stop it, and it will continue from where it stopped next time you run repo sync

    Now we need to understand which components we need to build a custom rom.

    We need (anything inside the <> needs to be replaced with relevant information for your device)
    1. A device tree. This contains all the information needed to configure the rom build to your device's needs. Often this comes as more than one repo (one for your exact device and one for the general model - e.g. for my LG G4 H815, we have the h815 repo and the g4-common repo). The format for these repos is generally android_device_<vendor>_<device model>
    2. A kernel. This contains all the drivers and more needed for your device to be able to run Android. Often these are named using your device's chipset name and follow the format android_kernel_<vendor>_<chipset>, although occasionally they can use your model name instead of the chipset.
    3. Proprietary blobs. These are the closed source blobs that come bundled in your OEM software and contain the non-OSS (open source software) drivers for your device. They normally come in a repo labeled proprietary_vendor_<vendor> which normally contains blobs for all the devices released by that vendor (that are supported).
    4. Any other repos specified by the dependencies file (more on that later)
    All of the above repos go into the path specified in the name - for example, android_device_<vendor>_<device model> will go into the device/<vendor>/<device model> directory.

    To sync these, you should create a local manifest in the <android source>/.repo/local_manifests/ folder. Name it anything you like (make sure it's an xml file) and fill it out like so
    Code:
    <manifest>
      <remote  name="<your chosen name for this url>"
               fetch="<url to your git organisation>"
               revision="<branch if different to the one used in repo init (otherwise, miss out revision)>"
    
      <project name="<name of repo inside git org>" path="<destination of the repo>" remote="<remote name chosen earlier>" revision="<revision if different to one specified above>" />
    </manifest>

    After adding this manifest, re-run repo sync to pull the extra repos

    Understanding the device tree.

    Inside the device tree (model specific one if there are more than one) there will be a file with a naming scheme along the lines of <rom brand>.mk (e.g. lineage.mk). This is the starting file for your device and is detected when you begin a build for your device. (Pie roms are currently using AndroidProducts.mk as a placeholder containing a link to this file). It contains links to the common configuration of your device (phone, tablet etc) at the top, and also specifies the name of the product (normally <rom>_<device model>) which is part of the command used to build the device.

    There will also be some build prop overrides - these contain information like the device name and the build fingerprint (used to verify to google what device you are - lots of devices leave this as the last stock fingerprint to pass google CTS)

    In most device trees, there will also be a <rom>.dependencies file. This contains all the additional repos needed to build for your particular device. This file is parsed automatically if you use the official methods and use the breakfast command. If you do it manually, they must be added to a local manifest.

    The <device model>.mk file is what defines what open source packages need to be built in the build. Devices either include everything in this file or they can link to a product folder in which every .mk file is included.

    BoardConfig(Common).mk includes configuration options for the device, and often links to config files to inform the builder of certain flags that need to be applied for the build. Similarly to the <device model>.mk, this is often linked to a board folder containing configurations

    The kernel

    The kernel is a massive topic and one that I cannot explain in depth here. However, for rom building it is useful to know that the defconfigs used to build a kernel are located in kernel/<chipset/device model>/arch/<arm or arm64 depending on device>/configs and the one used is normally in the format <rom>_<device model>_defconfig (e.g my lineage one is lineageos_h815_defconfig). Should you wish to change the name, simply change the name and alter the defconfig name in the BoardConfig.mk for your particular device.

    So...to the main part - how do you build a rom.

    Essentially there are a few main commands that are spoken about
    • "source build/envsetup.sh". This runs the builder script and loads all the custom commands.
    • "breakfast". This simply pulls the device specific code from the official repos. You do not need this if you are building unofficially
    • "brunch". This effectively performs breakfast, but assuming everything is synced correctly, it will finish without an issue. Then it will go on to begin the build. Normally brunch is run as brunch <rom name>_<device model>-userdebug (or eng if you are developing). User is used for OEM releases but most roms use userdebug as it is slightly more relaxed on conditions
    To build a rom from unsupported sources requires a bit of thought. Firstly, ensure you have all the dependencies synced (hopefully from the target rom) as well as the device sources.

    Then you need to go into the device tree and modify
    1. The <rom>.mk file to now be renamed to your new rom.
    2. You need to enter that file and modify any stuff relating to your old ROM look for your new rom instead (device type configurations are normally the main one here).
    3. You need to remove any stuff inside your device tree relating to features not in your new rom.
    Then run "source build/envsetup.sh"
    "brunch <rom>_<device model>-userdebug"

    This will hopefully begin the build and assuming everything is setup correctly, should continue through to finish building the rom of your choice

    If you have any questions/issues with this process, I will be happy to answer to the best of my ability

    Also, big thanks to the LineageOS guide for giving me a basis upon which to base this guide on
    1

    Ok. Sorry for the late reply.

    You need to open the AndroidProducts.mk file and rename the lineage_oneplus2.mk line to aosp_oneplus2.mk.

    You also need to change the lineage_oneplus2.mk file so it is called aosp_oneplus2.mk, and inside it you need to change any occurrences to aosp (basically you are rebranding the device tree to use the aosp versions rather than the lineage branded ones)
    1
    Hey
    I have a common device source, which has linked my device to 3 more configuration files. I tried to change lineage to other rom in every possible location I can find but on building this error comes into action.
    The error is same for every AOSP based rom

    [email protected]:~/AEX$ mka aex -j4
    vendor/aosp/config/bootanimation.mk:32: warning: Target bootanimation res is undefined, using generic bootanimation
    Ok so what it looks like - did you sync only the device trees and any common ones and then use the "brunch" or "breakfast" command to download the rest of the repos. If so, then it's still pulled the repos from lineage (in all the dependency files, you can see where they come from)

    If you did, try finding the AEX equivalent repo and replacing that in the .dependency file that it is referred to in.

    If this is not what you did, please detail what you did to get your environment
    1
    Hello, I know it's been 1.5 years since you published this guide, but I'm currently starting to learn how to do it ... Can I ask you a couple of questions?

    Of course :) feel free.

    Btw, I'd recommend not quoting the whole OP as it fills up the thread a little bit ;)
    1
    In fact I was very happy when I saw that you had created this guide, if I'm not mistaken you worked on the G4!

    A premise, I'm Italian, so I'm not writing in my first language. hope be understanding :)

    So in summary, if I have X_Y_Z, will I have to put it (in most cases) in the X / Y / Z folder? (I had suspicions seeing the files and the manifest)

    So in code for Ubuntu I should:
    Code:
     cd ~ / X / Y / Z
    repo init -u [url]https://github.com/X/Y/Z[/url]
    repo sync

    So if I would like to download from github android_device_lge_g4 I would have to do it this way (in my case I called the Android root folder, and the folder where I downloaded all the PE lineage code) [actually I didn't want to change, after downloading la lineage hahaah]:

    Code:
     cd ~ / android / lineage / device / lge / g4-common
    repo init -u [url]https://github.com/Suicide-Squirrel/android_device_lge_g4-common/tree/lineage-17.0_kessaras[/url]
    repo sync

    This should allow me to download the files directly to the appropriate folder. I should repeat this for everyone:
    1) android_device_lge_g4
    2) android_device_lge_g4-common
    3) Titan-Kernel-LG-G4

    But, I should also download and put in the appropriate folders:
    1) LOS STUFF
    2) power HAL patch
    3) MISC (without the last 2, as the EP has the GApps included, and these are used to enter the alternative F-droid store, and a Backup function)
    4) REMOVALS (must be at TOP) (? I have no idea what it is and what it is for)

    Yes I got the initial lineage 15.1 ROM working for the G4 (using kessaras's sources, and with help from both steadfasterX and kessaras)

    So it looks like you are getting a little bit confused with regards to the repo tool.

    Code:
    repo init -u
    is used to set the main android source code directory. This should be used once, and only once.
    For example, for PixelExperience:
    Code:
    repo init -u https://github.com/PixelExperience/manifest -b 10
    where -b ten is the branch of PE that you want to build.

    Once inside, I'd recommend going to the local manifest as described in the main part of the guide, and using the manifest from suicide squirrel (as in this case I know that it works). I'd then alter any ROM specific ones (those that use remote="lineage") to (if possible) use PE equivalent ones from their github.

    It looks like you are trying to build A10 so you want this as your basis: https://github.com/Suicide-Squirrel/local_manifests/blob/lineage-17.0/roomservice.xml

    Beware though - A10 hasn't been released yet for a reason - it's still got some major bugs