[GUIDE][COMPLETE] Android ROM Development From Source To End

Search This thread

qiurigao

Senior Member
Oct 11, 2016
142
65
JIAGNXI
[34/54] link out/soong/.bootstrap/soong-python/test/test
[35/54] test android/soong/python
[36/54] link out/soong/.bootstrap/soong-cc-config/test/test
[37/54] test android/soong/cc/config
FAILED: out/soong/.bootstrap/soong-cc-config/test/test.passed
out/soong/.bootstrap/bin/gotestrunner -p ./build/soong/cc/config -f out/soong/.bootstrap/soong-cc-config/test/test.passed -- out/soong/.bootstrap/soong-cc-config/test/test -test.short
panic: read /opt/8937: is a directory

goroutine 1 [running]:
android/soong/cc/config.setSdclangVars()
/opt/8937/build/soong/cc/config/global.go:206 +0x17bc
android/soong/cc/config.init.2()
/opt/8937/build/soong/cc/config/global.go:179 +0xcd6
android/soong/cc/config.init()
/opt/8937/build/soong/cc/config/tidy_test.go:42 +0x3cbb
main.init()
/opt/8937/out/soong/.bootstrap/soong-cc-config/test/test.go:64 +0x58
[38/54] link out/soong/.bootstrap/soong-java/test/test
[39/54] compile out/soong/.bootstrap/soong-cc/pkg/android/soong/cc.a
[40/54] compile out/soong/.bootstrap/soong-cc/test/android/soong/cc.a
ninja: build stopped: subcommand failed.
01:31:39 soong failed with: exit status 1
 

ashwini215

Senior Member
Nov 17, 2014
378
97
Mumbai
After reverting it the those are working?[/QUOTE]

No, still the same problem.
Is this problem something to do with the warnings that come at the last during kernel compilation.

I have attached log.
 

Attachments

  • complete_log.txt
    114.8 KB · Views: 8

DodoGTA

Inactive Recognized Developer
Feb 18, 2015
2,952
1,147
Hi,

in this security bulletin, i can see 5.1.1 in "updated AOSP versions" column of some tables.
When i "repo sync" my 5.1.1 AOSP source, i don't seem to get these securtity patches.

I'm syncing android-5.1.1_r38, are these patches merged in some other tag ?
Did i understand it wrong ?

Thanks !
Just because it's applicable to that version doesn't mean that a new tag will be released for that version

Sent from my Samsung Galaxy Trend Plus using XDA Labs
 

pix106

Senior Member
Oct 16, 2010
1,113
594
Xiaomi Mi Pad 4
Xiaomi Mi Pad 4 Plus
Just because it's applicable to that version doesn't mean that a new tag will be released for that version
Thanks.
So, do you know where it has been updated and how to sync it ? Table header on security bulletin says "updated AOSP version" not "applicable to" :), there must be somewhere to get this updated source code, isn't it ?
 
Last edited:

DiamondJohn

Recognized Contributor
Aug 31, 2013
7,375
7,391
Sydney
Kanging?

I've successfully build a few ROMs for my device and I share my builds here on XDA.

All my builds are LineageOS based, and as part of my build, I replace a few standard LineageOS apps with ones from other ROMs. For example, in my ResurectionRemix build, I replace LineageOS's music player Eleven, with OmiRom's music player Phonograph.

I do specifically give mention / references to these changes in the threads where I post the builds for my ROMs.

Is this taking from a number of different ROMs (found on GitHub) to piece together my version of a ROM OK? or do I need to attain explicit permissions from someone to "Kang" these repositories on GitHub? ironically, the last ROM I built using this technique was to modify the apps included in AOKP.
 

DodoGTA

Inactive Recognized Developer
Feb 18, 2015
2,952
1,147
Thanks.
So, do you know where it has been updated and how to sync it ? Table header on security bulletin says "updated AOSP version" not "applicable to" :), there must be somewhere to get this updated source code, isn't it ?
You have to cherry-pick the relevant commits

Sent from my Samsung Galaxy Trend Plus using XDA Labs
 

xenreon

Inactive Recognized Themer
Jun 2, 2014
1,930
1,981
I've successfully build a few ROMs for my device and I share my builds here on XDA.

All my builds are LineageOS based, and as part of my build, I replace a few standard LineageOS apps with ones from other ROMs. For example, in my ResurectionRemix build, I replace LineageOS's music player Eleven, with OmiRom's music player Phonograph.

