ReBuild GT-i9300 source code - Galaxy S III Q&A, Help & Troubleshooting

Hi,
I've working and learning about android source code 4.0.4_r2.1. I've been looking at frameworks and a little about hardware stuff... for learning purposes, I've modified the media framework (just added some logs lines) and compiled a system app that uses this new framework.
Until now, I've been doing my practices with the emulator
$ source build/envsetup.sh
$ lunch full-eng
$ make
$ emulator
after this, I can use my own system app compiled with the modified framework (I can see my own logcat entries)
I got a samsung GT-i9300 and now I want to do these sames tests on the device, but I'm not sure about the procedures...
I had search about compile a custom ROM for this device but all info I've found is about update with an already compiled ROM as Cyanogen or Paranoid Android, but I don't want to do this, I just want to have in my device an almost original stock rom with some additonal logs lines in the framework.
How can I flash my GT-i9300 with my own modified android source code?? Thanks!!!

Related

[DEV] AOSP Gingerbread Development Central

Android Open Source Project Gingerbread Development Central​
Introduction: Many of you know me for my PhoenRom nexus rom but today I want to start a thread that hopefully will become a clear place HEAVILY ORIENTED TO AOSP DEVELOPERS where they can gather the latest fixes, kernels and mods so that they can easily be merged to the latest Gingerbread AOSP branch. This post will also provide guidance for setting up a AOSP developer machine, and all possible needed how to's that are related to the subject.
Also with time I realized that users demand always the same mods over and over between versions. So if we post the source of those modifications here it will allow them to be easily ported between versions.
This will also benefit the mods qualities itself since a community work might enhance them, amplifying their features or simply making them more stable.
What exactly WILL this post cover:
AOSP Development tools
Guidance to modifying, merging and compiling AOSP
AOSP Fixes and patches
AOSP Mods
Kernels
Useful collection of how to's links
What exactly WILL NOT cover:
Roms
Apps
Themes
About the thread: Ill personally will update this thread the best I can and test as many mods posted as possible. If anyone want to post their mods or feel that something should be posted here and its missing, feel free to do it, or private message me so I can post it. If something posted here is of special relevance and falls directly into the "WILL CONTAIN" I would post it in the opening post and hopefully will end up with a nice source library. I will also try to upload this sources to github so they are friendly mergeable.
Setting up AOSP development environment
Minimum Requirements to build Android form Source:
2GB of RAM
20GB of hard drive free space
Linux: You can use any distribution but I highly recommend Ubuntu for AOSP development.
Currently you can build AOSP in both 32bit and 64bit Ubuntu versions as long as you have the right repositories installed. Working through virtual machines its perfectly compatible, and for this purposes I personally recommend VirtualBox.
Deploying the environment, android source and compile it the easy way (default is set to CyanogenMod gingerbread branch, edit the script if you want to build from Master instead):
FOR 32 BIT LINUX ONLY:
Code:
Download this script [URL="http://dl.dropbox.com/u/6751304/androidmake"]http://dl.dropbox.com/u/6751304/androidmake[/URL]
(Courtesy of nicandris)
FOR 64 BIT LINUX ONLY:
Code:
Run this command line in terminal
apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline5-dev gcc-4.3-multilib g++-4.3-multilib
and then use the 32 bit script.
[URL="http://dl.dropbox.com/u/6751304/androidmake"]http://dl.dropbox.com/u/6751304/androidmake[/URL]
(Courtesy of nicandris)
Set the script permissions to executable and finally run the script.
NOTE: Downloading and compiling will take several hours.
Mac:
Visit this thread for guidance (Building CyanogenMod for Nexus One) http://forum.xda-developers.com/showthread.php?t=775505
AOSP Branches
Gingerbread Branches:
Master
repo init -u git://android.git.kernel.org/platform/manifest.git -b master
CyanogenMod
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
AOSP Fixes and issues
Master
Code:
CyanogenMod
Code:
[URL="http://forum.xda-developers.com/showpost.php?p=11161803&postcount=33"]CM7 make fails and complains about RomManager.apk[/URL]
AOSP mods
Rooting + Superuser.apk
Code:
(Courtesy of wdfowty & ChainsDD)
1) You need to clone ChainsDD's Superuser.apk into your source tree
[CODE]
cd ~/android/system/packages/apps
git clone -b gingerbread http://github.com/chainsdd/android_packages_apps_Superuser.git Superuser
2) Next, you need to disable the original su binary from being built. In a console/terminal, type
Code:
gedit ~/android/system/system/extras/su/Android.mk
Then replace all text in the file with this
Code:
ifeq ($(BUILD_ORIGINAL_SU),true)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= su.c
LOCAL_MODULE:= su
LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_STATIC_LIBRARIES := libc
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := debug
include $(BUILD_EXECUTABLE)
endif
That's it. Superuser.apk and su binary are included in every build after.
More info can be found here: http://howto.ccroms.net/android_project/build/mod/root
[/CODE]
Trackball Alert
Code:
CM6 Code: [URL="https://github.com/lilHermit/ta-framework-os"]https://github.com/lilHermit/ta-framework-os[/URL]
CM7: all ready has this built in.
Gingerbread: framework can be patched with trackball alert via smali patch option.
Trackball Wake & Unlock
Code:
[URL="https://github.com/CyanogenMod/android_frameworks_base/commit/88c07d2fd8419a287d6ed56ad6b1aab583b63ed3"]https://github.com/CyanogenMod/android_frameworks_base/commit/88c07d2fd8419a287d6ed56ad6b1aab583b63ed3[/URL]
[URL="https://github.com/CyanogenMod/android_frameworks_base/commit/809be3bf813258434b98c0987e38d58b28edab6c"]https://github.com/CyanogenMod/android_frameworks_base/commit/809be3bf813258434b98c0987e38d58b28edab6c [/URL]
[URL="https://github.com/CyanogenMod/android_frameworks_base/commit/17a5669474c01b0e49b8e1dd65e92c9c0a68e2ca"]https://github.com/CyanogenMod/android_frameworks_base/commit/17a5669474c01b0e49b8e1dd65e92c9c0a68e2ca[/URL]
Battery %
Code:
1)To enable battery % we need to generate the 2 modified xml files, stat_sys_battery.xml and stat_sys_battery_charge.xml.
We can do this with this 2 bash scripts:
[B]generate-battery-xml.sh[/B]
[URL="http://android-leonextlevel.googlecode.com/hg/generate-battery-xml.sh?r=60a06f198e7e5262e0197cb645a66c507b63b5df"]http://android-leonextlevel.googlecode.com/hg/generate-battery-xml.sh?r=60a06f198e7e5262e0197cb645a66c507b63b5df[/URL]
[B]generate-battery_charge-xml.sh[/B]
[URL="http://android-leonextlevel.googlecode.com/hg/generate-battery_charge-xml.sh?r=60a06f198e7e5262e0197cb645a66c507b63b5df"]http://android-leonextlevel.googlecode.com/hg/generate-battery_charge-xml.sh?r=60a06f198e7e5262e0197cb645a66c507b63b5df[/URL]
to do so, just run in this two command lines where you created the script files and gave them executable permissions.
[B]./generate-battery-xml.sh > stat_sys_battery.xml[/B]
[B]./generate-battery_charge-xml.sh > stat_sys_battery_charge.xml[/B]
2)Now copy and replace this 2 xml to the source directory "android/system/frameworks/base/core/res/res/drawable" (you'll need root permissions")
3)Add your battery%(1-100) images to the source directory "android/system/frameworks/base/core/res/res/drawable-hdpi" (you'll need root permissions")
4)Finally compile the source
Tips: you can use UOT Kitechen to generate the battery images [URL="http://circle.glx.nl/"]http://circle.glx.nl/[/URL]
(Courtesy of leonnib4)
[URL="http://code.google.com/p/android-leonextlevel/source/detail?r=60a06f198e7e5262e0197cb645a66c507b63b5df"]http://code.google.com/p/android-leonextlevel/source/detail?r=60a06f198e7e5262e0197cb645a66c507b63b5df[/URL]
Enable transparency
Code:
[URL="http://review.cyanogenmod.com/#change,2189"]http://review.cyanogenmod.com/#change,2189[/URL]
Shut Down extra options (Recovery & Reboot)
Code:
[URL="https://github.com/CyanogenMod/android_packages_apps_CMParts/commit/e68ba6a7211c3c6a66b5e13930be7b9ce837edbd"]https://github.com/CyanogenMod/android_packages_apps_CMParts/commit/e68ba6a7211c3c6a66b5e13930be7b9ce837edbd[/URL]
[URL="https://github.com/CyanogenMod/android_frameworks_base/commit/06507942da1b847f60c162160ac1d46c78f93730"]https://github.com/CyanogenMod/android_frameworks_base/commit/06507942da1b847f60c162160ac1d46c78f93730[/URL]
Pull-down notification area power widget (Glaxsy S style power widget)
Code:
(Courtesy of Pedlar)
[URL="https://github.com/Pedlar/android_frameworks_base/commit/eb0e39732842151e947f27cf64a00480d75e5631"]https://github.com/Pedlar/android_frameworks_base/commit/eb0e39732842151e947f27cf64a00480d75e5631[/URL]
Sip Calling not only over wifi
Code:
(Courtesy of paul o'brien)
In the framework-res APK edit the following setting...
[COLOR="SeaGreen"]<bool name="config_sip_wifi_only">[COLOR="Red"]false[/COLOR]</bool>[/COLOR]
For more info visit [URL="http://android.modaco.com/content/google-nexus-s-nexuss-modaco-com/327770/using-gingerbread-internet-calling-sip-without-wifi/"]http://android.modaco.com/content/google-nexus-s-nexuss-modaco-com/327770/using-gingerbread-internet-calling-sip-without-wifi/[/URL]
BusyBox
Code:
Here you can find the latest ARM binaries:
[URL="http://busybox.net/downloads/binaries/"]http://busybox.net/downloads/binaries/[/URL]
App2SD
Code:
[URL="http://forum.xda-developers.com/showthread.php?t=715940"]http://forum.xda-developers.com/showthread.php?t=715940[/URL]
Incognito Browser
Code:
[URL="https://github.com/CyanogenMod/android_packages_apps_Browser/commit/3e82693651aa2b5a27f54ffd883177a624c09574"]https://github.com/CyanogenMod/android_packages_apps_Browser/commit/3e82693651aa2b5a27f54ffd883177a624c09574[/URL]
Proxy
Code:
Info:
(Coyrtesy of leonib4 & Ninpo)
[URL="https://github.com/leonnib4/packages_apps_Settings/commit/264954500ba24f7fe27837e731ebc4d7ae7b0d4c"]https://github.com/leonnib4/packages_apps_Settings/commit/264954500ba24f7fe27837e731ebc4d7ae7b0d4c[/URL]
[URL="https://github.com/CyanogenMod/android_frameworks_base/commit/ed99b80128f1aea8889a24f96ac33c5de0faef3a"]https://github.com/CyanogenMod/android_frameworks_base/commit/ed99b80128f1aea8889a24f96ac33c5de0faef3a[/URL]
[URL="https://github.com/CyanogenMod/android_frameworks_base/commit/c2e62d24d0f57c9315e40e9957e918e68b41bc4b"]https://github.com/CyanogenMod/android_frameworks_base/commit/c2e62d24d0f57c9315e40e9957e918e68b41bc4b[/URL]
Enable HSPA icon
Code:
(Courtesy of Rusty!)
change config_hspa_data_distinguishable to true in SytemUI.apk's /res/values/bools.xml
Add silence & vibration to volume keys
Code:
STATUS:Waiting for submit
OTHER VERY USEFULL MODS
(Courtesy of leonnib4)
http://code.google.com/p/android-leonextlevel/wiki/Progress
http://code.google.com/p/android-leonextlevel/source/list
(Courtesy of cyanogen)
http://review.cyanogenmod.com/
GingerBread Kernels
(Courtesy of redstar3894)
2.6.35.10_AVS-950mV_CFS-GB_20110110_0001 OC & UV to 950mV
2.6.35.10_AVS-925mV_CFS-GB_20110112_0025 UV to 925mV
Source Files can be found at github https://github.com/redstar3894
How to's collection​
How to compile AOSP Gingerbread
Building CyanogenMod for Nexus One (Gingerbread)
How to fork in github
THIS THREAD IS UNDER CONSTRUCTION...FEEL FREE TO POST ANY MODS, IDEAS, FIXES OR WHAT EVER YOU WISH MEANWHILE. HELP IS APPRECIATED!
Reserved space
Feel Free to add my two gingerbread kernels
2.6.35.10_AVS-950mV_CFS-GB_20110110_0001 OC & UV to 950mV
2.6.35.10_AVS-925mV_CFS-GB_20110112_0025 UV to 925mV
Both are compatible with AOSP gingerbread and based off my latest source...
What about enabling internet calling not over wifi, per Paul's finding:
http://android.modaco.com/content/g...ingerbread-internet-calling-sip-without-wifi/
See CyanogenMod github account.
Also I pretty much covered those commits:
Sources: http://code.google.com/p/android-leonextlevel/wiki/Progress
My commits: http://code.google.com/p/android-leonextlevel/source/browse/LeoGingerBread/ChangeLog
Help yourself
Thanks, all.
Does anyone know where in cyanogenmod github I can find the code for the Notification area power widget (wifi, bluetooth, gps, silence) ???
mordokak said:
Does anyone know where in cyanogenmod github I can find the code for the Notification area power widget (wifi, bluetooth, gps, silence) ???
Click to expand...
Click to collapse
frameworks/base cyanogenmod see the history should be there
charnsingh_online said:
frameworks/base cyanogenmod see the history should be there
Click to expand...
Click to collapse
and also if ur working in AOSP there is no such thing as framework-res to edit, that is done using smali on an already compiled rom
If you want an HSPA icon, you need to change config_hspa_data_distinguishable to true in SytemUI.apk's /res/values/bools.xml
Rusty! said:
If you want an HSPA icon, you need to change config_hspa_data_distinguishable to true in SytemUI.apk's /res/values/bools.xml
Click to expand...
Click to collapse
Thanks, added to OP
Thanks : )
Nice thread.. thanks for sharing information mate.. It is really helpful.
What about the sources needed to get the camera fully working on Gingerbread, like is your ROM?
'cause I can't get it to work for now
That fix is actually Cyanogens Team, not mine. I just compiled their latest branch.
I guess I could have a look at cyanogenmod github and search for changes in the related files (cam and video libs)
Which is what I'm trying to do since quite some days now.
If I found the right commits, I'll PM you so you can add those to POST#1.
That would be awsome ^_^
Howdy gents,
Don't know if you're interested but I've recently spruced up the gingerbread battery. Here's the raw files if anyone's interested. You might want to change the timings as I tend to run it a little quicker.
new-gingerbread-battery.zip
This is awesome, all the info that is really hard to find and corelate in one place !!
Can I make one simple request ?
Could you (or anyone) post a recipe for actually doing development as in beyond just compiling patches. I am (and I hear I am not alone) very confused by the instructions for git/repo and various AOSP depots about how to do good development where I follow a development tree, sync regularly and make sure my patches work before I submit.
Or is there such a doc someplace and I have failed to find it ?
Actually I was planning to do so ^_^, but I would appreciate if someone could help me, if someone post a detailed git repo guide y will post it in OP. If not ill do it myself when I get back to my normal computer. I really like it when people contribute here ^_^

