[GUIDE] Develop NOW! 3rd Edition - How To Build ROMs, Kernels, and MODs [Hercules]

Search This thread

ryancnap

Senior Member
Aug 3, 2012
231
25
Bloomsburg
ryancnap.net
What I do when building slim :

- repo init
-repo sync

If you want to make changes to a particular repository ( for instance framework_base), what I did was fork that repo from slim to my github. You make the changes to your working directory ( cherry-picking or whatever), commit and push the changes to your forked repo. Don't forget to edit the default_manifest.xml and point it to your forked repo ( it will then sync the repo and fetch your forked frameworks_base repo instead of the slim one).

Edit : to update slim changes, add the original repo as a remote and git pull NameYouGaveToRemote branchYourWorkingOn to update your local repo and then git push to upload it to your github.

thank you so much for this, I never thought to go about it this way. so git pull would only grab whatever was updated that wasn't in my local repo? one thing I'm still puzzling over; if I were to commit my changes and push to my forked repo, wouldn't git pulling from the original and then pushing to upload to my github as you said overwrite whatever commits I had previously pushed to my forked repo?
 

Florendroid

Senior Member
Feb 3, 2012
203
352
Vancouver
thank you so much for this, I never thought to go about it this way. so git pull would only grab whatever was updated that wasn't in my local repo? one thing I'm still puzzling over; if I were to commit my changes and push to my forked repo, wouldn't git pulling from the original and then pushing to upload to my github as you said overwrite whatever commits I had previously pushed to my forked repo?

No your commits will still be there. It only updates your repo with whatever changes they made to the original one, keeping your commits.

Sent from my SAMSUNG-SGH-T989 using xda app-developers app
 
  • Like
Reactions: ryancnap

dginsd

Senior Member
Jan 23, 2012
279
56
Hope this isn't a too stupid a question but I can't seem to figure how to copy and paste the terminal commands to install the dependencies in Ubuntu. Java 6 or 7 installation and some of the commands listed are quite long to input manually. Also is it entirely necessary to have Oracle java, I already have openJDK 6 and 7 installed on my machine?
 

Cl3Kener

Senior Member
Feb 4, 2013
71
7,001
Cleveland, OH
plus.google.com
Hope this isn't a too stupid a question but I can't seem to figure how to copy and paste the terminal commands to install the dependencies in Ubuntu. Java 6 or 7 installation and some of the commands listed are quite long to input manually. Also is it entirely necessary to have Oracle java, I already have openJDK 6 and 7 installed on my machine?

1) You have to right click inside the terminal window and click paste. You can't use the keyboard shortcuts unfortunately. Terminal is funny like that and it only likes it when you copy and paste using the mouse.

2) OpenJDK regardless of the version will not work and your build will fail within the first 30 seconds guarenteed (even if you override warnings and force the build). Your safest bet is to install Sun Java 6 since that is the only one supported by all platforms although I have both 6 and 7 and use the command "sudo update-alternatives --config javac" to manually flip flop back and forth between versions. (I also purge openjdk to make it less confusing when switching versions)
 

dginsd

Senior Member
Jan 23, 2012
279
56
I tried manually selecting and pasting but it seems to insert <returns> in the middle of commands making the terminal see a $'piece of the command' <return> error, $'next piece of command' <return> error etc.
 

ghajj

Member
Mar 31, 2011
28
2
Error after running make

I am getting this error I have done the JAVA installation procedure twice. There must be something I am missing.

MYROM/out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes.jar] Error 41

I searched. All I could find is eitehr about openJDK or some path issues. java and javac executes fine from the cmdline.

Thanks in advance
 

mondaza

Senior Member
Mar 23, 2012
514
81
I want to put Linaro to AOSP. If I follow the tutorial, I put my discharge in place in / prebuilts and modify envsetup, I can build the rom. But I'm sure it does with the old gcc, because if I remove it gives me errors. Can anyone help?
 

Cl3Kener

Senior Member
Feb 4, 2013
71
7,001
Cleveland, OH
plus.google.com
I want to put Linaro to AOSP. If I follow the tutorial, I put my discharge in place in / prebuilts and modify envsetup, I can build the rom. But I'm sure it does with the old gcc, because if I remove it gives me errors. Can anyone help?

@mondaza