I do specifically give mention / references to these changes in the threads where I post the builds for my ROMs.

Is this taking from a number of different ROMs (found on GitHub) to piece together my version of a ROM OK? or do I need to attain explicit permissions from someone to "Kang" these repositories on GitHub? ironically, the last ROM I built using this technique was to modify the apps included in AOKP.
Keeping the original commit authorship is enough, that's why it's open source.
 

DodoGTA

Inactive Recognized Developer
Feb 18, 2015
2,952
1,147
Ok, if I got it well, I actually have to cherry pick all commits before these ones ? Isn't there a "master" branch somewhere ?
You have to cherry-pick the relevant security patch-related commits (They can be found in the security bulletins) that are of a newer security patch than the one specified in build/core/version_defaults.mk (Example: If one wants to go from April 2016 to January 2017 security patch, then one has to cherry-pick commits from the May, June, July... 2016 security patch) and bump the security patch level accordingly

And AOSP has a master branch, but it's bleeding-edge (and that's not what you want in this case)

Sent from my Samsung Galaxy Trend Plus using XDA Labs
 
  • Like
Reactions: Akopps

ichiato

Senior Member
Jun 27, 2014
101
8
I am trying to build aicp from source for an unsupported device and I keep getting this error when building
Code:
ninja: error: '/Volumes/android/aicp/out/target/product/j3x3g/obj/KERNEL_OBJ/usr', needed by '/Volumes/android/aicp/out/target/product/j3x3g/obj/SHARED_LIBRARIES/libtinyalsa_intermediates/mixer.o', missing and no known rule to make it
. full log attached. Any help would be appreciated
 

Attachments

  • build-log.txt
    7.8 KB · Views: 9
Last edited:

manishvermaa

Member
Jun 5, 2015
31
8
Kathmandu
I am getting this error while building DU for oneplus 3t. Any help will be appriciated.
Code:
ninja: error: '/home/manish/DU/out/target/product/oneplus3/kernel', needed by '/home/manish/DU/out/target/product/oneplus3/boot.img', missing and no known rule to make it
20:00:38 ninja failed with: exit status 1
make: *** [build/core/main.mk:21: run_soong_ui] Error 1
Full log:
https://hastebin.com/aqegiruqur.pl
 

ichiato

Senior Member
Jun 27, 2014
101
8
I am getting this error while building DU for oneplus 3t. Any help will be appriciated.
Code:
ninja: error: '/home/manish/DU/out/target/product/oneplus3/kernel', needed by '/home/manish/DU/out/target/product/oneplus3/boot.img', missing and no known rule to make it
20:00:38 ninja failed with: exit status 1
make: *** [build/core/main.mk:21: run_soong_ui] Error 1
Full log:
https://hastebin.com/aqegiruqur.pl

where in your device tree is your recovery.fstab and kernel located ?
 
Last edited:

virsys

Senior Member
Jan 8, 2018
123
120
Brussels, Server Rack 42
Good morning :)
I used this guide to create a ROM for my tablet (gt510wifi). The rom compiles just fine, but it isn't booting on the device. TWRP flashes the rom without any issues. The tablet is stuck on the bootlogo and not rebooting. The rom (rr) is rooted with Magisk. Is knox preventing my phone from booting? I'm new to this..
Can you give me a hint?? Is there a log deep inside of my tablet?
Thanks :)
 

pix106

Senior Member
Oct 16, 2010
1,113
594
Xiaomi Mi Pad 4
Xiaomi Mi Pad 4 Plus
You have to cherry-pick the relevant security patch-related commits (They can be found in the security bulletins) that are of a newer security patch than the one specified in build/core/version_defaults.mk (Example: If one wants to go from April 2016 to January 2017 security patch, then one has to cherry-pick commits from the May, June, July... 2016 security patch) and bump the security patch level accordingly

And AOSP has a master branch, but it's bleeding-edge (and that's not what you want in this case)

Sent from my Samsung Galaxy Trend Plus using XDA Labs

ok, thanks a lot !
I hoped there was a "5.1.1 master", from which a new tag hadn't been created after the r38... :)
I'll try to do this, but as i never cherry-picked i'm affraid of the dependencies... and i'll have to cherry-pick dozens of commits... i'll discover if they are easy to deal with :)

And i didn't mention that, for now, my unpublished AOSP rom for Tab2 A7-10F (MT8127) reboots randomly "after a while", with a device tree that is very close to the one i used for CM12.1 and which works with no reboot.

