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

Search This thread

jackeagle

Forum Moderator- Rec Dev - Dev Relations.
Staff member
  • Apr 11, 2013
    3,381
    8,988
    XDA
    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 the open-source operating system used for smartphones. Full Freedom for people using it :D


    What is Android Source Code?

    Android is an open-source software stack created for a wide array of devices with different form factors. The primary purposes of Android are to create an open software platform available for carriers, OEMs, and developers to make their innovative ideas a reality and to introduce a successful, real-world product that improves the mobile experience for users.The result is a full, production-quality consumer product with source code open for customization and porting.
    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 ?
    The Android ROM is the Android operating system. This is the User interface (Sense UI in HTC phones) and the file system for maintaining contacts etc. It is composed of a Linux kernel and various add-ons to achieve specific functionality.

    What does a Android Rom Contain ?
    Basically a Android Rom Contains following main things :
    · Kernel
    · Bootloader
    · Recovery
    · Radio
    · Framework
    · Apps
    · core
    · android-runtime,Etc


    Some Basics About Above Terms

    Kernel :
    A kernel is critical component of the Android and all operating systems. It can be seen as a sort of bridge between the applications and the actual hardware of a device. Android devices use the Linux kernel, but it's not the exact same kernel other Linux-based operating systems use. There's a lot of Android specific code built in, and Google's Android kernel maintainers have their work cut out for them. OEMs have to contribute as well, because they need to develop hardware drivers for the parts they're using for the kernel version they're using. This is why it takes a while for independent Android developers and hackers to port new versions to older devices and get everything working. Drivers written to work with the Gingerbread kernel on a phone won't necessarily work with the Ice Cream Sandwich kernel. And that's important, because one of the kernel's main functions is to control the hardware. It's a whole lot of source code, with more options while building it than you can imagine, but in the end it's just the intermediary between the hardware and the software. So basically if any instruction is given to mobile it first gives the command to kernel for the particular task execution.

    Bootloader :

    The bootloader is code that is executed before any Operating System starts to run. Bootloaders basically package the instructions to boot operating system kernel and most of them also have their own debugging or modification environment. Think of the bootloader as a security checkpoint for all those partitions. Because if you’re able to swap out what’s on those partitions, you’re able to break things if you don’t know what you’re doing. So basically it commands the kernel of your device to Boot the Device properly without any issues. So careful with bootloader since it can mess things very badly.

    Recovery :

    [FONT=&quot]Recovery is defined in simple terms as a source of backup. Whenever your phone firmware is corrupted, the recovery does the job in helping you to restore or repair your faulty or buggy firmware into working condition. It is also used for flashing the Rom’s , kernel and many more things.

    [/FONT]
    Radio[FONT=&quot]
    [/FONT]

    The lowest part of software layer is the radio: this is the very first thing that runs, just before the bootloader. It control all wireless communication like GSM Antenna, GPS etc.


    These are main parts of Android Operating System.

    [FONT=&quot]Now has we know what is Android and What it contains lets move to the Next major step. That is Android Rom Development from Source. But before starting this we need some Initial Setup and development Enviroment .[/FONT]

    Android Rom Development

    Setting Up Linux Enviroment




    Pre – Requirements for Android Rom Development.
    1) Linux Operating System ( I will take Ubuntu 13.10 has Example and also recommend you all)
    2) Java Development Kit (JDK)
    3) Some Tools.

    Once you Download Ubuntu 13.10 you can Install it in 2 ways :
    1) Installing has primary OS
    2) Installing Inside the Windows ( Using VM or VB)
    3) Dual booting Linux alongside Windows. ( Using different Partitions )


    Here I will explain how to Install Linux inside Windows. You can use VirtualBox (Free) or VM Workstation/Player (Paid) Softwares. In this guide I will take example of Virtual Box.

    Pre-requirements

    1) Windows 7 64 bit
    2) Download Virtual Box.
    3) Install the VirtualBox
    4) See that JDK is installed before installing VirtualBox
    5) Ubuntu 13.10 ISO file ( Download it)

    Installing Ubuntu 13.10 In VirtualBox
    I will be using 2 words.
    Guest : Operating System in Virtual Box 64 bit
    Host : Windows 7 .


    Note : Since we need to Install Ubuntu 64bit version Intel VT-x should be enabled else you will not be able to install 64bit. Your processor should support that feature.
    Enabling VT-x.
    1) ShutDown PC.
    2) Boot into SetUp Menu (Bios Settings)
    3) Go to Advanced --> Advanced Processor Options --> Intel(R) Virtualization Technology.
    4) Enable it.
    5) Save the settings.
    6) Reboot

    Installation of Ubuntu 13.10 64bit


    1) Open VirtualBox.

    2) Click on New button



    M3QKn8t.png


    ·3) [FONT=&quot]Type the Name you want to give to this OS which will displayed everytime you open VirtualBox.

    qw7keQx.png


    b6ACrTD.png


    [/FONT] 4) Now you have to set the amount of RAM you want to allocate for your Guest OS. Now this is tricky and Dangerous part. Hey don’t worry !! Its simple :D I will explain this with a simple Example : Think that your PC has 10GB of RAM installed and you have Windows 7 64bit OS (Which u need off course :p ) Now out of 10GB of RAM 4Gb will be needed for your Host to work smoothly. The remaining 6GB can be allotted to work for Virtual Box Guest OS. Now you may have a question in your mind why so much RAM is needed while VB can run in 1 GB too?
    The Answer for this simple that has the RAM for Guest Increases your ROM compiling/building speed too increases drastically. That is the reason RAM is needed a bit more here.
    Now In VirtualBox you can see that green dotted line ending with red dotted line showing how much RAM you are allocating NEVER EVER CROSS GREEN LINE TO RED DOING SO CAN CRASH YOUR PC HAS IT IS THE SAME LIMIT FOR THE WINDOWS TO WORK. SO CAREFULL. It is the Max Amount of Ram you can allocate to VB. But always keep pointer 2 dotes below the RED to Be on safer side. After setting click Next.

    FRx9MXi.png


    5) Now here you have to create virtual drive for you Linux OS and its Files. It’s same has Hard Disk for your Windows PC.Were Linux is installed and RUN.Now click on Create New Virtual Hard Drive Now and click Create button.
    · You will get various formats of Virtual Drives. Always select VMDK Since it is supported by other Softwares like VM Workstation (Paid) . Click Next.


    ED0PEO1.png


    jLe0HkX.png


    · 6) Now you will get a option to select Dynamically Allocated or Fixed Size. Select Dynamically Allocated and don’t tick Split into files option has it will mess everything.


    EtrNQrT.png


    7) Enter the Amount of HDD Space you want to allocate to Virtual Hard Disk. Remember the same amount of space should be there in our Physical hard disk of PC too. (Example : If you select 200GB than your physical drive should have atleast 220GB free storage) . Minimum storage for Virtual Drive for the Android Building is 100GB but I recommend you to keep above 150GB. You will come to know why later. Select the folder/drive in your physical drive were you want to store Virtual hard drive (VMDK) in your physical hard disk of PC.

    YJci8mw.png


    Q183qwt.png


    8) Now click on Settings and Go To System a Processor Now in Processor Drag the Pointer to End of green line That it specifies the no of Cores you want to allocate to Guest OS. It doesn’t effect to host…:D:D In my case its 2.:eek:

    RIODIn7.png


    ·9) Now go to Acceleration tab next to Processor Tab and Tick Both.


    KAbCX0n.png



    10) Now go to the Settings à Storage à Click on Controller: IDE à next to Click on small CD with + icon mark.

    d9Yddtw.png


    · 11) Navigate to Ubuntu 13.10 64 Bit ISO and select it.


    5thCPCd.png


    S4bxR0b.png




    12) Now go to settings --> System --> boot order --> change it CD/DVD First. ( Or you can directly start the system and press F12 select CD/DVD either will work fine)

    SZldi0e.png


    13) Now Click Start Button to start VirtualBox Guest .
    14) Once Ubuntu Starts you can see following screen with 2 option here you can either test or Install just click Install button to start Installation Process.


    AFgMcaI.png


    · 15)Here It will show what things Ubuntu Requires is available or not and some updates and third party installs if you want you can select ( I never selected it) click continue Here It will show what things Ubuntu Requires is available or not and some updates and third party installs if you want you can select.

    85WlRAQ.png


    16) Here it will show how you want to install the Ubuntu let it be default has shown below since this is under VirtualBox. ( In Windows Dual Boot Different Procedure will be there which will be discussed in next part

    7gaHrqW.png


    17) Select Time Zone , keyboard layout .
    18) Enter the details required.


    VkZavut.png


    ufrVr8I.png



    19) Enter the details required.


    ynfGFTB.png


    20) It will ask to log in to Ubuntu one with Email Id just skip it and continue

    UCnqdks.png



    20) Installation Begins wait until it completes

    msCeMV7.png


    Hurrrray your Linux System is Ready


     
    Last edited:

    jackeagle

    Forum Moderator- Rec Dev - Dev Relations.
    Staff member
  • Apr 11, 2013
    3,381
    8,988
    XDA
    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
     
    Last edited:

    jackeagle

    Forum Moderator- Rec Dev - Dev Relations.
    Staff member
  • Apr 11, 2013
    3,381
    8,988
    XDA
    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 "[email protected]"
    git config --global user.name "Your Name"[/SIZE][/FONT]


    replace
    "[email protected]" 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
     
    Last edited:

    jackeagle

    Forum Moderator- Rec Dev - Dev Relations.
    Staff member
  • Apr 11, 2013
    3,381
    8,988
    XDA
    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:
     
    Last edited:

    jackeagle

    Forum Moderator- Rec Dev - Dev Relations.
    Staff member
  • Apr 11, 2013
    3,381
    8,988
    XDA
    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 "[email protected]"
    "[email protected]" = 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
    # Generating public/private rsa key pair.
    # Enter file in which to save the key (/home/you/.ssh/id_rsa):
    Press Enter.

    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.
    # 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 [email protected]
    Now go to ~/.ssh folder and copy your id_rsa.pub content into account administration on github.com.
    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:
    • 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://forum.xda-developers.com/showthread.php?t=1877040
     
    Last edited:

    jackeagle

    Forum Moderator- Rec Dev - Dev Relations.
    Staff member
  • Apr 11, 2013
    3,381
    8,988
    XDA
    Frequently Asked Questions (F.A.Q)

    Following
    are some frequently asked Questions:cowboy::cowboy:

    1) Can I Use Different Linux OS like Linux Mint , Arch linux , Ubuntu 14.04 etc ?
    Yes. you are free to use any Linux System but remember some commands may not work in other Linux System or can result in error hence i cant give support to it. If it was successful to you in Other Linux OS kindly let me know:)

    2) Where is the next part of the Guide?
    This Thread Is Still Work In Progress (WIP) hence we are working on it and will be added once done:)


    3) I got a error for Task X and solved it. Can i share here?
    Yes you can share it with solution (If u have):)

    4) I Got a Error Where Should I Post ?
    You can copy paste the error from terminal to here using Tag or You can Pastebin it. Whichever you are Comfortable with :)

    5) Can I Use 32Bit Linux for Android Development ?
    No You need 64bit Linux System For Android Development:)

    6) Can I use X Device Tree for Y Device (Cloned Etc) ?
    No You Should use your Device Specific Tree not other Device Tree even if they are similar Device/Kernel/Vendor Tree are Specific For Each Devices. So if you dont have it then Either you make your own Tree or wait for developers to do that :)

    7) Are Device Specific Sources Android Version Specific ??
    Yes Device Specific Sources are Version Specific but modification in Source may be little or huge depending on Android Upgrade Feature/Security Enhancement etc etc ...:)

    8) Getting Java Error While Compiling What to do ?
    Its due to Wrong Java for Compiling you need right Version of Java Installed for
    Kitkat : Java v1.6
    Lollipop : Java v1.7

    :)

     
    Last edited:

    jackeagle

    Forum Moderator- Rec Dev - Dev Relations.
    Staff member
  • Apr 11, 2013
    3,381
    8,988
    XDA
    Some Errors and Their Solution
    Set-1 (Thanks @Nikhil)

    1) gr_text

    the line "note : previous declaration of 'gr_text' was here" says that minui.h has declaration of gr_text which is different from definition of gr_text function.
    Solution : check minui.h, 36th line (as intimated in Screenshot) and compare declaration of gr_text with the definition of gr_text in file recovery/graphics.c in device tree. they should be same.

    2) hardware ril

    this generally happens when hardware/samsung is missing some files.

    Solution : enter this in terminal

    cd hardware && git clone https://github.com/SlimRoms/hardware_samsung.git -b kk4.4 && mv hardware_samsung samsung

    you can use Rom specific github link, SlimRoms is an example.

    3) hwc_blit

    "'HWC_BLIT' was not declared in this scope". HWC_BLIT is a variable with value 4 and it is required to be declared

    Solution : there is a file include/hardware/hwcomposer_defs.h in device tree, you can initialize HWC_BLIT as 4.

    4) java version

    From Froyo to Kitkat, version of java required is 1.6
    From Android L, version of jave required will be 1.7

    Screenshot has version 1.8 hence the error.

    Solution : Install Java 1.6

    //Install JDK6
    //Download bin file from http://ghaffarian.net/downloads/Java/JDK/

    //To remove existing java package
    sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*

    //install java JDK6 (download and keep .bin file in root directory.)
    sudo mkdir -p /opt/java/64/
    sudo cp jdk-6u45-linux-x64.bin /opt/java/64
    sudo su -
    cd /opt/java/64
    chmod +x jdk-6u45-linux-x64.bin
    ./jdk-6u45-linux-x64.bin
    exit

    //add JDK path to .bashrc
    gksudo gedit ~/.bashrc

    //add following lines to .bashrc
    # Java PATHs
    export JAVA_HOME=/opt/java/64/jdk1.6.0_45
    export PATH=$PATH:$JAVA_HOME/bin

    //install jre
    sudo apt-get install openjdk-6-jre-headless


    Set-2 ([email protected]
    JJsevol)
    # Errors you might see when you run the build command.
    # Error 1: build/envsetup.sh: line 1365: schedtool: command not found

    SOLUTION: sudo apt-get install schedtool and rerun build command.

    # Error 2: /bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc: cannot execute binary file
    /bin/bash: prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc: cannot execute binary file

    SOLUTION: You're most likely not running a 64-bit linux version. To make sure, type uname -m

    If you see i686, you have a 32-bit version. If you see x86_64, you have a 64-bit version. If you have 32-bit start over with a amd64 version http://releases.ubuntu.com/13.10/

    # Error 3: If you see a 127 bison error

    SOLUTION: sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre phablet-tools pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev

    In addition to the above, do

    sudo apt-get install g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev

    Contributors To The Guide
    @jackeagle
    @Kishan14
    @rutvikrvr
    @k2wl
    @
    Trach

    Credits :
    @k2wl (Thanks A Lot)
    XDA Developers

     
    Last edited:

    Kishan14

    Senior Member
    Nov 23, 2013
    355
    543
    28
    mumbai
    Samsung Galaxy S21 Ultra
    Repo and Manifests
    Hello guys..:D:D
    There are many upcoming developers and many dev on xda.Till now you all have learned how to setup build enviroment and packages required and build process. Now here I will be sharing few tips and tricks that will help some new developer for developing their ROMs and Kernels. Well, I am not pro in all these stuff even I am a newbie. I have came across many guides and my best friend Google.
    These tips may save your Time, Internet Bandwidth, HDD space etc.. :p


    Requirements:

    Basic Knowledge of compiling ROM/kernel:)
    Ok so here I Start::cowboy:


    Repository (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. Repo is not meant to replace Git, only to make it easier to work with Git in the context of Android. The repo command is an executable Python script that you can put anywhere in your path. In working with the Android source files, you will use Repo for across-network operations. For example, with a single Repo command you can download files from multiple repositories into your local working directory
    Was that a bit tough definition.. no worries ... here's Screenshots explaining roughly.
    wAbmCMY.jpg

    The image shown above is repositories (Platform_mainfest,C-Rom Device tree, android etc.)
    In Simple words you can say 'repo is a folder that stores code'. In the above image, the two repo's are highlighted. the black highlighted repo is the one which one have written or contributed. The other (red) one shows that the repo is forked from someone else repo.


    Repo Tool:
    This tool plays a vey important role in downloading rom source.. So the word ‘Repo’ is common with you guys as u do ‘repo init’ ‘repo sync’ ..
    Remember,From the above guide, while setting up you Linux you entered a command
    Code:
    mkdir ~/bin && curl [URL]http://commondatastorage.googleapis.com/git-repo-downloads/repo[/URL] > ~/bin/repo && chmod a+x ~/bin/repo
    In simple language This Step was to download and install the Repo tool..

    Why This Tool is used?:rolleyes:
    The Repo Tool helps you to download the bunch of repositories by entering just a single command, which helps us to make our downloading part easier.:DTo download the source following command is used:
    Code:
    repo sync -j#
    # - number of jobs you want to give for your downloading source.

    Now A question may arise that What does Repo Tool actually do??:confused::D
    Umm, Let me explain with an example, Let's take the above example. The repo tool takes all the reference for the code to be downloaded from a Manifest.xml. Suppose you wanna download cm source. So as mentioned above, you have to give 'repo init' command. after this command '.repo' folder is created. you ll find 'manifest.xml' file in '.repo' folder. Now when you open Manifest.xml file you'll find some path of files and folders. The command 'repo sync' downloads the folders and files that is mentioned in manifest.xml to the specific location mentioned.
    Now, the '-j#' tag represents the number of jobs you allow your pc to download the source. For Normal internet speed it is recommended to use -j2 or -j4. For faster connection -j16 or -j32 is recommended.


    The Manifest
    The manifest.xml is a file which is written in xml markup and directs the repo tool to the repositories and their respective branches that need to be downloaded. This manifest is located under the head of the android source tree in the .repo/manifests/ directory. The manifest is formatted in XML markup and contains information regarding which git repositories to use, where they are located on the internet, where to put them in the source code directory, and what branches of the git repositories are used. Some of these repositories are pulled, unmodified from AOSP, but most come from CyanogenMod on GitHub. We can take repositories from different git servers, use different branches for each one of them, gather them into groups for easy management and more. Here’s an example for a manifest xml file:
    Code:
    <manifest>
      <remote  name="aosp"
               fetch="https://android.googlesource.com/"/>
      <remote  name="aogp"
               fetch="https://github.com/aogp/"/>
    
      <default revision="master"
               remote="aosp"
               sync-j="4" />
    
      <project path="art" name="platform/art" />
      <project path="bionic" name="platform/bionic" groups="pdk" />
      <project path="dalvik" name="platform_dalvik” remote=“aogp”/>
      <project path="frameworks/base" name="platform_frameworks_base" remote=“ aogp" revision=“statusbar_fixes"/>
      <project path="tools/adt/eclipse" name="platform/tools/adt/eclipse" groups="notdefault,tools" />
    </manifest>


    Let’s review its structure and see why it is used :laugh:
    <remote>
    The remote tag is describing the remote git servers we support pulling repositories from. In this case, we have a remote named aosp, linking to the Google’s AOSP git server, and another one named AOGP, linking to a Github account of the user “AOGP”.

    <project>

    Defines a single repository. These are the main attributes:
    path – Where the repository will be checked out into, relative to the current working directory.
    name – The name of the project on our git server
    remote – The name of the remote server where the repository can be found.
    revision – The branch/tag name we want to checkout.
    group – The group name(s) for this project. We can declare a set of projects as members of a group, then sync only them. Omitting this attribute makes the project a member of the “default” group.

    <default>

    Now like the remote is specified , you can base you're manifest at a particular remote and define it as your default remote. it defines a default values for attributes we are using, when syncing the system. In this case, we set the default branch to checkout each project on its “master” branch and the default remote as “aosp”. If we omit those attributes when defining a project, the defaults defined here will be used. Other interesting attributes:

    sync-j

    The value for this will be the number of jobs to use when syncing the system. Parallelization helps get the job done quicker, but could also get the computer or the network stuck. Using 4 threads is what commonly used for syncing.

    sync-c

    syncing only the current branch/tag from git. This will checkout for each project only the current branch/tag that we specify for it, and not any other branches that exists on the repository. This will help save some space and bandwidth (and also time), but if you’ll need to switch between branches on a specific project later on – you’ll need to fetch it manually.


    Local_Manifest :

    If you wanted to change the manifest.xml list, you could edit default.xml directly. However, this would make your local copy of the manifest conflict with the official version on github. This could create issues when the official manifest is updated, as it would clash with your changes.
    :eek:SO NEVER THINK OF EDITING DEFAULT.XML:silly:


    Now The Question Arises how we can control the sync?:rolleyes:

    This is where local manifests come into play.
    Creating a local manifest allows you to customize the list of repositories used in your copy of the source code by overriding or supplementing the default manifest. In this way, you can add, remove, or replace source code in the official manifest with your own. By including repositories (which need not even reside on GitHub) in a local manifest, you can continue to synchronize with the repo sync command just as you would have previously. Only now, both the official repositories from the default manifest and the additional repositories you specify will be checked for updates.
    Hence Local_manifest.xml is BOON to Developers:highfive::cool:

    Uses of Local_manifest.xml:cowboy:

    1) Adding and removing repositories


    To add to the contents of the default manifest, create a file called local_manifests.xml under the .repo directory, this can also be created via terminal by using following steps:

    A) open terminal (Ctrl+Alt+T) and type the following command and hit Enter.
    Code:
     cd path_of_ur_folder/.repo
    B) Type following command
    Code:
    nano local_manifest.xml
    Now type the content you wanna add to local_manifest.xml. After completing press "ctrl+O" and then hit enter to save it. to exit nano editor press "ctrl+X"
    Simple Isn't it?:laugh:

    Let's start with an Example which we can use to describe the scenario:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <manifest>
    
      <remote name="github" fetch="git://www.github.com/" />
    
      <remove-project name="CyanogenMod/android_hardware_qcom_fm" />
    
      <project path="hardware/qcom/fm" name="aogp/hardware/qcom/fm" remote="github" revision="cm-11.0"/>
    
    </manifest>
    Meaning of Above Terms

    1) <?xml version="1.0" encoding="UTF-8"?>
    It is a standard XML declaration, telling interpreters this is an Extensible Markup Language file. Once this is established, the <manifest> and </manifest> tags enclose some contents which the repo command will recognize.

    2) <remote name="github" fetch="git://www.github.com/" />
    First, a remote for git is declared and given the name "github". In git, a remote essentially refers to a place and method for accessing a git repository. In this case, www.github.com contains special up-to-date repositories for fm qcom hardware from "AOGP" platform. This is equivalent to the following git command:
    git remote add github git://www.github.com/

    3) <remove-project name="CyanogenMod/android_hardware_qcom_fm" />
    This line removes a project (specifically, cyanogenmod/android_hardware_qcom_fm) declared in the default manifest. After running repo sync, it will no longer be available in the source tree.

    4) <project path="hardware/qcom/fm" name="aogp/hardware/qcom/fm" remote="github" revision="cm-11.0"/>
    This line defines a new project. In this case, it replaces the removed project android_hardware_qcom/fm with one from other, using the remote that was defined above.

    When adding a new project that replaces an existing project, you should always remove that project before defining the replacement.
    You can simply add a new project to the source code, such as when you want to add your own app to the build.

    Note that when adding new projects, there are at least three parts defined:
    • remote -- the name of the remote. this can be one that was defined in either the default manifest or local_manifest.xml.
    • name -- the name of the git project-- for github it has the format account_name/project_name.
    • path -- where the git repository should go in your local copy of the source code.
    • revision -- (optional) which branch or tag to use in the repository. If this attribute is omitted, repo sync will use the revision specified by the <default ... /> tag in the default manifest.

    After creating .repo/local_manifests.xml, you should be able to repo sync and the source code will be updated accordingly:D:D

    This was all about Repo and Manifest:D
    Now i'm gonna give you some tips that will help you a more better way in developing.!!!


    TIPS AND TRICKS



    Tip#1 Syncing a full new source tree in minutes!

    Suppose you wanna compile multiple roms for device. For example, you may want to have an AOGP source tree as well as a CM tree.
    Obvisouly, you could repeat the same steps, to repo init and then repo sync -j8 for both. But that would be twice as time consuming. isn't it?
    No issues, there is a simple trick to download the source within few minutes(depending on your internet speed). Lets say that you have already initialized and synced a CM source tree, in ~/roms/cm11.
    Now, we will prepare a new repo for AOGP tree, in ~/roms/aogp. Here comes the trick: We will use the --reference flag of repo init to indicate to repo that we already have a local repository that it can take information from, instead of downloading everything from Internet again:
    So Lets say u wanna begin with AOGP, So here's the steps you got to follow :

    Code:
    mkdir  roms/aogp &&cd roms/aogp
    Code:
    repo init --reference=~/roms/cm11 -u git://github.com/AOGP/android.git -b cm-11.0
    You should notice a big time difference, from hours for a full repo sync, down to minutes using this trick!

    Did u understood what it exactly did?
    NO!:p
    here's simple words explaining about reference flags. In this tip (reference flag) the repo tool does it checks the locally downloaded source and skips downloading that it Symlinks the code from the existing source to the new source.


    Tip#2 Using CCACHE a.k.a Compiler's Cache tool

    CCACHE also known as a compiler cache tool, which caches the output of the compiler, to save time when compiling a file which has not been changed since the last compile. It is really a best companion of rom developers
    To enable CCACHE,
    use your favorite editor.. I ll be using nano editor
    1) Open a terminal ( cntrl + alt + t ) and type
    Code:
    nano .bashrc
    2) Add the following code :
    Code:
    export USE_CCACHE=1
    After you log out and back in again, this change will take effect.
    By default, the Android build process creates a subfolder named “out” within the root of your source tree. While for most users this is best, in some situations it can be advantageous to move the output directory to another file system. If, for example, you have a striped RAID array, it is beneficial to store the output directory on this array. All of the files within the out directory can be re-generated in the event of filesystem problems (if the sources were held on another filesystem).
    To change the output directory to another filesystem, use the command
    Code:
    export OUT_DIR_COMMON_BASE= /<path_of_your_choice>/.ccache
    Code:
    prebuilts/misc/linux-x86/ccache/ccache -M 50G
    The suggested cache size is 50-100G.

    On OSX, you should replace linux-x86 with darwin-x86

    The above defined output directory will created a new folder, named after your current source tree directory. For instance, if you have source trees as /source/tree1 and /source/tree2 and OUT_DIR_COMMON_BASE is set to /output, then output directories will be/output/tree1 and /output/tree2.
    It is therefore important to ensure you do not have multiple sources stored in directories with the same name, as they would end up sharing an output directory, with unpredictable results.


    Tip#3 Playing with local_manifest.xml

    In many Manifest.xml you ll find many stuff not needed by our device. Also there are files needed and that is not present in the default.xml.

    * Adding Projects to local_manifest.xml

    So, to add projects to your local_manifest.xml for your device refer the following format that explains the same.
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <manifest>
    
    <project path=" directory in work tree" name="name of the repository in remote" remote="name of remote defined earlier" revision="branch of the repository" />
    
    </manifest>
    Still have some doubts?? the following example will clear it.. ;)
    Suppose i wanna add device tree, kernel and vendor for my device which is needed in Building ROM Guide Above i ll follow the above format and will make a new one for my device.
    Device Example Used Here : Samsung Galaxy Grand Duos GT-I9082
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <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>
    This will download your device Identity needed for Rom Building:cowboy::cowboy:


    * Remove Unwanted Stuff From default.xml

    As I mentioned above the command for removing project, you can use that command to remove the unwanted stuff from default.xml
    As majority of the people here are using Linux. As dawin tool chains are used by MAC OS, So darwin tool chains and darwin packages are useless for linux users. You can remove the same by using remove project command.
    For Example :

    Code:
    <project path="prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6" name="platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6" groups="pdk,darwin,arm" />
    <project path="prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.6" name="platform/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.6" groups="pdk,darwin,arm" />
    <project path="prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.6" name="platform/prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.6" groups="pdk,darwin,mips" />
    <project path="prebuilts/gcc/darwin-x86/x86/i686-linux-android-4.6" name="platform/prebuilts/gcc/darwin-x86/x86/i686-linux-android-4.6" groups="pdk,darwin,x86" />

    SLxmL6P.png


    Before Removing Darwin Lines see below
    L6cOkti.png


    After Removing Darwin Lines
    DfTCgsV.png


    From above you can notice earlier there were 462 projects to be downloaded but after removing darwin lines its slimmed to 444 projects.
    Less projects to download sync completes faster:D:D

    *Remove all the official device not required by you for compiling.

    There will be many devices that are officially supported by ROM developers and there Tree will be added to Default.xml which are useless for your device.
    The device may be in the following format
    Code:
    android_device_companyname_codename
    For Example :

    Code:
    android_device_samsung_codename
    *Similarly Remove all the kernel source not required by you as it will take more time and your precious bandwidth.
    * Remove all unnecessary vendor trees from the manifest.. Why do you need the blobs for a device you are not building for !!
    :cowboy::D
    Hope these tips helps you a lot...!!! :D:D
    Any doubts.. post on this thread.. !!:)

    credits:; @Jacleagle for editing and screenshots.. :D
     
    Last edited:

    RVR

    Recognized Contributor
    Making CM Device Tree Compatible With Your Rom For Compiling




    Now has we know that how to download sources the next step is to compile the source for your mobile. But Some modification are needed to compile.

    There are many devices with just CM.... but the cm device tree has to be modified to compile with other roms .. .

    This guide will tell u specific to slimroms and will give u an idea in general ... i will be taking Galaxy Grand Duos as an example

    IF YOU ARE BUILDING FOR ANOTHER DEVICE , SIMPLY RENAME i9082 to the name of your device AND SLIM TO WHICHEVER ROM YOU ARE BUILDING .

    Ok Now lets start with it.



    There are mainly 3 files in CM Tree Which Should Be Modified They are,

    1) cm.mk

    2) cm.dependencies

    3) AndroidProducts.mk



    The Image below shows the general device tree .... the 3 files marked in red are the files that have to be edited .




    JrYWMWc.png




    1) Rename cm.mk to slim.mk

    The Image Below Shows The Differences Between The CM.MK AND SLIM.MK




    dRsFEiJ.png




    As You can see That WE HAVE JUST REPLACED CM WITH SLIM AND ADDED THE BOOTANIMATION PATH ( THE BOOTANIMATION PATH IS NOT ReQUIRED IN ALL ROMS... ONLY SLIMROMS,VANIRAOSP,LIQUIDSMOOTH AND SOKP REQUIRE THIS)

    The Boot Animation Values Have To Be Changed As Per YOUR DEVICE RESOLUTION

    FOR EXAMPLE IF UR SCREEN IS HD (XHDPI) THEN IT SHOULD BE AS FOLLOWS



    Code:
    # Bootanimation
    
    TARGET_SCREEN_HEIGHT := 1280
    
    TARGET_SCREEN_WIDTH := 720
    
    PRODUCT_COPY_FILES += \
    
         vendor/slim/prebuilt/common/bootanimation/720.zip:system/media/bootanimation.zip
    Now you all must be thinking why did we rename cm.mk to slim.mk.:rolleyes::confused:

    A Simple Answer is we go to the vendor folder and check the name and replace it. ( SOME ROM's MIGHT GIVE AN ERROR)


    vPCkeWp.png


    ...for example in vaniraosp if you rename cm.mk to vanir.mk

    A78r30r.png



    IN SUCH A CASE SIMPLY RENAME THE "cm.mk" to "vanir_i9082.mk" and your problem is sorted :D Simple isn't it:cool:




    So now you must be wondering about the product name ...as in the above image only the "cm" changes to "slim" with the same logic of the vendor name







    In this case we see that slim is the vendor ...so we rename the cm.mk to slim.mk

    this same rule applies to the content inside the slim.mk too ... we first make sure that the files are available in that location .




    Omkh0B2.png


    As you can see the image above the files exist in the vendor/slim/config.. so that means we are moving on the right track

    NOTHING ELSE NEEDS TO BE TOUCHED IN THIS FILE :D SO NOW 33.33% OF OUR DEVICE TREE IS READY FOR COMPILING WITH THE SLIMROM SOURCE :p:laugh:



    2) Now we have to move second file "cm.dependencies"



    This file will be simply renamed by Vendor Name ...

    In This Case "slim" ....so we rename it to "slim.dependencies"

    SO NOW 66.66% COMPLETED :p:D



    3) The Last And The Final Change Required Is In The "AndroidProducts.mk"

    In This File you Simply Rename The " device_i9082.mk" to whatever you renamed the "cm.mk" to . in this case it is "slim.mk" so "device_i9082.mk" will be renamed to "slim.mk" check the image below to understand better



    ywCpCYX.png






    Hurrrray :D:DNOW OUR DEVICE TREE IS FULLY COMPATIBLE WITH THE SLIMROM SOURCE.



    ALL THE BEST!!!!!!
    :laugh::laugh:













    CREDITS



    A BIG THANX TO @k2wl and @xenon92 ...THE ONLY REASON I STARTED DEVELOPMENT :p:highfive:

     
    Last edited:

    RVR

    Recognized Contributor
    How to apply patches to the source ?

    There are many devices that need patches for the core functions to work . So in this guide i will be talking about applying patches from github and the Gerrit Code Review HERE AGAIN I WILL BE TAKING I9082 AS AN EXAMPLE
    I) APPLYING PATCHES FROM THE GERRIT CODE REVIEW .
    NOTE: IF THE ROM YOU ARE COMPILING IS BASED ON CYANOGENMOD AND THE COMMIT IS MERGED ... THEN THE PATCH DOESNT HAVE TO BE APPLIED

    this is how a gerrit code review typically looks . To apply a patch from here ...

    STEP 1: You first have to click on patch and then copy the link
    QOFPSIa.png


    STEP 2:In your terminal navigate to the place it has to be applied (in this case the path is "frameworks/native")
    ENnflxl.png


    as you can see the command boxed in blue .. it should look somewhat similar
    I2kRqEC.png

    after the patch is applied it asks for an input to continue ... in such a case simply press "q"

    CONGRATULATIONS YOU HAVE APPLIED THE PATCH FROM THE GERRIT CODE REVIEW!!!



    NOW WE MOVE ON TO APPLYING PATCHES DOWNLOADED FROM GITHUB GISTS
    (GENERALLY THE FORMAT IS ".diff" or ".patch")


    STEPS TO BE FOLLOWED
    STEP1: DOWNLOAD THE GIST

    You can simply download the gist as shown in the image below
    FshLFP4.png


    THIS IS HOW A PATCH TYPICALLY LOOKS
    vaFOWux.png

    these patches are used generally for unofficial cm ports or official devices of cm for other roms not based on CM
    Generally the CM devs write which location has to be patched .... otherwise simply use the search bar To apply the patch above we first have to enter the hardware/broadcom/libbt folder

    STEP 2: We then copy, the file that we downloaded earlier, to the folder that has to be patched in this case hardware/broadcom/libbt


    STEP 3: APPLYING THE PATCH


    Code:
     cd nameoftheromfolder/hardware/broadcom/libbt
     git checkout . 
    patch -p1 < nameofthefile.diff or nameofthefile.patch

    It should look something like this

    5W0ZC98.png

    ITS AS SIMPLE AS THIS ..... ALL THE BEST !!! HOPE THIS GUIDE HELPS ... IF YOU HAVE ANY ISSUES OR QUESTIONS PLEASE POST IT HERE ...SO I CAN HELP :-d


    THANX TO CYANOGENMOD , PAWITP ,K2WL AND XENON92
     
    Last edited:

    Trach

    Member
    Jul 7, 2014
    36
    113
    Git Knowledge

    Before i start,i would like to express my gratitude to GitSCM,Github and others who have provided a learning platform for everyone to use Git and learn Git :)

    If any information was stated wrongly here,please correct me and I am open to suggestions and criticism :p

    First of all,let's start off with the basics

    git init
    - The git init command is used to create a new git repository in your folder.It can be used to convert an existing, unversioned project to a Git repository or initialize a new empty repository.When the command git init is being executed,in the folder itself,it will create a .git subdirectory and in order to view the sub directory,you need to hold CTRL+H to view it.In the .git subdirectory itself contains the metadata for the repo.

    git clone
    - The git clone command is used to copy an existing Git repository into your folder.The cloned repository will contain all its own history and manages its own files,and its a totally isolated environment from the original repository.Important note: This is where we should always remember to keep authorship when you clone something and upload to your own github.Always remember to keep the history commits when you upload.The tutorial is here(With courtesy to @Mazda)

    git add
    - The git add adds a change in the working directory to the staging area.Normally once it is added,it doesnt really get recorded yet until you execute the command git commit.Therefore,if you need to manage your files,execute git status to view the file changes.The various commands are

    Stages the changes that was made in the file
    Code:
    git add <file>

    Stages the changes that was made in a folder/directory
    Code:
    git add <directory/folder>

    git commit
    - The git commit command stages the snapshot to the project.This command is used after the command git add is executed and the git commit command will do the job in recording the changes you have made and sending it to the project history which will then be uploaded into Github or BitBucket.Some commands that normally developers use

    The -m stands for message in full term --message
    Code:
    git commit -m "Hello"

    The -a command is used to tell Git to stage all file changes,be it modified or deleted.Everything is added
    Code:
    git commit -a

    The --reset-author command is used to change back to its original committer if the commits authorship have been changed
    Code:
    git commit --reset-author


    More is coming soon! :)
     
    Last edited:

    Top Liked Posts

    • There are no posts matching your filters.
    • 443
      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 the open-source operating system used for smartphones. Full Freedom for people using it :D


      What is Android Source Code?

      Android is an open-source software stack created for a wide array of devices with different form factors. The primary purposes of Android are to create an open software platform available for carriers, OEMs, and developers to make their innovative ideas a reality and to introduce a successful, real-world product that improves the mobile experience for users.The result is a full, production-quality consumer product with source code open for customization and porting.
      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 ?
      The Android ROM is the Android operating system. This is the User interface (Sense UI in HTC phones) and the file system for maintaining contacts etc. It is composed of a Linux kernel and various add-ons to achieve specific functionality.

      What does a Android Rom Contain ?
      Basically a Android Rom Contains following main things :
      · Kernel
      · Bootloader
      · Recovery
      · Radio
      · Framework
      · Apps
      · core
      · android-runtime,Etc


      Some Basics About Above Terms

      Kernel :
      A kernel is critical component of the Android and all operating systems. It can be seen as a sort of bridge between the applications and the actual hardware of a device. Android devices use the Linux kernel, but it's not the exact same kernel other Linux-based operating systems use. There's a lot of Android specific code built in, and Google's Android kernel maintainers have their work cut out for them. OEMs have to contribute as well, because they need to develop hardware drivers for the parts they're using for the kernel version they're using. This is why it takes a while for independent Android developers and hackers to port new versions to older devices and get everything working. Drivers written to work with the Gingerbread kernel on a phone won't necessarily work with the Ice Cream Sandwich kernel. And that's important, because one of the kernel's main functions is to control the hardware. It's a whole lot of source code, with more options while building it than you can imagine, but in the end it's just the intermediary between the hardware and the software. So basically if any instruction is given to mobile it first gives the command to kernel for the particular task execution.

      Bootloader :

      The bootloader is code that is executed before any Operating System starts to run. Bootloaders basically package the instructions to boot operating system kernel and most of them also have their own debugging or modification environment. Think of the bootloader as a security checkpoint for all those partitions. Because if you’re able to swap out what’s on those partitions, you’re able to break things if you don’t know what you’re doing. So basically it commands the kernel of your device to Boot the Device properly without any issues. So careful with bootloader since it can mess things very badly.

      Recovery :

      [FONT=&quot]Recovery is defined in simple terms as a source of backup. Whenever your phone firmware is corrupted, the recovery does the job in helping you to restore or repair your faulty or buggy firmware into working condition. It is also used for flashing the Rom’s , kernel and many more things.

      [/FONT]
      Radio[FONT=&quot]
      [/FONT]

      The lowest part of software layer is the radio: this is the very first thing that runs, just before the bootloader. It control all wireless communication like GSM Antenna, GPS etc.


      These are main parts of Android Operating System.

      [FONT=&quot]Now has we know what is Android and What it contains lets move to the Next major step. That is Android Rom Development from Source. But before starting this we need some Initial Setup and development Enviroment .[/FONT]

      Android Rom Development

      Setting Up Linux Enviroment




      Pre – Requirements for Android Rom Development.
      1) Linux Operating System ( I will take Ubuntu 13.10 has Example and also recommend you all)
      2) Java Development Kit (JDK)
      3) Some Tools.

      Once you Download Ubuntu 13.10 you can Install it in 2 ways :
      1) Installing has primary OS
      2) Installing Inside the Windows ( Using VM or VB)
      3) Dual booting Linux alongside Windows. ( Using different Partitions )


      Here I will explain how to Install Linux inside Windows. You can use VirtualBox (Free) or VM Workstation/Player (Paid) Softwares. In this guide I will take example of Virtual Box.

      Pre-requirements

      1) Windows 7 64 bit
      2) Download Virtual Box.
      3) Install the VirtualBox
      4) See that JDK is installed before installing VirtualBox
      5) Ubuntu 13.10 ISO file ( Download it)

      Installing Ubuntu 13.10 In VirtualBox
      I will be using 2 words.
      Guest : Operating System in Virtual Box 64 bit
      Host : Windows 7 .


      Note : Since we need to Install Ubuntu 64bit version Intel VT-x should be enabled else you will not be able to install 64bit. Your processor should support that feature.
      Enabling VT-x.
      1) ShutDown PC.
      2) Boot into SetUp Menu (Bios Settings)
      3) Go to Advanced --> Advanced Processor Options --> Intel(R) Virtualization Technology.
      4) Enable it.
      5) Save the settings.
      6) Reboot

      Installation of Ubuntu 13.10 64bit


      1) Open VirtualBox.

      2) Click on New button



      M3QKn8t.png


      ·3) [FONT=&quot]Type the Name you want to give to this OS which will displayed everytime you open VirtualBox.

      qw7keQx.png


      b6ACrTD.png


      [/FONT] 4) Now you have to set the amount of RAM you want to allocate for your Guest OS. Now this is tricky and Dangerous part. Hey don’t worry !! Its simple :D I will explain this with a simple Example : Think that your PC has 10GB of RAM installed and you have Windows 7 64bit OS (Which u need off course :p ) Now out of 10GB of RAM 4Gb will be needed for your Host to work smoothly. The remaining 6GB can be allotted to work for Virtual Box Guest OS. Now you may have a question in your mind why so much RAM is needed while VB can run in 1 GB too?
      The Answer for this simple that has the RAM for Guest Increases your ROM compiling/building speed too increases drastically. That is the reason RAM is needed a bit more here.
      Now In VirtualBox you can see that green dotted line ending with red dotted line showing how much RAM you are allocating NEVER EVER CROSS GREEN LINE TO RED DOING SO CAN CRASH YOUR PC HAS IT IS THE SAME LIMIT FOR THE WINDOWS TO WORK. SO CAREFULL. It is the Max Amount of Ram you can allocate to VB. But always keep pointer 2 dotes below the RED to Be on safer side. After setting click Next.

      FRx9MXi.png


      5) Now here you have to create virtual drive for you Linux OS and its Files. It’s same has Hard Disk for your Windows PC.Were Linux is installed and RUN.Now click on Create New Virtual Hard Drive Now and click Create button.
      · You will get various formats of Virtual Drives. Always select VMDK Since it is supported by other Softwares like VM Workstation (Paid) . Click Next.


      ED0PEO1.png


      jLe0HkX.png


      · 6) Now you will get a option to select Dynamically Allocated or Fixed Size. Select Dynamically Allocated and don’t tick Split into files option has it will mess everything.


      EtrNQrT.png


      7) Enter the Amount of HDD Space you want to allocate to Virtual Hard Disk. Remember the same amount of space should be there in our Physical hard disk of PC too. (Example : If you select 200GB than your physical drive should have atleast 220GB free storage) . Minimum storage for Virtual Drive for the Android Building is 100GB but I recommend you to keep above 150GB. You will come to know why later. Select the folder/drive in your physical drive were you want to store Virtual hard drive (VMDK) in your physical hard disk of PC.

      YJci8mw.png


      Q183qwt.png


      8) Now click on Settings and Go To System a Processor Now in Processor Drag the Pointer to End of green line That it specifies the no of Cores you want to allocate to Guest OS. It doesn’t effect to host…:D:D In my case its 2.:eek:

      RIODIn7.png


      ·9) Now go to Acceleration tab next to Processor Tab and Tick Both.


      KAbCX0n.png



      10) Now go to the Settings à Storage à Click on Controller: IDE à next to Click on small CD with + icon mark.

      d9Yddtw.png


      · 11) Navigate to Ubuntu 13.10 64 Bit ISO and select it.


      5thCPCd.png


      S4bxR0b.png




      12) Now go to settings --> System --> boot order --> change it CD/DVD First. ( Or you can directly start the system and press F12 select CD/DVD either will work fine)

      SZldi0e.png


      13) Now Click Start Button to start VirtualBox Guest .
      14) Once Ubuntu Starts you can see following screen with 2 option here you can either test or Install just click Install button to start Installation Process.


      AFgMcaI.png


      · 15)Here It will show what things Ubuntu Requires is available or not and some updates and third party installs if you want you can select ( I never selected it) click continue Here It will show what things Ubuntu Requires is available or not and some updates and third party installs if you want you can select.

      85WlRAQ.png


      16) Here it will show how you want to install the Ubuntu let it be default has shown below since this is under VirtualBox. ( In Windows Dual Boot Different Procedure will be there which will be discussed in next part

      7gaHrqW.png


      17) Select Time Zone , keyboard layout .
      18) Enter the details required.


      VkZavut.png


      ufrVr8I.png



      19) Enter the details required.


      ynfGFTB.png


      20) It will ask to log in to Ubuntu one with Email Id just skip it and continue

      UCnqdks.png



      20) Installation Begins wait until it completes

      msCeMV7.png


      Hurrrray your Linux System is Ready


      271
      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
      236
      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 "[email protected]"
      git config --global user.name "Your Name"[/SIZE][/FONT]


      replace
      "[email protected]" 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
      181
      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:
      139
      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 "[email protected]"
      "[email protected]" = 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
      # Generating public/private rsa key pair.
      # Enter file in which to save the key (/home/you/.ssh/id_rsa):
      Press Enter.

      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.
      # 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 [email protected]
      Now go to ~/.ssh folder and copy your id_rsa.pub content into account administration on github.com.
      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:
      • 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://forum.xda-developers.com/showthread.php?t=1877040
    Our Apps
    Get our official app!
    The best way to access XDA on your phone
    Nav Gestures
    Add swipe gestures to any Android
    One Handed Mode
    Eases uses one hand with your phone