That "old" gcc is still used for compiling many things. For the record, LINARO only builds a small portion of the ROM. We use linaro to optimize bionic and dalvik files and such. There is actually a more advanced way to use linaro to build the entire ROM but it causes problems with most devices. Using linaro in this fashion there are virtually no problems with most devices. If you really want to use linaro for everything possible try grepping "androideabi" and replacing any reference with linaro instead. Be aware that even if it compiles correctly some things might not work right.
 
  • Like
Reactions: mondaza

Cl3Kener

Senior Member
Feb 4, 2013
71
7,001
Cleveland, OH
plus.google.com
Hey Everyone,

Good news!

I've almost completed Develop Now 3rd Edition. To make it more generic I cut out the building section and have been adding either more details or more tricks I've picked over the past few months. I will be posting soon but first I wanted to share with you a post I made showing an example of how I use bash scripts to compile kernels. Make sure to thank Ayysir while you're over visiting his thread. Here is the link to the bash script tutorial http://xdaforums.com/showpost.php?p=49684209&postcount=4

Cheers!
Cl3Kener
 

Cl3Kener

Senior Member
Feb 4, 2013
71
7,001
Cleveland, OH
plus.google.com
Hey Everyone,

So I finished updating the manual and you can find it posted on the OP. Let me know if you see any typos introduced by me reordering sections and rewriting things. Now you have my latest knowledge with changes in how I approach git now that I know more commands and how I approach developement in general. If there is something that you've seen me do that you don't quite understand from reading this shoot me a PM and we'll either add it to the guide or I'll just send you an explanation.

Enjoy the new update!

Cheers!
Cl3Kener
 
Last edited:

romuloxiii

Senior Member
Wow, this is a great guide!! Thank you for this. Your guide has been very helpful for me with regards to some of the git commands such as cherry picking, how to use a differen toolchain during the build, as well as others. This is definitely the most comprehensive guide I have seen yet.

Thanks!!
 
  • Like
Reactions: Cl3Kener

12packabs

Senior Member
Sep 27, 2012
392
188
Halifax, NS
Thanks for this guide! I've been building for a while but am now wanting to pull some features from one ROM into another.

What is the best way to find the commits I need in the source ROM? I want to add lockscreen notifications to Slim. Probably from PA. Any guidance would be appreciated.
 

soccerfan6789

Senior Member
Nov 21, 2012
542
593
27
New York
Thanks for this guide! I've been building for a while but am now wanting to pull some features from one ROM into another.

What is the best way to find the commits I need in the source ROM? I want to add lockscreen notifications to Slim. Probably from PA. Any guidance would be appreciated.

Alright so your base is Slim. Cherry-picking from PA would be hard because you'll encounter tons of problems and errors. If you really want it, you're going to have to add in the lines of code that's modified manually. Some files are AOSP and are untouched so that'll be easy but majority of them will be different. Also, there might be some code previously done and you'll have to find those commits and incorporate them as well. It's time consuming and difficult but if you do it right, it's rewarding.

Sent from my Nexus 5 using XDA Premium 4 mobile app
 
  • Like
Reactions: 12packabs

12packabs

Senior Member
Sep 27, 2012
392
188
Halifax, NS
Thanks for your reply. Good point about PA. I know Carbon has them is also based on AOSP so that might be easier. Just struggling with how to find the features in the source and then identify the commits I need. I'll keep digging.

Alright so your base is Slim. Cherry-picking from PA would be hard because you'll encounter tons of problems and errors. If you really want it, you're going to have to add in the lines of code that's modified manually. Some files are AOSP and are untouched so that'll be easy but majority of them will be different. Also, there might be some code previously done and you'll have to find those commits and incorporate them as well. It's time consuming and difficult but if you do it right, it's rewarding.

Sent from my Nexus 5 using XDA Premium 4 mobile app
 

roshan2989

Senior Member
Apr 10, 2012
829
189
Purgatory
hi guys i successfully compiled my homemade cm11,so the next step is cherry pick..as i download the pdf file and read it which clearly understand..so im a newbie here,just wanna ask where to find the cherry pick for TRDS (the real dark slim) kit kat,...help would be appreciated..
 

soccerfan6789