Thanks again !
 

albertoduqe

Senior Member
May 4, 2017
1,085
526
Hi again you all!!

I sorted out the fatal signals I was getting with LegendRom for Lithium. They were related to NFC.

I solved them temporarily replacing and adding missing NFC files and folders directly yo /out/target/lithium/system, getting them from an RR build.

In the meantime, I added the missing sources to local_manifest (pointing to the three repos I found in LineageOS, LineageOS/android_vendor_nxp-nfc_opensource_XXX), and to lithium's dependencies, but when I run another build the "missing" files are not there.

I do not want to bother you guys with the list of files affected, but my guess is that the main missing thing is the folder NQNfcNci in system/vendor/app and its inner lib folder and apk file.

My question is, what am I missing? I mean, the source for that folder and apk is there in the Android.mk, in my working-tree/vendor/nxp-nfc/opensource/Nfc...

My only guess is that I must make clobber and clear the out folder, run a clean build and maybe then it's all pulled to its place, but I don't know if I am in the right path at all...

Thanks!!!
 

Infect_Ed

Senior Member
Jan 10, 2017
215
166
Hi again you all!!

I sorted out the fatal signals I was getting with LegendRom for Lithium. They were related to NFC.

I solved them temporarily replacing and adding missing NFC files and folders directly yo /out/target/lithium/system, getting them from an RR build.

In the meantime, I added the missing sources to local_manifest (pointing to the three repos I found in LineageOS, LineageOS/android_vendor_nxp-nfc_opensource_XXX), and to lithium's dependencies, but when I run another build the "missing" files are not there.

I do not want to bother you guys with the list of files affected, but my guess is that the main missing thing is the folder NQNfcNci in system/vendor/app and its inner lib folder and apk file.

My question is, what am I missing? I mean, the source for that folder and apk is there in the Android.mk, in my working-tree/vendor/nxp-nfc/opensource/Nfc...

My only guess is that I must make clobber and clear the out folder, run a clean build and maybe then it's all pulled to its place, but I don't know if I am in the right path at all...

Thanks!!!

https://github.com/LineageOS/android_vendor_nxp-nfc_opensource_Nfc/tree/lineage-15.0

https://github.com/LineageOS/android_vendor_nxp-nfc_opensource_libnfc-nci/tree/lineage-15.0

https://github.com/LineageOS/android_vendor_nxp-nfc_opensource_frameworks/tree/lineage-15.0

You need all three of these
 
Last edited:

ZVNexus

Recognized Developer
Feb 23, 2016
1,150
1,880
Tempe, AZ
Trying to build Dirty Unicorns v12 for the HTC One (M9) (Verizon).

https://hastebin.com/wobatalelu.vbs

Have looked this up but all I can find is just other people's hastebins pertaining to the same error. From reading it, it looks like its missing a Java library? I have a hard time reading errors.

How would I go about obtaining a Java library?
 

xenreon

Inactive Recognized Themer
Jun 2, 2014
1,930
1,981
Trying to build Dirty Unicorns v12 for the HTC One (M9) (Verizon).

https://hastebin.com/wobatalelu.vbs

Have looked this up but all I can find is just other people's hastebins pertaining to the same error. From reading it, it looks like its missing a Java library? I have a hard time reading errors.