[Q] how to compile tun.ko?

can anybody tell me how to compile tun.ko for any rom? what would i need to download/install etc? any help would be appreciated. thanks!
get the kernel soruce and check config file for tun
in .config file search for "TUN" keyword, change Y to M, run make menuconfig, save, compile.
slow down guys absolute noob here. how/where do i run makeconfig? what software would i need? sorry if stupid questions :c
Sent from my GT540 using XDA App
daggerxXxsin said:
slow down guys absolute noob here. how/where do i run makeconfig? what software would i need? sorry if stupid questions :c
Sent from my GT540 using XDA App
Click to expand...
Click to collapse
First, you need the kernel source code for your device. The Linux GPL requires that OEMs provide the kernel source so you should be able to find it.
You'll need a linux machine with a development environment. You'll also need the Android NDK for the ARM toolchain.
Once you've got all that lined out, you'll need a kernel config. You can usually get this from your device's proc directory as /proc/config.gz.
Now gunzip the config.gz in your kernel source directory, rename it to ".config" and run "make oldconfig". If it is from an identical source tree, then it should run without prompting.
Now run make menuconfig and drill down to the tun options and enable it as a module. Now you can "make" your kernel and "make modules" for the modules.
okay so first thing is to setup a build environment. gotcha. will work on that.
Sent from my GT540 using XDA App
Gene Poole said:
First, you need the kernel source code for your device. The Linux GPL requires that OEMs provide the kernel source so you should be able to find it.
You'll need a linux machine with a development environment. You'll also need the Android NDK for the ARM toolchain.
Once you've got all that lined out, you'll need a kernel config. You can usually get this from your device's proc directory as /proc/config.gz.
Now gunzip the config.gz in your kernel source directory, rename it to ".config" and run "make oldconfig". If it is from an identical source tree, then it should run without prompting.
Now run make menuconfig and drill down to the tun options and enable it as a module. Now you can "make" your kernel and "make modules" for the modules.
Click to expand...
Click to collapse
Hi Gene, i want to ask, if we cannot find the config.gz file from the device, is it imposibble to get the tun.ko working?
Or if it possible, can you tell me how to gain some configuration, that used by the tun.ko, so we can set the config from menuconfig correctly?
I`ve tried to compile tun.ko for a device, the insmod working fine, but when the vpn try to use the tun, it is crash, it raise segmentation fault.

[TUTORIAL][WIP] Working with GIT and GITHUB for Android Source

Working with GIT and GITHUB
for Android Source
I want to start by saying that I am no EXPERT on GIT, but I believe the best way to learn is through trial and error. Through my trials and errors, this is what I have found that works when working with Android Source Code (AOSP).
I started my Android Development basically porting and hacking Android Operating Systems for the HTC Thunderbolt. In my opinion I learned the basics plus some, and was able to create stable builds, which most users found enjoyable to operate. In my quest to further improve my Android development skills, I moved on the next step in Android Operating System development, build a custom AOSP ROM from source. I soon started browsing other developers GITHUB repositories and tried my best to figure out what was going on behind the scenes, in order to share my code with others and visa versa. This lead me to setting up a development platform, downloading the latest (at the time ICS) source and then compiling everything, to obtain, a fresh updated ROM. Obviously, the next step was editing the code to my liking and then trying to figure out how to update my code (push) to Github for version tracking and also hosting purposes. I shopped around on the net for GIT tutorials, and for the life of me, I could not figure out how to make things work the way they should. After doing research on the REPO command (which I came to find was basically the same as GIT but updated to work better with Android) I became more confused. I never found an article or tutorial which explained step-by-step the processes in which I am about to explain, which is why I decided to take the time to compose this tutorial.
Finally, through many hours of research and frustration, I came up with the answers I was so diligently seeking. Here are my findings:
The following Tutorial is for an INITIAL COMMIT of your source to GITHUB. Once you accomplish sending the initial data over, sending only changes thereafter, is very similar, but doesn't require as many steps.
Prerequisites:
(1) Create an account on GITHUB.com
(2) Download the Android Source into a working directory (in my case "android").
(3) Generate your Private SSH Keys for GITHUB (this will allow you to push files without logging in every time) You will find easy to understand directions HERE
For this example I will be working with the following variables:
My default Android directory: ~/android
For this tutorial I will editing the Setting.apk source code in order to add "XYZ" functionality
The source code for the Settings.apk is located in ~/android/packages/apps/Settings
So lets BEGIN!
First Step: You want to go into the directory where you are editing the source.
Code:
cd ~/android/packages/apps/Settings
Second Step: Initialize the Settings source folder and create a git repository
(which will track all changes)
Code:
git init
Third Step: Now you want to log-in to GITHUB and create a repository for your updated Settings source to go. In my case I created a folder on GUTHUB called android_packages_apps_Settings
Forth Step: After you have created your repository on GITHUB, from your Settings source folder, you need to tell git where to push the changes you have made. When you do the initial push, it is actually going to push all of the files in the Settings source folder including the changes you have made. Do this by typing the following command:
Code:
git remote add github [email protected]:yourusername/android_packages_apps_Settings.git
Obviously, you are going to change "yourusername" to whatever username you created on GITHUB.
Fifth Step: Add the entire Settings directory to git so that it starts tracking your additions, deletions, changes, etc for the entire directory.
Code:
git add -A
Sixth Step: Commit the changes that you made to the files in order to push to GITHUB. Now for this example, I want to commit changes to ALL files in the Settings folder.
Code:
git commit -a
If I wanted to just commit changes to one specific file, I would use "git commit whateverfile.java". After you commit, a text editor is going to pop-up. This is where you add the description for the change(s) you have made. If you have detailed change-log of each file you changed, you will not want to use the "git -a" command because the description you enter there is going to be the description for all of the files you edited.
Seventh Step: Now you want to change to the branch you plan on using to push your content. In my case its "jellybean".
Code:
git branch jellybean
Eighth Step: Finally you will now push your initial Settings commit to github. In order to do this, type:
Code:
git push github jellybean
This is going to push github ("github" is the name you gave the REMOTE when you executed the "git remote add" above) to a branch on GITHUB.com called "jellybean". You can name the branch whatever you like, but obviously naming it to the current Android release name is the easiest to remember for you and others.
You should now see that your computer sent files to GUTHUB.com and if you check online, you should see that your changes have been implemented and copied for the world to access.
I hope this helps people out with Android based git commands. I wish I found somthing like this months ago and maybe I would have a few extra hairs on my head. Let me know if you have any additional questions or would like me to add to this tutorial in any fashion. I will be doing a video shortly which I will post to this thread when complete.
Saved for Questions and Answers . . .
Create repository on github called packages_apps_Settings
Clone it
Code:
git clone https://github.com/lithid/packages_apps_Settings.git
cd packages_apps_Settings
Find the aosp settings and pull that repo so all proper history is still entact. Then merge it.
Code:
git pull https://android.googlesource.com/platform/packages/apps/Settings refs/tags/android-4.1.1_r6
Save it
Now add it all and push to your local repo.
Code:
git push
Hello, how do you create a device tree because I want to build from source but my phone does not yet have one. Thanks
itzdarockz said:
Hello, how do you create a device tree because I want to build from source but my phone does not yet have one. Thanks
Click to expand...
Click to collapse
When you say "a device tree" are you referring to the propriety device drivers and such for a particular device?
MyComputerDoctor said:
When you say "a device tree" are you referring to the propriety device drivers and such for a particular device?
Click to expand...
Click to collapse
I mean to build from source and when picking your lunch such as crespo and crespo 4G i want to add my phone into that. Is that necessary to build from source though?
itzdarockz said:
I mean to build from source and when picking your lunch such as crespo and crespo 4G i want to add my phone into that. Is that necessary to build from source though?
Click to expand...
Click to collapse
Let me know if this helps: http://www.netmite.com/android/mydr...build_new_device.html#androidBuildNewFileTree
Thanks for this tut! I've been wanting to push out sources to my github for a while...but couldn't really find a good tut/didn't have the time to do all the research...this seems like it should get me going with my github and I will definatly be using this tut soon
Sent from my SGH-I997 using Tapatalk 2
question, Let's say I want to merge a commit from CyanogenMod's GitHub ..... I use AOKP's Source, is there a command using git that I can use to facilitate this ??
johnhany97 said:
question, Let's say I want to merge a commit from CyanogenMod's GitHub ..... I use AOKP's Source, is there a command using git that I can use to facilitate this ??
Click to expand...
Click to collapse
Use git cherry-pick but first you need to add the repo
So for example you want a commit from settings first you add CM's settings as a repo with git remote add <name> <url> ....Name can be anything
So it will be $ git add remote cm https://github.com/CyanogenMod/android_packages_apps_Settings
then you can either git fetch cm which will sync all the branches out you can just sync a single branch $ git fetch cm cm-10.1
Now you can use git cherry-pick to cherry-pick the commit from CM settings
$ git cherry-pick <sha1>
e.g
$ git cherry-pick 64c377
Now you will probably need to resolve some conflicts which is hard to explain how to resolve as it varies between has been added where cherry-picked.
can some one ell me how i merge the halo from PA ?
thanks
MyComputerDoctor said:
Working with GIT and GITHUB
for Android Source
I want to start by saying that I am no EXPERT on GIT, but I believe the best way to learn is through trial and error. Through my trials and errors, this is what I have found that works when working with Android Source Code (AOSP).
I started my Android Development basically porting and hacking Android Operating Systems for the HTC Thunderbolt. In my opinion I learned the basics plus some, and was able to create stable builds, which most users found enjoyable to operate. In my quest to further improve my Android development skills, I moved on the next step in Android Operating System development, build a custom AOSP ROM from source. I soon started browsing other developers GITHUB repositories and tried my best to figure out what was going on behind the scenes, in order to share my code with others and visa versa. This lead me to setting up a development platform, downloading the latest (at the time ICS) source and then compiling everything, to obtain, a fresh updated ROM. Obviously, the next step was editing the code to my liking and then trying to figure out how to update my code (push) to Github for version tracking and also hosting purposes. I shopped around on the net for GIT tutorials, and for the life of me, I could not figure out how to make things work the way they should. After doing research on the REPO command (which I came to find was basically the same as GIT but updated to work better with Android) I became more confused. I never found an article or tutorial which explained step-by-step the processes in which I am about to explain, which is why I decided to take the time to compose this tutorial.
Finally, through many hours of research and frustration, I came up with the answers I was so diligently seeking. Here are my findings:
The following Tutorial is for an INITIAL COMMIT of your source to GITHUB. Once you accomplish sending the initial data over, sending only changes thereafter, is very similar, but doesn't require as many steps.
Prerequisites:
(1) Create an account on GITHUB.com
(2) Download the Android Source into a working directory (in my case "android").
(3) Generate your Private SSH Keys for GITHUB (this will allow you to push files without logging in every time) You will find easy to understand directions HERE
For this example I will be working with the following variables:
My default Android directory: ~/android
For this tutorial I will editing the Setting.apk source code in order to add "XYZ" functionality
The source code for the Settings.apk is located in ~/android/packages/apps/Settings
So lets BEGIN!
First Step: You want to go into the directory where you are editing the source.
Code:
cd ~/android/packages/apps/Settings
Second Step: Initialize the Settings source folder and create a git repository
(which will track all changes)
Code:
git init
Third Step: Now you want to log-in to GITHUB and create a repository for your updated Settings source to go. In my case I created a folder on GUTHUB called android_packages_apps_Settings
Forth Step: After you have created your repository on GITHUB, from your Settings source folder, you need to tell git where to push the changes you have made. When you do the initial push, it is actually going to push all of the files in the Settings source folder including the changes you have made. Do this by typing the following command:
Code:
git remote add github [email protected]:yourusername/android_packages_apps_Settings.git
Obviously, you are going to change "yourusername" to whatever username you created on GITHUB.
Fifth Step: Add the entire Settings directory to git so that it starts tracking your additions, deletions, changes, etc for the entire directory.
Code:
git add -A
Sixth Step: Commit the changes that you made to the files in order to push to GITHUB. Now for this example, I want to commit changes to ALL files in the Settings folder.
Code:
git commit -a
If I wanted to just commit changes to one specific file, I would use "git commit whateverfile.java". After you commit, a text editor is going to pop-up. This is where you add the description for the change(s) you have made. If you have detailed change-log of each file you changed, you will not want to use the "git -a" command because the description you enter there is going to be the description for all of the files you edited.
Seventh Step: Now you want to change to the branch you plan on using to push your content. In my case its "jellybean".
Code:
git branch jellybean
Eighth Step: Finally you will now push your initial Settings commit to github. In order to do this, type:
Code:
git push github jellybean
This is going to push github ("github" is the name you gave the REMOTE when you executed the "git remote add" above) to a branch on GITHUB.com called "jellybean". You can name the branch whatever you like, but obviously naming it to the current Android release name is the easiest to remember for you and others.
You should now see that your computer sent files to GUTHUB.com and if you check online, you should see that your changes have been implemented and copied for the world to access.
I hope this helps people out with Android based git commands. I wish I found somthing like this months ago and maybe I would have a few extra hairs on my head. Let me know if you have any additional questions or would like me to add to this tutorial in any fashion. I will be doing a video shortly which I will post to this thread when complete.
Click to expand...
Click to collapse
Did you finish the video tutorial?
Sent from my LG-LS970 using Tapatalk 4 Beta
sooo?
Does anyone have further information on how you would sync back to a master? That is, if I sync from AOSP today, make my own changes, and then a few weeks from now I want to resync to an updated AOSP, how do I do this?

Create specific device tree for AOSP

I followed official Google`s tutorial to build my own AOSP and succeeded in all steps: I have "Pure AOSP version" running on nexus emulator.
The story is I have some rare device came with some Android version full of pre-installed app's obviously I don't want... So I want to port Pure AOSP to my device - Simple as that, without any improvements or new features (So for example I don`t want to know how to build CM git repo).
Is it working just add to my local above master branch correct files into /device/vendor/model and then under cwd of master branch execute $ . build/envsetup.sh ?
If so, what are the files and their content I need to put under /device/vendor/model ? I found a lot of guides how to pull already existing tree of CM or something else, and looking on some git repo's of several devices, I tried to figure out the minimum complete set of files & their content but I didn't find correlation. I think there must be the minimum complete set and there is programming reason for the existence of each file. And what I saw in existed git repo`s was this set + custom extras each developer added by his own reasons.
Aftermath How do I determine the Build name & Buildtype to exucte $ lunch <Build name>-<Buildtype > ?
How to integrate $ make otapackage in order to build the familiar one zip file to load via recovery like CWM?
Thanks,

Looking to create your own custom kernel? Start here!

INTRODUCTION
I create this guide in the hope to jump start development on our lovely Exynos devices.
I expect that before you start, you have a Linux installation in either a virtual machine or on a physical PC.
Debian Jessie, Kali Linux, Mint, or Ubuntu are excellent choices and what I'm familiar with, so if you get stuck it'll be easier for me to help you if you use these.
PREREQUISITES
WARNING: Custom kernels on the Note 7, S7, and S7 edge currently require encryption to be disabled in order to boot. They also have to disable some secure MobiCore firmware. You will have to format your entire data partition when going from stock kernel to a custom kernel! Once you're on a custom kernel with non-encrypted data, you shouldn't have to wipe it going to another custom kernel.
Be careful not to disable developer options or OEM unlock, otherwise all your data will be destroyed! Back up your data partition whenever you flash stock. (for upgrades, etc.)
First off, you'll want to download some tools necessary for building and downloading kernel sources:
git-core - you'll want git for downloading and maintaining your sources
build-essential - native gcc & tools for building (needed for build commands)
libncurses5-dev - needed to build menuconfig
diff - used to compare config changes
colordiff - used by diff to provide colorful human readable diff output
Code:
apt-get install git-core build-essential libncurses5-dev diff colordiff
PREPARING YOUR ENVIRONMENT
Once you've got that out of the way, you should create an organized environment for working. I like to use ~/build.
Code:
mkdir -p ~/build/toolchain ~/build/kernel
DOWNLOADING & INSTALLING A TOOLCHAIN
You'll want to download a toolchain for kernel building. I recommend using Linaro's optimized ARM toolchains.
The Exynos 8890 benefits from the Cortex-A53 code compiling optimizations.
GCC 4.9: https://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-linux-gnu/
GCC 5.X: https://releases.linaro.org/components/toolchain/binaries/latest-5/aarch64-linux-gnu/
The actual file that you want ends in -x86_64_aarch64-linux-gnu.tar.xz (assuming you have a 64-bit Linux install, seriously, 32-bit needs to go! )
We'll use the GCC 5.3.1 2016.5 toolchain in this example.
Let's download and extract it now:
Code:
cd ~/build/toolchain
wget "https://releases.linaro.org/components/toolchain/binaries/latest-5/aarch64-linux-gnu/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu.tar.xz"
tar xf ./*linux-gnu.tar.xz
rm ./*linux-gnu.tar.xz
That's it for installing the toolchain, easy right?
DOWNLOADING THE KERNEL
Rather than download your kernel sources directly from Samsung full of wacky issues when you change a single configuration option, you can grab it from my GitHub!
Using this method, you have an already working stock kernel prepared to be modified and built at your leisure.
You're also able to grab updates and fixes from me should you want them. I'll be committing new kernel source updates from Samsung to the opensource branch.
The stock-6.0 branch will be rebased on top of opensource when that happens, then stock-6.0.y (stock, with Linux updates) will be rebased on top of that.
Cool concept, right?
First, you'll want to create a GitHub account if you don't have one already.
This will allow you to upload your changes and share your kernel with other interested users and developers.
Once you've got your account, and you're logged in, browse to:
https://github.com/jcadduono/android_kernel_samsung_universal8890
You want to fork the sources to your own account, to do this simply click the [Fork | ] button near the top right of the page:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Now you've got your own copy of the Note 7 / S7 / S7 edge kernel sources on your GitHub!
The next step is to use git to download it to your PC.
Replace "your_username" with your actual GitHub username. Using [email protected] you can avoid being asked for your username each time you push new changes.
Code:
cd ~/build/kernel
git clone https://[email protected]/your_username/android_kernel_samsung_universal8890 samsung_universal8890
cd samsung_universal8890
The default branch is stock-6.0. This is what most users will want. If you wish to start on a kernel that is updated to the latest Linux minor version, then simply:
Code:
git checkout stock-6.0.y
There's a twrp-6.0 branch that's used for building the kernel inside the official TWRP for Note 7 / S7 / S7 edge.
There's also a nethunter-6.0 branch used to build the kernel used by Kali NetHunter on those devices.
You can use git log <branch> to view commits, and git cherry-pick <commit id> to copy commits from those branches into yours if you like.
CONFIGURING GIT
Before you start working on your kernel, you will need to set up your git profile.
The user values show up in commit messages to tell people who authored them.
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global push.default simple
YOUR FIRST COMMIT
We'll want to check out a new branch, and give it your own cool name. I suggest adding a -6.0 suffix to it because you'll probably want to start a new branch when Android 7.0 comes out.
We're going to use "coolname" as our example, so be sure to replace that with what you really want it to be called in the next steps.
Code:
git checkout -B coolname-6.0
Next we'll need to modify the build scripts to fit our setup.
Open build.sh, menuconfig.sh, and dtbgen.sh.
You'll want to set the TOOLCHAIN= path in all 3 scripts. If you're following this guide, then it's already correct!
In menuconfig.sh and build.sh, you'll want to set your default target config name.
See the line:
Code:
[ "$TARGET" ] || TARGET=samsung
You'll want it to look like this:
Code:
[ "$TARGET" ] || TARGET=coolname
Now you want to copy the default samsung kernel configuration so you have your own to work with:
Code:
cp arch/arm64/configs/samsung_defconfig arch/arm64/configs/coolname_defconfig
Now you'll have prepared your kernel source for starting work on your own custom kernel!
Let's turn that into a commit, but first look at the changes you've made using:
Code:
git diff
Does that look good? If not, fix what's broken before proceeding.
Next you'll want to add files that will be part of your commit.
For simplicity's sake, let's just add all of the changed files into the commit.
Code:
git add .
Now to make your commit:
Code:
git commit -m "My first commit, setting up my coolname kernel!"
You've done it!
CONFIGURING YOUR KERNEL
We'll use the menuconfig.sh script to launch the kernel menuconfig.
Code:
./menuconfig.sh
Change whatever options you're interested in, but don't change a lot all at once, otherwise when or if you run into issues, you won't know which option caused it.
Once you're done playing in the menuconfig, exit and save.
You'll be shown a colorful difference between your old configuration and your new one.
It will ask you if you want to save it, and you just have to type "y" and press enter for it to be saved.
At this point it's a good idea to make another commit to save your configuration changes.
If you need to edit the commit, you can easily use git commit --amend to fix it up.
BUILDING YOUR NEW KERNEL
Let's take your new config for a test drive.
To build your kernel, simply run:
Code:
./build.sh gracelte xx
gracelte = Note 7
herolte = S7
hero2lte = S7 edge
xx = International N930F & N930FD
kor = Korean N930K, N930L, & N930S
Yes, you can compile your kernel to all 3 of those devices using just your single config!
The power of device specific config additions.
Once your kernel is finished building, the resulting files will be located at:
Code:
build/arch/arm64/boot/Image
build/arch/arm64/boot/dtb.img
build/modules/*.ko (if modules are enabled)
INSTALLING YOUR NEW KERNEL
The LazyFlasher project comes to the rescue here. It's the swiss army knife of kernel flashing in TWRP.
There's a specific branch for the Note 7 called kernel-flasher-gracelte. (use kernel-flasher-herolte instead if building for S7/S7 edge!)
To download it (feel free to fork it so you can have a copy on your GitHub to modify instead!):
Code:
cd ~/build
git clone -b kernel-flasher-gracelte https://github.com/jcadduono/lazyflasher.git
cd lazyflasher
To use LazyFlasher, you'll probably want to take a look at the Makefile, config.sh, and META-INF/com/google/android/update-binary (a shell script).
There's a few things you can change there to personalize it to your needs.
You should also enter the patch.d folder and delete 060-f2fs-fstab if you don't have f2fs enabled in your kernel, and edit the io_scheduler in 070-kernel-settings if you don't have fiops enabled either.
(make another git commit to save your setup!)
Once the installer is set up to your liking, all you have to do to build it is copy the Image and dtb.img from your build output into the lazyflasher folder.
If you have any modules (.ko files) to install, place them in the modules folder.
Now simply run:
Code:
make
A TWRP flashable zip and sha1sum is created!
At this point, you will need to use the [Format Data] button in TWRP if your device is encrypted! There is no known way around this.
This will wipe all data from your phone, including your internal storage, essentially making it like new.
Transfer it to TWRP and flash away, you've just lost your custom kernel development virginity.
Go have a few beers to celebrate, or to drown your sorrows in the case of a boot loop.
You should consider taking a look at the patch.d scripts sometime so you know what it's actually doing.
PROBLEMS?
Post a reply here and I'll try to find a solution and add it to this post.
RESOURCES
Need a text editor for coding? I use gedit. It's pretty, light, and you can get some decent plugins for it.
It's a minimal editor, so don't expect anything really fancy. Configure it and enable plugins before you decide to trash it.
Code:
apt-get install gedit gedit-plugins
Here's an awesome git starter guide: http://rogerdudler.github.io/git-guide/
THANKS
If not for @Tkkg1994 finding out what changes are needed to get custom kernels up and running, we wouldn't have this lovely guide here!
Thanks for the amazing guide, i got it compiled successfully but the problem comes after the device boots up, it asks for my Pattern and when i enter it, it keeps saying incorrect and wont let me in, any help?
Ather said:
Thanks for the amazing guide, i got it compiled successfully but the problem comes after the device boots up, it asks for my Pattern and when i enter it, it keeps saying incorrect and wont let me in, any help?
Click to expand...
Click to collapse
Sorry, I forgot to add to the guide that custom kernels don't support encryption. You should flash your stock kernel & supersu, install something like titanium backup, and back up all your things to an external SDcard.
I've added a warning in the thread and included it in the instructions now.
that's weird, I disabled lockscreen security and reinstalled the kernel, booted up fine with selinux enforcing http://i.imgur.com/IVSTfV1.png
Ather said:
that's weird, I disabled lockscreen security and reinstalled the kernel, booted up fine with selinux enforcing http://i.imgur.com/IVSTfV1.png
Click to expand...
Click to collapse
Are you still encrypted?
Maybe it's just one of the secure mobicore firmware that were removed that your lock screen depended on. You might be able to set up the lock screen again now, and this time it won't require that specific piece of firmware.
no i had already wiped data when i installed hydra kernel so after flashing my custom kernel i tried to setup the fingerprint and it gave an error that the fingerprint sensor isn't available try later, do you have any idea how to make a decrypted kernel like hydra?
Ather said:
no i had already wiped data when i installed hydra kernel so after flashing my custom kernel i tried to setup the fingerprint and it gave an error that the fingerprint sensor isn't available try later, do you have any idea how to make a decrypted kernel like hydra?
Click to expand...
Click to collapse
Oh, I'm not sure why that happened then. There shouldn't have been anything extra removed on top of what HydraKernel removes.
My device is working with both Iris and Fingerprint unlock right now.
Can you post the output of:
Code:
ls /system/app/mcRegistry
can you test out my kernel? i see hydra zip has some files that it replaces, and the lazyflasher has similar files, could that be the problem?
Ather said:
can you test out my kernel? i see hydra zip has some files that it replaces, and the lazyflasher has similar files, could that be the problem?
Click to expand...
Click to collapse
try backing up your system/data to !!external sdcard!! in twrp, saving your internal storage to pc, then formatting data.
restore your stock kernel and system before flashing your custom kernel.
then see if it works from scratch.
if it's all fine, try restoring your data backup.
Ather said:
no i had already wiped data when i installed hydra kernel so after flashing my custom kernel i tried to setup the fingerprint and it gave an error that the fingerprint sensor isn't available try later, do you have any idea how to make a decrypted kernel like hydra?
Click to expand...
Click to collapse
This sounds exactly like you did not patch /system/app/mcRegistry files
Sent from my SM-N930F using XDA Labs
Tkkg1994 said:
This sounds exactly like you did not patch /system/app/mcRegistry files
Sent from my SM-N930F using XDA Labs
Click to expand...
Click to collapse
They shouldn't be patched though, the installer simply removes the secure ones that the device is unhappy with.
It works fine for me, so I know the offending ones are being removed, but maybe somehow it deleted all of his tlbins?
Be nice if he provided the contents of his mcRegistry :/
jcadduono said:
They shouldn't be patched though, the installer simply removes the secure ones that the device is unhappy with.
It works fine for me, so I know the offending ones are being removed, but maybe somehow it deleted all of his tlbins?
Be nice if he provided the contents of his mcRegistry :/
Click to expand...
Click to collapse
Hello @jcadduono,
I am one of your "orphan" users of Idlekernel. It is the very best kernel for the Note 3.
Would you produce a blind update of it, please, please.
I would be more than happy to test it before you upload to general public.
Sorry guys for the OT.
Need help for finalisation kernel
Hello and thank you OP for the tutorial, I have done everything and no worries except when I want to flash the kernel does not boot, then I would like to know how to get a boot.img with the dtb.img files and the image create after Compilation, if someone can help I will be grateful
Thank you
Help on Kernel modules and patches
{MY QUESTIONS ARE ABOUT BOLD ITEMS BELOW}
Once your kernel is finished building, the resulting files will be located at:
Code:
build/arch/arm64/boot/Image
build/arch/arm64/boot/dtb.img
[B]build/modules/*.ko (if modules are enabled)[/B]
INSTALLING YOUR NEW KERNEL
The LazyFlasher project comes to the rescue here. It's the swiss army knife of kernel flashing in TWRP.
There's a specific branch for the Note 7 called kernel-flasher-gracelte. (use kernel-flasher-herolte instead if building for S7/S7 edge!)
To download it (feel free to fork it so you can have a copy on your GitHub to modify instead!):
Code:
cd ~/build
git clone -b kernel-flasher-gracelte https://github.com/jcadduono/lazyflasher.git
cd lazyflasher
To use LazyFlasher, you'll probably want to take a look at the Makefile, config.sh, and META-INF/com/google/android/update-binary (a shell script).
There's a few things you can change there to personalize it to your needs.
You should also enter the patch.d folder and delete 060-f2fs-fstab if you don't have f2fs enabled in your kernel, and edit the io_scheduler in 070-kernel-settings if you don't have fiops enabled either.
(make another git commit to save your setup!)
Once the installer is set up to your liking, all you have to do to build it is copy the Image and dtb.img from your build output into the lazyflasher folder.
If you have any modules (.ko files) to install, place them in the modules folder.
Now simply run:
Code:
make
Got a few question for anyone that is familiar with the exynos8890-gracelte BUILD. This in regards to files output after compilation of kernel code; specifically with editing patches and providing module support.
Where are the *.ko files located if default output is used(using your ./build.sh gracelte xx)? By the way...Your tutorial is awesome, first and foremost...but I want to be sure that I am pulling the files from the correct location (being a newbie at this android kernel building stuff). I found my modules under "~/build/kernel/samsung_universal8890/build/lib/modules/3.18.14-dee-gracelte-xx-0.1" which is the parent folder to other folders/files that seem to be of interest. After digging deeper there are even folders within the previously mentioned (named) one that have items of question as to whether they are needed in my "flasher" module folder. Such as pictured https://drive.google.com/open?id=0B-3GHX6_T7lYRkRUUVVORE1OM1k
I just want to have a functioning kernel with module support/modules in there proper place. Another item is patches. Would it be possible to just change "070-kernel-settings" patch to "io_scheduler=noop" if I changed default setting to such? If so, what other, if any, items in this file would need editing? Where else can I find patch files located on the web or is this something home-brewed? Thanks for all your hard work.
I also assume that by changing to the proper package manager commands, this procedure will work for pretty much most Linux distros.
Windows 10 Support Number

Categories

Resources