Senior Member
Nov 21, 2012
542
593
27
New York
hi guys i successfully compiled my homemade cm11,so the next step is cherry pick..as i download the pdf file and read it which clearly understand..so im a newbie here,just wanna ask where to find the cherry pick for TRDS (the real dark slim) kit kat,...help would be appreciated..

Read what I just said ^^. But again, it'll be hard and I don't mean to be mean but it'll be difficult if you lack experience and I know you'll get a ton of errors. But if you want to do it, first find the commits that you need. They should be in frameworks/base and packages/apps/Settings.

git remote add ...
git fetch ...
git cherrypick ...
 

brajesh.sharma87

Senior Member
Jan 27, 2011
2,092
2,837
Kolkata
@soccerfan6789 I have built aosp for my nexus 4. I tried doing some basic cherry picking from cm and pa (those which I thought wont have conflict) just to check whether I am going in right direction and it went well.

Now I want to move forward. Lets say I want to add Notification LED control. So for that I need to pick these commits.


First into package/apps/settings: https://github.com/AOSPA/android_pa...mmit/6b6632a3a6fe4f944819be0af67a5e65dbdead5a

Second into frameworks/base: https://github.com/AOSPA/android_frameworks_base/commit/47114889dbc722d3cd31378f47ddd1b025bf0e86


Now, as I do the first cherry pick, I get error, upon running 'git status' I see this:

Code:
brajesh@Brajesh-Sharma:~/android/aosp-kitkat/packages/apps/Settings$ git cherry-pick 6b6632a3a6fe4f944819be0af67a5e65dbdead5a
error: could not apply 6b6632a... Notification LED Control (2/2).
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'
brajesh@Brajesh-Sharma:~/android/aosp-kitkat/packages/apps/Settings$ git status
# Not currently on any branch.
# You are currently cherry-picking.
#   (fix conflicts and run "git commit")
#
# Changes to be committed:
#
#[COLOR="DarkGreen"]	new file:   res/layout/dialog_light_settings.xml
#	new file:   res/layout/preference_application_light.xml
#	new file:   res/layout/pulse_time_item.xml
#	new file:   res/values/pa_arrays.xml
#	modified:   res/xml/display_settings.xml
#	new file:   res/xml/notification_light_settings.xml
#	modified:   src/com/android/settings/DisplaySettings.java
#	new file:   src/com/android/settings/notificationlight/AlphaPatternDrawable.java
#	new file:   src/com/android/settings/notificationlight/ApplicationLightPreference.java
#	new file:   src/com/android/settings/notificationlight/ColorPanelView.java
#	new file:   src/com/android/settings/notificationlight/ColorPickerView.java
#	new file:   src/com/android/settings/notificationlight/LightSettingsDialog.java
#	new file:   src/com/android/settings/notificationlight/NotificationLightSettings.java[/COLOR]
#
# Unmerged paths:
#   (use "git add/rm <file>..." as appropriate to mark resolution)
#
#	[COLOR="Red"]deleted by us:      res/values/pa_strings.xml[/COLOR]
#
brajesh@Brajesh-Sharma:~/android/aosp-kitkat/packages/apps/Settings$

How should I proceed from here onwards in solving the conflict?

@Cl3Kener : The way you've written the guide is excellent, it is useful for the newcomers. As a suggestion, there is no such detailed guide for cherry-picking. If you get time I would request you to create a guide on this with examples (I know its very tough and time taking)
 
Last edited:
  • Like
Reactions: hatememarkz