How would I go about obtaining a Java library?
Either sync lineagesdk (check los GitHub) or remove whatever is asking for it.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 452
    Hello Everyone....:D:D

    Today I will present you all the ultimate guide for ROM development starting from Source to End.
    This guide will be applicable to all devices.
    So lets Start :D



    What is Android? :rolleyes:

    Android is an open-source operating system developed by Google for smartphones, tablets, and other devices. It provides a user-friendly interface and supports a vast ecosystem of applications through the Google Play Store. With its Linux-based foundation, Android enables multitasking and offers extensive customization options for both manufacturers and users. Its integration with Google services enhances functionality and connectivity, making Android a popular choice for mobile devices worldwide.
    Full Freedom for people using it :D


    What is Android Source Code?

    Android is an open-source software stack developed for a diverse range of devices with varying form factors. The primary objective of Android is to provide an open software platform that is accessible to carriers, original equipment manufacturers (OEMs), and developers, enabling them to bring their innovative ideas to life. The goal is to create a successful, real-world product that enhances the mobile experience for users. One of the notable features of Android is that it offers a complete, production-quality consumer product with source code that is openly available for customization and porting.
    Android allows for extensive customization and enables developers to create new functionalities and experiences without significant restrictions. This openness fosters creativity and empowers developers to tailor Android to suit their specific needs. It also encourages collaboration within the Android community, where developers can share their enhancements, contribute to the platform's evolution, and address any issues or bugs.
    So basically Android Allows to customize the things you like and make new things without any Restrictions. Cool isn’t it? :cool:

    What is Android ROM ?

    An Android ROM refers to a customized version of the Android operating system that is installed on a device. ROM stands for "Read-Only Memory," which originally referred to firmware stored in a device's memory. However, in the context of Android, a ROM typically refers to the software package that includes the operating system, user interface, and other components specific to a particular device or a modified version of Android.

    While it is true that an Android ROM includes the user interface (UI) and the file system for maintaining contacts and other data, it is not limited to those aspects. The Android ROM is built upon a Linux kernel, which serves as the foundation for the operating system. Additionally, the ROM includes various system-level components, libraries, and apps that provide specific functionalities and features.

    ROMs can be developed by device manufacturers (such as HTC, Samsung, or LG) to provide a customized user experience on their devices. They often come with a unique user interface overlay, such as HTC's Sense UI or Samsung's One UI, which can offer additional features and visual enhancements.

    Moreover, ROMs can also be developed by third-party developers or communities, known as custom ROMs. Custom ROMs are modified versions of Android created by independent developers or enthusiast communities. These ROMs are typically designed to offer additional features, customization options, improved performance, or compatibility with older devices that may no longer receive official updates.


    What does a Android Rom Contain ?
    Basically a Android Rom Contains following main things:

    1. Kernel: The kernel is the core of the operating system that manages system resources and facilitates communication between hardware and software.
    2. Bootloader: The bootloader is responsible for initializing the device's hardware and loading the operating system into memory during the boot process.
    3. Recovery: The recovery is a separate bootable partition on the device that allows for system maintenance, installation of updates, and performing backups or restores.
    4. Radio: The radio refers to the software responsible for managing the device's wireless communication, including cellular connectivity.
    5. Framework: The framework consists of a set of libraries and APIs that provide the foundation for application development and interaction with the device's hardware and services.
    6. Apps: Android ROMs typically include pre-installed applications, such as system apps (e.g., dialer, messaging) and other core apps (e.g., calendar, browser), which may vary depending on the ROM.
    7. Core: The core components of the Android operating system, including system services, libraries, and essential system processes.
    8. Android Runtime: The Android Runtime (ART) is the runtime environment responsible for executing Android applications. It converts apps from bytecode into machine code for efficient execution.


    Some Basics About Above Terms

    Kernel

    • The Android kernel is a key component of the Android operating system, serving as the core of the software.
    • It is based on the Linux kernel but includes modifications and additions specific to the Android platform.
    • The kernel provides essential functionalities, such as hardware abstraction, process management, and memory management.
    • It controls the device's hardware resources, including the CPU, memory, storage, and input/output devices.
    • The kernel manages drivers that enable communication between the operating system and hardware components.
    • It facilitates power management, optimizing resource usage to maximize battery life.
    • The kernel handles security mechanisms, such as process isolation and permissions, to protect against unauthorized access.
    • It enables multitasking by scheduling and prioritizing tasks, allowing multiple applications to run simultaneously.
    • The kernel supports various file systems, networking protocols, and device drivers to ensure compatibility with different hardware configurations.
    • Kernel updates are released periodically to improve performance, fix bugs, and address security vulnerabilities.

    Bootloader
    • The Android bootloader is a critical component that starts the boot process on an Android device.
    • It verifies the integrity and authenticity of the software before loading it.
    • The bootloader is responsible for loading the operating system kernel.
    • It initializes essential hardware components, such as the CPU, memory, and display.
    • The bootloader acts as a security checkpoint, preventing unauthorized modifications to the device's software.
    • It ensures the device boots into a trusted and secure state, protecting against malware and unauthorized access.
    • The bootloader provides a means to unlock the device for advanced customization and firmware modifications.
    • Bootloader unlocking allows for installing custom ROMs, kernels, and recovery images.
    • Some devices have locked bootloaders by default to maintain system integrity and prevent unauthorized modifications.

    Recovery
    • Android Recovery is a built-in feature that provides a separate environment for system maintenance and troubleshooting.
    • It is accessed by booting into recovery mode, usually through a combination of hardware buttons during device startup.
    • The recovery mode allows users to perform various tasks, such as applying software updates and factory resetting the device.
    • It provides a limited but essential set of functions to recover or repair a malfunctioning Android system.
    • In recovery mode, users can clear cache partitions to resolve performance issues caused by cached data.
    • It enables users to flash custom ROMs, official firmware updates, and other system modifications.
    • Recovery mode allows for making and restoring system backups, protecting user data and settings.
    • It provides a command-line interface (ADB) for advanced troubleshooting and system-level operations.
    • Recovery mode is separate from the main Android system, ensuring stability even if the main OS encounters problems.

    These are main parts of Android Operating System.

    Now that we know what Android is and what it contains, let's move on to the next major step, which is Android ROM development from source. However, before starting this process, we need to set up some initial setup and development environment.

    Android Rom Development

    Setting Up Linux Enviroment

    Pre – Requirements for Android Rom Development


    1) Linux Operating System (I will use Ubuntu 13.10 as an example and recommend it to all)
    2) Java Development Kit (JDK)
    3) Various Tools

    Once you have downloaded Ubuntu 13.10, you can install it in two ways:
    1) Installing it as the primary operating system
    2) Installing it inside Windows using a virtual machine (VM) or virtualization software like VirtualBox (free) or VM Workstation/Player (paid)
    3) Dual-booting Linux alongside Windows by creating separate partitions

    In this guide, I will explain how to install Linux inside Windows using VirtualBox as an example.



    How to Install Ubuntu in VirtualBox

    1. Download and install Oracle VM VirtualBox on your computer.
    2. Download the Ubuntu ISO file from the official Ubuntu website or the specific version you want to install.
    3. Open VirtualBox and click on New to create a new virtual machine.



    M3QKn8t.png


    4. Enter a name for your virtual machine, select Linux as the type, and choose the version that matches your Ubuntu ISO.


    qw7keQx.png


    b6ACrTD.png


    5. Set the desired amount of RAM for the virtual machine. It's recommended to allocate at least 2GB or more.


    FRx9MXi.png



    6. Create a virtual hard drive by selecting Create a virtual hard disk now. Choose the VDI (VirtualBox Disk Image) option and click Next.


    jLe0HkX.png



    - Select Dynamically allocated and leave the Split into files option unchecked.


    EtrNQrT.png


    - Specify the amount of HDD space you want to allocate and choose the location for the virtual hard drive (VMDK).


    YJci8mw.png

    Q183qwt.png



    7. Go to Settings -> System -> Processor and set the desired number of cores for the Guest OS. In this example, we allocate 2 cores.


    RIODIn7.png



    8. Now, go to Settings -> System -> Acceleration and make sure both options are selected.


    KAbCX0n.png



    9. Next, go to Settings -> Storage -> Controller: IDE and click on the small CD with the plus icon.


    d9Yddtw.png



    - Navigate to the location where you saved the Ubuntu ISO file and select it.
    - Click OK to save the changes.



    5thCPCd.png


    S4bxR0b.png



    10. You can now start the virtual machine by clicking Start.

    11. The Ubuntu installation process will begin, and you can follow the on-screen instructions to complete the installation.

    12. Once the installation is finished, you'll have Ubuntu running in VirtualBox.


    AFgMcaI.png


    85WlRAQ.png


    7gaHrqW.png


    VkZavut.png


    ufrVr8I.png


    ynfGFTB.png


    msCeMV7.png


    That's it! You have successfully installed Ubuntu in VirtualBox.


    Hurrrray your Linux System is Ready!
    279
    Setting Up Build Enviroment For Compiling ROM's

    Installation of Necessary Tools and packages for ROM Development

    1)Installing Java Development Kit (JDK)

    For Kitkat

    Installation of Java V6

    Open The Terminal and Paste following Command

    a) This will Remove the wrong Java JDK from Ubuntu 13.10
    Code:
    [COLOR=#000000]sudo apt-get purge openjdk-\* icedtea-\* icedtea6[COLOR=#007700][COLOR=black]-\*[/COLOR] [/COLOR][/COLOR]


    b) Enter the Following Command and This will Install JDK

    Code:
    wget https://launchpad.net/~webupd8team/+archive/ubuntu/java/+files/oracle-java6-installer_6u45-0%7Ewebupd8%7E8_all.deb sudo dpkg -i oracle-java6-installer_6u45-0~webupd8~8_all.deb wget https://launchpad.net/~webupd8team/+archive/ubuntu/java/+files/oracle-java6-set-default_6u45-0%7Ewebupd8%7E8_all.deb sudo dpkg -i oracle-java6-set-default_6u45-0~webupd8~8_all.deb

    c) Check The Java Version Installed
    Code:
    [COLOR=#000000]java -[COLOR=#0000BB][COLOR=black]version [/COLOR] [/COLOR][/COLOR]

    For Lollipop Required Java Version is 7

    To Install Java V7


    Code:
     sudo apt-get update && sudo apt-get install openjdk-7-jdk

    :DJava Installation Completes:D

    2)
    Installation Of Required Tools
    Enter The Following Command
    Code:
    sudo apt-get install git-core gnupg ccache lzop flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5 lib32z1 lib32bz2-1.0 lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python
    Note : If you get error like broken dependencies then use the following command and then use above command.:D

    Code:
    sudo apt-get update
    Code:
    sudo apt-get upgrade
    After Installation Completes Enter The Following Command
    Code:
    sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
    So The Above Are The Packages

    Now comes the binary called Repo.


    What Is Repo?:rolleyes:

    Repo is a repository management tool that we built on top of Git. Repo unifies the many Git repositories when necessary, does the uploads to our revision control system and automates parts of the Android development workflow.

    Enter The Following Command
    Code:
    mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
    Using Text Editor Open ~/.bashrc for that use following command
    Code:
    sudo nano ~/.bashrc
    At The Very Bottom Line Add following Line
    Code:
    export PATH=~/bin:$PATH
    Save it. Here To save Press Ctrl+O and Enter and Ctrl+X to exit:)
    Now Enter Following Command
    Code:
    source ~/.bashrc

    :cool::cool:Now Your System Is Ready For ROM Building:D:D
    239
    Downloading Sources

    To build a Rom from Source first we need to download the sources from git.
    Note : Sources will be very huge approx 13GB to 14GB hence lot of patience is required since it will take some time depending on your Internet connection speed.

    So lets start..

    Here i will take the example of cm11.
    The steps goes has follows

    1) Create a directory were your sources will be downloaded. Enter the following command to terminal to create a directory

    Code:
    mkdir cm11
    Now in your Home directory you will see folder called cm11.

    1zEeVvZ.png


    2) The next step is you have to Initiate the repo. meaning of the repo is given above. It will communicate with the git and download the source were it is stored.
    Enter The Following Command to Terminal
    Code:
    cd cm11
    This will take you to the directory you created in Step 1.

    8zCZANO.png

    Now Enter The Following Command Which Will Initiate The Repo :laugh:
    Code:
    [FONT=Arial][SIZE=4]repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0[/SIZE][/FONT]


    AH3P62H.png


    MesK53W.png

    Since i m taking example of cm11 above repo initiate command is used you can find this here for CM11
    Note : All the details for Repo Initiate and Building will be given in respective Source Github. Various Github source links will be given in discription and the end.

    This will initialize your local repository using the CyanogenMod trees.:p:D:D
    now got to cm11 folder and press Ctrl+H this will show the hidden folder .repo were sources will be downloaded.

    WSkXUQr.png


    Buqbjst.png

    Now it might give a small error at the end stating for Email id.
    So just create a github account here
    Then Run following in Terminal
    Code:
    [FONT=Arial][SIZE=4]git config --global user.email "you@example.com"
    git config --global user.name "Your Name"[/SIZE][/FONT]


    replace
    "you@example.com" with your github email Id
    replace
    "Your Name" with github Username

    3) Now To control the files that should be downloaded while sync and for adding device tree we use local_manifest.xml. Reagrding this @Kishan14 will explain in detail with Tips and Tricks.

    4) Now it is the time to download the sources. for that run the following Command

    Code:
    repo sync -j#

    #
    is number of jobs you want to give for your downloading source. I use 2 to 4.

    hEbrLC4.png


    dE5oydZ.png

    Now it will download the Sources needed to build the Rom..Download will be huge 13GB to 14GB so be patient since it depends on your Internet Speed.

    The Above was for CM11 same procedure for other provided you have to replace cm11 with one you want to sync/build like AOSP,AOKP,AICP etc and Repo Initialize command varies with the source you want to download.

    Some Git Links :

    CM11 : https://github.com/CyanogenMod/android
    AOKP : https://github.com/AOKP/platform_manifest
    Carbon Rom : https://github.com/CarbonDev/android
    SlimRom : https://github.com/SlimRoms/platform_manifest
    184
    Building Rom For A Particular Device

    Building Rom For A Particular Device

    Now has we have downloaded the sources we need for our Rom Build Lets Move to the Next Step which is Actually Major Step the Building The ROM

    So Lets Start The Game...:laugh::D:D

    Note : I will be taking Samsung Galaxy Grand Duos - GT -I9082 has Example here.
    Example Rom : CM11

    Now before starting with Building guide you have to Download your Device Identity That is has follows
    1) Device Tree
    2) Vendor
    3) Kernel
    The Above files are very Vital Parameters of building they specify your device and its Characteristics.

    Now you might think from where you have to download those files?
    :confused:
    Don't be confused its simple Search in our device forum for CM Tree and Kernel and Vendor. The Dev of CM for your Device forum will specify it in his ROM thread.
    Once you obtain the github for your Device Tree, Vendor and Kernel. Enter following command
    Code:
    cd cm11/.repo
    Y6KmJsy.png

    Here in .repo folder you have to create file called local_manifests.xml
    1) Enter The Following Command in Terminal
    Code:
    nano local_manifest.xml
    mOFUkXi.png

    Structure of Local_manifest.xml is Has follows.
    Code:
    [COLOR=#000000][COLOR=#0000BB]<?xml version[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"1.0" [/COLOR][COLOR=#0000BB]encoding[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"UTF-8"[/COLOR][COLOR=#0000BB]?>
    [/COLOR]<manifest>
      [/COLOR]<project path=" directory in work tree" name="name of the repository in remote" remote="name of remote defined earlier" revision="branch of the repository" /> 
    [COLOR=#000000]</manifest>[/COLOR]
    2) Add your Device , Kernel , Vendor Source
    gHq689W.png


    Taking my Ex here of GT-I9082
    After Adding device tree , Vendor , kernel my Local_manifest.xml will look like has follows
    Code:
    [COLOR=#000000][COLOR=#0000BB]<?xml version[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"1.0" [/COLOR][COLOR=#0000BB]encoding[/COLOR][COLOR=#007700]=[/COLOR][COLOR=#DD0000]"UTF-8"[/COLOR][COLOR=#0000BB]?>
    [/COLOR]<manifest>
      <project path="device/samsung/i9082" name="pawitp/android_device_samsung_i9082" remote="github" revision="cm-11.0" />
      <project path="vendor/samsung/i9082" name="k2wl/android_vendor_samsung_i9082" remote="github" revision="master" />
      <project path="kernel/samsung/i9082" name="pawitp/android_kernel_samsung_i9082" remote="github" revision="cm-11.0" />
    </manifest>[/COLOR]
    ABoaVKn.png

    3) Press ctrl+O and Enter
    DpbtNWp.png


    ZNqRufc.png

    4) Press Ctrl+X to exit.
    Sx5Onvn.png

    After Adding Device Tree,Vendor,Kernel sources just repo sync again so that the files are downloaded. you can also add which files you want to download or you dont want to download. More about manifest and local_manifest will be explained by @Kishan14 in his guide:D

    Once that is done now you have your device Identity with you:laugh::laugh::highfive:
    Now follow the Instruction Given by @rutvikrvr in POST 9 to make the your CM Device Tree Compatible with your ROM Source.

    Once your CM Device tree is successfully made compatible with your ROM its Time for Building :D:cool:
    Now Building Command Various with Rom which you want to compile its different for different ROM you have to see the Manifest of The Rom for it has instruction for building will be given there. Since i m Taking example of CM11 and Device has GT-I9082 the steps goes has follows
    1) Enter the Following command in Terminal
    Code:
    cd cm11
    Just Replace CM11 by your working directory of Rom . Ex : AOGP,AICP etc
    2)Now enter following Command To Terminal
    Code:
    [COLOR=#000000][COLOR=#007700]. [/COLOR][COLOR=#0000BB]build[/COLOR][COLOR=#007700]/[/COLOR][COLOR=#0000BB]envsetup[/COLOR][COLOR=#007700].[/COLOR][COLOR=#0000BB]sh[/COLOR][/COLOR]
    3) Build Instruction Varies from Rom to Rom so check manifest of ROM for the Same. General instuction is
    Code:
    [COLOR=#262626]time brunch <codename>[/COLOR] [COLOR=#000000][COLOR=#007700]-[/COLOR][COLOR=#0000BB]j[/COLOR][COLOR=#FF8000]#[/COLOR][/COLOR]
    <Codename> CodeName of your Device
    # is the No of CPU cores you have.
    Building will take time depending on your system configuration.

    Once building is Done.
    Its Time to apply patches which will be given in our CM Rom thread if any.
    Follow the guide by @rutvikrvr in Post 10 for applying patches.
    Once Done rebuild again using command above (This time building will be fast)

    Now go to your working directory and go to OUT/target/your device/ you will get the Zip of the Rom.
    Always make a backup of your current Rom.
    Flash it via recovery and check.:laugh::laugh:

    :cool::cool:Hurrrrrray You Just Developed A Rom from Source:cowboy::cowboy:
    141
    Uploading Device Tree To Github


    So Guys till now we learnt lot of stuffs and finally we build a Rom :highfive: During building the Rom we may have edited lot of stuffs in device tree :D:D To avoid those being repeated in case you delete the Tree or If your ROM is Unofficial then you have to upload the Device Source Tree to Github. There are lot of uses if you upload the device tree.

    Lets Start with guide Now :D:D

    1) Create a account in Github.

    2) Generate a new SSH key
    Enter Following command to Terminal
    Code:
    ssh-keygen -t rsa -C "your_email@example.com"
    "your_email@example.com" = your github Email ID

    After pressing Enter you will Observe the following output
    Code:
    # Creates a new ssh key, using the provided email as a label
    [LEFT]# Generating public/private rsa key pair.
    # Enter file in which to save the key (/home/you/.ssh/id_rsa):
    Press Enter.[/LEFT]

    Now you need to enter the passphrase
    Code:
    # Enter passphrase (empty for no passphrase): [Type a passphrase] # Enter same passphrase again: [Type passphrase again]
    Once all done you will see the following in your Terminal.

    Code:
    Your identification has been saved in /home/you/.ssh/id_rsa.
    [LEFT]# Your public key has been saved in /home/you/.ssh/id_rsa.pub.
    # The key fingerprint is:
    # 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com
    Now go to ~/.ssh folder and copy your id_rsa.pub content into account administration on github.com.[/LEFT]
    That is go to github account settings and SSH
    copy paste id_rsa.pub content there and save it done.:D:cowboy:

    Now Its Time To Check If Everything Works.:highfive:



    • Enter The Following Command To Terminal
      Code:
      ssh -T git@github.com
    • It should display has follows
      Code:
      The authenticity of host 'github.com (207.97.227.239)' can't be established.
       # RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
       # Are you sure you want to continue connecting (yes/no)?
    • type yes and press enter
      Code:
      Hi username! You've successfully authenticated, but GitHub does not
       # provide shell access.
    Now All Done Its Time To Upload The Device Tree To Github :cowboy:

    Example Device and Rom : GT-I9082 and AOGP Rom.
    In the following steps i take my example device and Rom just replace the device with your device and Rom with your Rom:cool:

    Steps :



    • In Terminal
      Code:
      cd aogp/device/samsung/i9082
    IYwxiGJ.png


    MywR13m.png


    • Then Type Following
      Code:
      git init
    VX7TpL2.png


    ovdAnqa.png


    • Setting up of the git files required to push the files to the github account will be done by following command
      Code:
      git add .
    QA1GZTL.png

    • Now we need to comment on the files we are pushing to github hence enter following command
      Code:
       git commit -m "first commit"
    m6TUgMc.png

    • Now Go to your Github account click on add button on top next to your username and Select New repository
    o9hykDa.png

    • enter the Name of your repository in my case you can see the ScreenShot below
    MJrg5oy.png

    • now you can see some commands displayed enter the git link displayed in your repository created the terminal in my case
      Code:
      git remote add origin https://github.com/username/aogp_device_samsung_i9082.git
    q7GtUIv.png


    1mHEHlS.png


    • Last Step is To Push The Source to Github. Enter The Following Command in Terminal
      Code:
      git push origin master
    lxMlsq0.png


    The Passphrase is the same you entered while creating SSH key.

    06SbxM4.png


    • Finally your source is in Github now add Readme.md File and mention This is <ROM NAME> Device Tree For <Your Device>


    :D:cool:You Have Successfully Uploaded your Device Tree To Github :cowboy::cowboy:


    Credits
    @rutvikrvr
    @Kishan14
    @k2wl (My Mentor and Inspiration for Android)




    If You want to learn more about Github and Stuffs you can visit Following Guide by XDA Senior Moderator @eagleeyetom (Thanks a lot Sir)

    Guide Link : http://xdaforums.com/showthread.php?t=1877040