Top Liked Posts

  • There are no posts matching your filters.
  • 161
    Hey Everyone!


    By request from other overworked developers on this forum, I proudly present Develop NOW! - A Basic Manual to Help ANYONE Begin Android Development.




    Now you can learn how to build your own ROMs, Kernels, and MODs!!!!


    This manual is Primarily made for HERCULES T-989 and T-989D Owners! If you have another device you will have to change some of these instructions to your device name instead!


    Develop NOW! currently has 40 pages! From these pages you can learn…

    - How to set up an android build environment
    - Basic Development Terminology
    - How to build with Linaro
    - How to tweak ROM manifests to build your own ROM.
    - Cherry-picking
    - Forking
    - Cloning
    - Committing
    - Kernel building (Basic)
    - Flashable ZIP Creation
    - Starting you own ROM
    - LOTS MORE!!!!!




    For Everyone – Please try to post relative questions here. If you want verification that you have the correct xml string in your manifest this would be the place to post. If you run into weird errors as you follow the manual, this would be the place to post! If you want to let me know how grateful you are for this manual you can either 1) Join my Google+ Community and write a little thank you note there 2) Click “Thanks” below this post or 3) you can send me a dollar. (Nothing says thank you like I little tip once in a while)

    This manual is not copyrighted! PLEASE PLEASE PLEASE DO NOT STEAL IT AND TRY TO SELL IT!!! Download it for your personal use! Make sure to share it with your friends too by sending them to this thread! The more the merrier! Everyone can learn to develop!



    For Developers - If you are a Developer and think you have an easier way to perform any of the tasks I’ve described in this manual PM me. If you would like me to add one of your tutorials to my Additional Resources Chapter I’ll be more than happy to add you.





    Third Edition Download Links

    Second Edition Download Links (Guides for Android 4.3)


    First Edition Download Links (Guides for Android 4.2.2)



    Here is a link to my folder that contains all of the separate guides I've used to make these!



    Sources - I've listed the guides that have helped me in Post 3. Make sure to go and thank them!


    I hope you find the contents useful!
    Cheers!
    Cl3Kener


    XDA:DevDB Information
    [GUIDE] Develop NOW! 3rd Edition - How To Build ROMs, Kernels, and MODs [Hercules], a Tool/Utility for the T-Mobile Samsung Galaxy S II

    Contributors
    Cl3Kener

    Version Information
    Status: Stable

    Created 2013-09-08
    Last Updated 2014-01-25
    45
    External Links!

    Other Developers who have created some of the tools I recommend in this manual deserve your thanks as well!

    Go find all of these threads and thank the developers involved when you get a chance!!!



    Project Rookie -This has a guide for doing just about anything. Many items are specifically for Skyrocket but you can learn things such as MOD creation, Kernel Building, and other Advanced Customization. I would start reading here if I were you!

    Dsixda’s Android Kitchen - This is a tool that is very usefully for Signing files, unpacking boot images, and many more development things.

    AROMA - This was a guide made by CarvsDriver about Aroma.

    Creating a Kernel Build Script -Tutorial by Ayysir teaching how you can automate things such as kernel building with a simple bash script.

    Linaro Toolchains - This is the Linaro toolchain “hotspot” for discussion. You can learn more about linaro and ask question about building toolchains here.

    Flashable ZIP Creation
    - This tutorial by wilskywalker is much more detailed than my quick chapter on Flashable ZIPs. Read this if you really want to be a MOD guru!

    Bootanimation Creation - ayushrox gives a great guide here on making your own boot animations.


    If you encounter another great tutorial let me know and I'll post it here!

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~​
    42
    Thank you!

    Special Thanks to


    EDITORS

    @MovieGene

    @meekrawb

    @I Am The Frost


    Note: These are my main editors, Thanks to everyone that participated in my drafts!!!


    ORIGINAL IDEA

    @ThdDude



    SOME SCREENSHOTS

    @soccerfan6789
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~​
    17
    Hey Everyone!

    Well I have been getting great feedback/ideas for this manual. I plan on making a second edition here in the near future. I've noticed Jelly Bam is already out of date and some of the others will go out of date with the ushering in of 4.3. Due to the many changes that are occuring, I will probably just ride the wave for the next week or two and update the manual once everyone is building 4.3. Hope that is okay with everyone!

    Currently I am only planning on updating the building guides to 4.3 and adding LiquidSmooth and Thinking Bridge. I also think I'm going to teach you how to customize your build outputs so that the can say whatever you want. I'll also teach you how to add init.d tweaks and build.prop tweaks as well. :) Don't forget let me know which ideas you have ASAP so I can incorporate them into the 2nd Edition. :)

    Cheers!
    Cl3Kener
    11
    Hey Everyone,

    Good news!

    I've almost completed Develop Now 3rd Edition. To make it more generic I cut out the building section and have been adding either more details or more tricks I've picked over the past few months. I will be posting soon but first I wanted to share with you a post I made showing an example of how I use bash scripts to compile kernels. Make sure to thank Ayysir while you're over visiting his thread. Here is the link to the bash script tutorial http://xdaforums.com/showpost.php?p=49684209&postcount=4

    Cheers!
    Cl3Kener