Cherry-Picking From Github - Nexus 7 Developer Discussion [Developers Only]

how do i cherry pick a single commit from a github source? like get a certain commit from aokps settings app and get it into cm10.1
i tried this and seemed to break my build
cd ~/android/system/frameworks/base
git fetch https://github.com/AOKP/packages_apps_Settings.git && cherry-pick 8b7e06fe63939730067b539ca7343fcd8e68ad01 FETCH_HEAD
is that the right way to do it? and how do i know if it cherry picked correctly? sorry im still getting the hang of thins with github

azoller1 said:
how do i cherry pick a single commit from a github source? like get a certain commit from aokps settings app and get it into cm10.1
i tried this and seemed to break my build
cd ~/android/system/frameworks/base
git fetch https://github.com/AOKP/packages_apps_Settings.git && cherry-pick 8b7e06fe63939730067b539ca7343fcd8e68ad01 FETCH_HEAD
is that the right way to do it? and how do i know if it cherry picked correctly? sorry im still getting the hang of thins with github
Click to expand...
Click to collapse
I'd go to their gerrit. Anything and find what you want.
http://gerrit.sudoservers.com/#/q/status:open,n,z
Click on it, note the Project listed. cd to that in your tree. then in the download section you see a cherry-pick tab. click that and select the command there. That is the command you use. If it comes in without needing to merge anything you are good.

thanks, and how would i know if merging is needed?

azoller1 said:
thanks, and how would i know if merging is needed?
Click to expand...
Click to collapse
it'll tell you. Not sure if you use UI or command line but in command line i installed vimdiff, then set it as git mergetool with,
git config --global merge.tool vimdiff
if using UI I'd use meld.
so it'll report something needs to be merged then just
git mergetool and it'll open up. manually fix the merge
then
git status
This will show you the .orig files. delete them
Then:
git add -A
git commit -a
Control+X(nano) or :wq (vim)
And you're done.

git remote add -f repo.git then git cherry pick commit id

so basically just get the branch i want a cherry pick from, then picks it from the branch when i enter the commit, and i need to cd in the right directory before doing
git remote add -f repo.git?

see if it help!http://forum.xda-developers.com/showthread.php?p=23527685#post23527685

yeah i saw that guide, but still confused using github, gerrit is pretty easy

I always use this thingy as reference for cherry-picking:
http://stackoverflow.com/questions/...ctively-pull-merge-changes-from-anothers-fork

sorry forgot about this i will give a better example. if you want tp cherry pick a framwork base commit be in the framework folder then
git remote add paranoid(name is irrlefvent) -f [email protected]aranoidAndroid/android_frameworks_base.git
wait for it to download
then git cherry pick the commit id: git cherry pick f9cedfe79cc1d545b920f93539a0843d02819fe6

FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339

Entropy512 said:
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Click to expand...
Click to collapse
If using this method to patch, which folder in my source do I download the patch to? Also when adding commits to my source do I need to add every single commit individually or can I just choose the commit from the major header? For example there are many commits within the Frameworks folder (Frameworks/Base..etc) do I need to go into the Frameworks folder and add each element individually or can I just add the commit from the Frameworks folder? One more thing, how to I apply a patch that I have downloaded as xxx.patch? Sorry if this is hard to understand I'm new at this and still learning the jargon.
Thanks!

The truth is already out there: http://wiki.cyanogenmod.org/w/After_You_Build
http://wiki.cyanogenmod.org/w/Doc:_...building_a_patch_submission_already_on_Gerrit
Sent from my Nexus 7 using xda premium

i want this commit: https://github.com/CyanogenMod/andr...mmit/d1f1fb4064bfcef528a12a4c5176df7b44ffd48c
you need two things, the url to the main project and the commit id, both you just copy out of your browser
the branch i always use is called "jellybean"
my remote to my git is called "github"
that might differ from your configuration-
cd aosp
cd packages/app/Settings
git checkout jellybean
git remote add cyan https://github.com/CyanogenMod/android_packages_apps_Settings
git fetch cyan
git cherry-pick d1f1fb4064bfcef528a12a4c5176df7b44ffd48c
done.
in case it conflicts, you run:
grep -r "<< HEAD" .
and fix all the files it spits out. search for "<< HEAD" in these files and you should see what to do.
when you're done fixing your files you can test if it builds, if it does you go:
git add --all
git commit --all
in the end you push it up to your git
git push github jellybean

Entropy512 said:
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Click to expand...
Click to collapse
i think this is the easiest way to pick a commit from someone and add it into your own source, but instead i used this command line in my root source
patch -p1 < ./patch
seems to fail a lot when adding the patch but its really easy to fix it

Entropy512 said:
FYI, if you are looking at a specific commit on github, you can get it in patch format by adding .patch to the URL.
For example:
https://github.com/CyanogenMod/andr...mmit/e8ba824b16a3575d9a4c5d85dce6d3800970d093
becomes
https://github.com/CyanogenMod/andr...8ba824b16a3575d9a4c5d85dce6d3800970d093.patch
If you download that .patch file, it can be applied using:
Code:
git am <patchfile>.patch
FYI, on your own machine, if you want to export such a patch for distribution, use
Code:
git format-patch
For example:
Code:
git format-patch HEAD~3
Would output the last 3 patches you committed in "git am" committable form.
FYI, this is why any developer who tells you that releasing source code for test kernels is not feasible is full of BS. It's understandable that you don't want to push test commits to a public repo, but it's perfectly feasible to meet the requirements of the GPL by providing formatted patches.
As an example: http://forum.xda-developers.com/showpost.php?p=22925793&postcount=339
Click to expand...
Click to collapse
FYI, you use a lot of `FYI` in your post lol.
Sent from my Nexus 7 using Tapatalk 4

Related

How to get RC30 source code from git?

Hi,
In the android git repository, there are three branches/tags. The default one is master. cupcake is the most famous. The last one is release-1.0 but which is not the RC30 release (it can't be compiled at all).
I doesn't know git well, so I must miss some tags for RC30. Is there anyone can tell me how to get the RC30 source code? Big thanks!
Sunner
Try:
repo init -u git://android.git.kernel.org/platform/manifest.git -b release-1.0
jashsu said:
Try:
repo init -u git://android.git.kernel.org/platform/manifest.git -b release-1.0
Click to expand...
Click to collapse
I've tried this command before. There were some error like "nowhere" when "repo sync". And I've mentioned in the first post that the release-1.0 can't be compiled at all. So many .c files in it miss including some header files.
Can't compile? Hmm... Well I am not working with the release-1.0 branch anymore so I can't be of much help there.
As for the source code used to produce G1 Android builds RC19-RC30, those were never made public. All Android platform development prior to cupcake was divided between openly available and private internal branches. The reasons for this are manifold and infinitely debatable in merit. One reason you can not build a true RC30 from the public repo is that they can not legally distribute proprietary modules from there.

[Q] Best way to cherry pick changes from the CyanogenMod code review?

So I set up a chain of scripts to build, package, and deploy CyanogenMod kang builds on Ubuntu 11.04 according to the guide in this thread: http://forum.xda-developers.com/showthread.php?t=1067519
Now that I can successfully build CyanogenMod, I'm wondering what the best (quickest, easiest, etc.) way is to cherry pick changes from the CyanogenMod code review which is found here: http://review.cyanogenmod.com/#q,statuspen,n,z
For example, if I wanted to allow the user to choose whether or not to show the "Hold" button in calls, I would need to pull this change: http://review.cyanogenmod.com/#change,6104. What would be the best way of doing this?
Thanks in advance for any help!
When I try to use the git cherry-pick command found on the commit page, I get this error: "fatal: You do not have a valid HEAD"
hmmm I would
Code:
cd android/system/packages/apps/Phone/
and then do
Code:
git pull http://review.cyanogenmod.com/p/CyanogenMod/android_packages_apps_Phone refs/changes/04/6104/1
but I'm pretty new on this too.
I've been building from source for a couple of weeks now and just finished my first kernel from source but I'm having problems pulling commits.
Whenever I try to pull or cherry-pick I get
Code:
fatal: Not a git repository (or any of the parent directories): .git
Were you actually able to pull the commit? I'm doing this from android/system. Should I be in a different folder?
Try this little tutorial. ^_~
http://forum.xda-developers.com/showpost.php?p=23527685&postcount=29
The important part that I was missing was to be in the correct directory based on the patch.
For instance
Code:
cyanogenmod dot com/p/CyanogenMod/android_packages_apps_Phone refs/changes/04/6104/1
would have to be in android/packages/apps/Phone
and
Code:
cyanogenmod dot com/p/CyanogenMod/android_frameworks_base refs/changes/29/11129/8 && git checkout FETCH_HEAD
would be in android/frameworks/base
Thanks for the help on this

[GUIDE] How to Build and Package a Kernel [D2]

This thread aims to be a comprehensive guide to building and packaging kernels for US Variant Samsung Galaxy SIIIs
In my opinion, a kernel is a great way to get into building things for your device and its pretty easy to do too.
Intro
What is a kernel?
http://en.wikipedia.org/wiki/Kernel_(computing)
This guide is for US SGSIII's (d2att,d2cri,d2mtr,d2spr,d2tmo,d2usc,d2vzw,others?)
It may be possible to adapt this to other devices, but I am not responsible for anything that happens should you try to do this.
This guide assumes you have a general knowledge of the Linux operating system. If you've never used it, you might consider playing around
with it for awhile before attempting this guide.
Click to expand...
Click to collapse
Prerequisites
On all devices you must be rooted, on Verizon SGS3 (d2vzw) you must also have the unlocked (VRALE6) bootloader installed.
This is not the thread for figuring out how to do this. You can use the forum's search function to figure out how to do this on your device.
You'll need a computer or a virtual machine running ubuntu. You may be able to figure out how to get this working on other distributions,
but since ubuntu is generally the most accepted distribution to use for building android things, I'll stick to using that here.
At the time of this writing, I'm using ubuntu 12.10, 64-bit.
You'll need to install some packages on your ubuntu machine:
Code:
sudo apt-get install build-essential git zip unzip
On 64-bit you'll also need some multilib and 32-bit compatibility packages:
Code:
sudo apt-get install gcc-multilib g++-multilib lib32z1-dev
Click to expand...
Click to collapse
Setting up the Build Environment
Next, you'll need a toolchain which is used to actually build the kernel. You may download one of these:
GCC 4.4.3: Download || Mirror
GCC 4.6: Download || Mirror
GCC 4.7: Download || Mirror
If you aren't sure, go for 4.4.3 or 4.6.
4.7 requires some code changes to work. The original kernel developer may or may not have made these changes.
Here is what I needed to do in order for 4.7 to build, boot and have wifi work:
https://github.com/invisiblek/linux-msm-d2/commit/f8d7199d37cfbfa1bcb6b4bcae3fc15ae71fbdea
https://github.com/invisiblek/linux-msm-d2/commit/ea58076501e5874db7b934c215c4dae81ddfd0a6
The toolchains are also available in the android NDK.
*** There are many toolchains out there, some of you may know of the Linaro toolchain which is aimed to optimize your binary even further ***
*** If you choose to use a different toolchain, that is fine. Keep in mind that you may run into issues depending on the toolchain you use ***
You can check what your currently running kernel was built with by issuing these commands:
Code:
adb root
adb shell cat /proc/version
It should return something like:
Linux version 3.4.0-cyanogenmod-gc4f332c-00230-g93fb4aa-dirty ([email protected]) (gcc version 4.7 (GCC) ) #134 SMP PREEMPT Thu Feb 28 00:22:41 CST 2013
Click to expand...
Click to collapse
This shows my particular kernel here was built with GCC 4.7
You can use wget to download one of the links from above, in this instance we'll download version 4.4.3 from the first link:
Code:
wget http://invisiblek.org/arm-eabi-4.4.3.tar.bz2
Extract this to somewhere you will remember, probably your home directory.
Code:
mkdir arm-eabi-4.4.3
tar -xf arm-eabi-4.4.3.tar.bz2 -C arm-eabi-4.4.3/
Click to expand...
Click to collapse
Obtaining Source
Find someone's source to use as a base. This can be a source archive from Samsung, a kernel tree from CyanogenMod, or any other developer around that makes kernels for your device.
TIMEOUT
This is a good spot to stop and take note that the Linux kernel is licensed under the GNU General Public License (GPL): http://www.gnu.org/licenses/gpl-2.0.html
What does this mean you ask? It means that if you plan to share your kernel with the community (if it's good, please do so!) then you MUST share your
source code as well. I am not liable for what you choose to do once you start building kernels, but know this: if you share your kernel and do not
provide source code for it, you will get warnings from XDA for a determined amount of time, after that you may have your threads closed, deleted and
possibly your user account terminated. This is extremely important!
Also, you may run into more problems than just XDA. There are organizations out there that do take action if you consistently refuse to comply with the GPL.
I recommend you read this: http://www.gnu.org/licenses/gpl-2.0.html so that you are familiar with what legalities you are getting yourself into.
The main thing to remember is to share your source code if you decide to share your built kernel.
Click to expand...
Click to collapse
In this instance, we will use CyanogenMod's kernel source for the US Galaxy S3's. You may browse the source code here:
https://github.com/CyanogenMod/android_kernel_samsung_d2
You'll notice that the branch there is cm-10.1
This is the default branch of this repository on github. This means that if you intend to build this branch, you'll need to use it on CM version 10.1. Most
likely it will not function on another version.
To obtain the source code:
Code:
git clone https://github.com/CyanogenMod/android_kernel_samsung_d2
This will take a little while, be patient.
When done, you'll have a directory called android_kernel_samsung_d2, cd into this directory.
Code:
cd android_kernel_samsung_d2
Next, you'll need to set up a couple environment variables. These tell the system two things:
1. What CPU architecture to build for, in this case arm
2. Where to find the toolchain we downloaded earlier, so that the system can cross compile for arm
Code:
export ARCH=arm
export CROSS_COMPILE=~/arm-eabi-4.4.3/bin/arm-eabi-
You'll need to set these variables on each new session. You can modify your Makefile in the root of your kernel tree in order to have these set permanently.
Click to expand...
Click to collapse
Building
At this point you can make any changes to the source code that you want. If this is your first time, I recommend not making any changes and make sure you have a
sane build environment before adding any complications.
When you build a kernel, you need to choose a defconfig. This is a specialized configuration file, specifically tailored for your device.
CyanogenMod names their defconfigs for their devices like so: cyanogen_<device>_defconfig and they are located in arch/arm/configs/
Code:
ls arch/arm/configs/cyanogen*
In this example, we will build for d2vzw.
Set up your tree to build for the d2vzw:
Code:
make cyanogen_d2vzw_defconfig
(do this in your kernel's root directory, in this example it was android_kernel_samsung_d2/ )
Now you are ready to build:
First, determine how many cpu's your computer has. You'll use this number to determine how many jobs the compiler command will use. The more jobs you can use, the more
cpu threads the compile will take advantage of, thus you'll get faster builds. If you don't know, just assume you'll use the number 2. We'll use 2 as an example here.
Code:
make -j2
Where 2 is the number of CPU cores your build system has.
And now we wait...until it's done compiling...
You'll know it successfully compiled when you have this line when it stops:
Kernel: arch/arm/boot/zImage is ready
Click to expand...
Click to collapse
PROTIP:
If it stops somewhere other than "zImage is ready" then you had build errors. Try running the 'make' command with no options after it. This will run the compile on a single thread
and will cause it to stop compiling as soon as it hits an error. When you run it on multiple threads, it definitely goes much faster, but if an error occurs, the console doesn't stop
until it finishes all of its threads. Causing you to have to scroll up and search around for an error
Click to expand...
Click to collapse
Now, assuming the build completed successfully, you have two things you are concerned with: A zImage (the kernel binary itself) and your kernel modules, which get built based
on what was configured in your defconfig.
You'll find your zImage at: arch/arm/boot/zImage
Code:
ls arch/arm/boot/zImage
The modules are scattered all over the place, depending on where the source existed that they were compiled from. We can easily search for them using this command:
Code:
find . -name "*.ko"
If both of the previous commands completed, you are now ready to package your kernel up for testing.
Move up a directory before continuing.
Code:
cd ..
Click to expand...
Click to collapse
Packaging
You may know of an awesome developer by the name of koush.
Well, once upon a time, koush created a rather simple zip, called AnyKernel, that would flash a kernel on a device, regardless of what ramdisk the kernel has on it.
I've taken his zip and modified it for d2 devices and to work with the newer recoveries out there.
This has a script in it that will dump your current boot.img (kernel+ramdisk), unpack it, replace the kernel, repack it and flash it.
It'll also copy any modules to the proper directory (/system/lib/modules) and set permissions appropriately.
You can get a zip here: Download || Mirror
(You can get it here as well: https://github.com/invisiblek/AnyKernel )
(Everyone is invited to use this zip, it'll probably make your life easier to not have to worry about the ramdisk. Enjoy!)
IMPORTANT
This AnyKernel package is for US variations of the Galaxy S3.
NOT the international (I9300) or any other device.
There are checks in the updater-script that will ensure you are running a d2 device before it does anything.
If you were to remove these checks, and not modify the partition that it flashes to later, you could end up with a brick.
If you intend to adapt this package for another device (please, do this! its a very handy script!), make sure you know it well, or ask someone to help you determine your device's
partition scheme before using it.
The risk here is due to the fact that the script doesn't know your device's partition scheme. It is configured specifically for the d2 devices. Flashing it on something else, who's boot
partition is somewhere else, might cause a bad flash to the bootloader partition (bad bad news if this happens).
Just be careful if you want to use this on another device. You won't run into problems if you use this on a d2 device.
EDIT: I made modifications that should make this less likely, but please, if you intend to use this on a different device (which is completely fine!) make sure you configure
the scripts to flash to the proper partitions.
Click to expand...
Click to collapse
Download and extract one of the above, we'll again use the first link for this example:
Code:
wget http://invisiblek.org/AnyKernel_samsung-d2.zip
unzip AnyKernel_samsung-d2.zip -d AnyKernel/
Now we'll copy our newly compiled zImage (still referring to the same kernel directory we used above, your repo might be called something different)
Code:
cp android_kernel_samsung_d2/arch/arm/boot/zImage AnyKernel/kernel/
cp `find android_kernel_samsung_d2 -name "*.ko"` AnyKernel/modules/
Finally we are ready to zip this up and test out flashing it.
Code:
cd AnyKernel
zip ../MyAwesomeKernel.zip -r *
cd ..
You'll now have a file named MyAwesomeKernel.zip which you should be able to flash via custom recovery (TWRP or CWM)
Click to expand...
Click to collapse
Extra Credit/Protips
Learn to use git. It's very powerful and great way to store your code.
Learn to use adb. It's an invaluable tool for any android developer.
Touchwiz and AOSP-based kernels are different. This means you cannot take CyanogenMod's source, build a kernel and expect it to work on a Touchwiz-based ROM.
Build a ROM next: http://wiki.cyanogenmod.org/w/Build_for_d2vzw
Crackflash your own stuff!
ALWAYS NANDROID!
Click to expand...
Click to collapse
Source code for all of my projects can be found here: http://github.com/invisiblek
FAQ
Q: How do I update my source tree to the latest that is available from where I downloaded it?
A: This can be handy if, for instance, you are building a CyanogenMod kernel and they added some patches, after you downloaded the source, that you want to include in your next build. You'll want to cd to your kernel tree and issue a git pull:
Code:
cd android_kernel_samsung_d2
git pull
You may then continue with the building instructions.
This may, however, have other problems if you've made changes to files. You might run into conflicts. I won't cover fixing any of this here, its not in the scope of this thread.
Q: I'm using X as a kernel base, but Y has a patch that I really like. How do I get it in my kernel easily?
A: I'll let you check Google for this answer, but I'll give you a hint use: git cherry-pick
Nice tutorial bro! Always good to learn something new everyday
Really is a good thread,thanks
This guide would have made things too easy for me.
Too easy, indeed. haha
Great job, invisiblek! AnyKernel is the beez neez.
Ok so this is a noob question but I gotta ask anyway lol. Ok so I cloned the kernel source, I made my edits, now how do I push all this to my github?
I already have a github account, I already made a new repo for the kernel. Here's a link to my github if you need it...
https://github.com/ghicks12/d2vzw_kernel.git
spc_hicks09 said:
Ok so this is a noob question but I gotta ask anyway lol. Ok so I cloned the kernel source, I made my edits, now how do I push all this to my github?
I already have a github account, I already made a new repo for the kernel. Here's a link to my github if you need it...
https://github.com/ghicks12/d2vzw_kernel.git
Click to expand...
Click to collapse
git remote add origin git_location_you_created_on_github.git
git push -u origin somebranch
The -u is for first time run only, you can just git push afterwards.
Sent from my SCH-I535
GideonX said:
git remote add origin git_location_you_created_on_github.git
git push -u origin somebranch
The -u is for first time run only, you can just git push afterwards.
Sent from my SCH-I535
Click to expand...
Click to collapse
Thanks! When I run
Code:
git remote add origin https://github.com/ghicks12/d2vzw_kernel.git
I get this back:
Code:
fatal: remote origin already exists.
I'm editing a CM based kernel, not sure if that matters or not?
That just means you added the remote already. Just issue the push command then.
Sent from my SCH-I535
Why is this happening? I don't know what i did wrong
[email protected]:~/cm$ make VARIANT_DEFCONFIG=cyanogen_d2att_defconfig
scripts/kconfig/conf --silentoldconfig Kconfig
drivers/media/video/msm/Kconfig:123:warning: choice value used outside its choice group
drivers/media/video/msm/Kconfig:128:warning: choice value used outside its choice group
***
*** Configuration file ".config" not found!
***
*** Please run some configurator (e.g. "make oldconfig" or
*** "make menuconfig" or "make xconfig").
***
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
[email protected]:~/cm$
Hey. I'm having some problems with some GIT terminology and procedures. I'm a .NET developer and I use TFS and SVN on a daily basis. Forgive me if this is complete off basis from what you'd do with GIT.
What I want to do is merge one branch into another branch. In other words I want to take the latest kernel source from my favorite dev and merge in the latest from cyanogen's 4.3 d2 branch. Is this a rebase thing? It doesn't seem like cherrypicking to me.
I have successfully compiled kernel and made modules.I inserted zImage and modules inside any kernel updater,flashed via TWRP.When reboot stuck in odin and it says could not do normal boot.

[guide] compile aosp from source

the tools needed :
You will need a PC if not you wouldn’t be reading this.
A Github account created with Git installed on your system and if possible some knowledge on git commands or time to research on them if not known.
For a head start on some commands please refer to the excellent guide on XDA by forum moderator eagleeyetom called [Guide] How to use Github and can be found by searching on xda developers website.
Some experience with terminal if using Linux
A device and vendor tree for your device
Your AOSP rom of choice
Some hours of your time to work on this
This can be done on any platform that has git supported so windows, linux or mac but you will need linux to build android. In this guide I shall be using linux as it’s my preferred system and my distribution of choice at the moment Zorin OS 6 as I have found it to be the fastest and least resource hungry OS for me so far. So all commands in this guide will be using terminal.
For a guide on how to setup an android environment please refer to the guide on how to compile from source found on XDA-U
and for git here - https://help.github.com/articles/set-up-git —->
This is a perfect tutorial and one needed to begin your learning process.
Throughout this guide I shall refer to device repo or device tree they mean the same thing. It’s just different ways I like to refer to them. It means the device repository.
Ok now to the tutorial :
Once git is setup we now want to look for the device’s repo …
If CM or another AOSP rom is already available for your device then look for the github page for it by either searching on google or looking for your developer’s github page.
Here is how one looks :
As shown above the name setup is usually something like android_device_manufacturer_device or device_manufacturer_device. This can be used to help find the device tree using a search engine.
Ok once we find that we are going to fork the device repo so we can edit it to work with the AOSP rom we are porting. As different roms use different configurations for their setup.
You can fork a project by clicking the fork button on the top right of the github page like so -
Once that’s done we’re going to need to fork your device’s proprietary vendor files. Cyanogenmod usually names their repos differently to some other teams so when searching for for a vendor repo for your device on Cyanogenmod it will be properietary_vendor_manufacturer, whereas others teams might just name it vendor_manufacturer.
Now once that’s done go to the github page of the AOSP rom that is being ported and also fork their vendor setup repo so we can add the device to the setup so it can be called later on when we run the . build/envsetup or source build/envsetup.sh command this allows us to compile the rom after when we have selected our target device.
Once that’s done we are now going to start cloning these repos onto your local machine so we can modify some files to add our device. Best way to do this is create a new directory where all the work is going to be done in your home folder and cd into that directory. So mkdir directory(name it whatever you want), then cd directory. So for example if the name of the new directory was named github then the commands will be mkdir github, cd github. Once that’s done navigate to your account page on github and clone the repos we forked earlier. To do this we look for the ssh url on each repo page then we copy it. Then we type git clone and paste the url and click enter on the keyboard. This will clone the repo from your github(remote) to your local(system) allowing you to make changes to the files then upload them back to github.
So when cloning is done the device, vendor tree and the rom’s vendor tree should be present. Now this is the part where we really need to switch on our brains. First go back to the github page of the rom’s vendor tree and click on commits now look through them and find one where a new device is added. Copy this new configuration and apply it to your device by either modifying existing files or creating new ones. To ensure no conflicts arise when envsetup.sh is ran try to make the product_name different but ensure the product_device and product_model are the same as the one in the device tree.
Once the device has been added what is left is to push the changes to your remote(github) by using the git push command. This can be done by first using git add -A which lets all the new files and changes to be tracked. Then we use the git commit -am ” message “. E.g git commit -am “Add defy to the mix”. This adds a commit message which will appear on our remote branch with the new changes. Finally we use git push origin to push the changes to our remote. E.g git push origin jellybean
Additionally look at some device setups on the rom’s github page and see if any changes are needed to make your device configuration compatible with the rom’s vendor tree. Usually none are need but it depends on how the person or team has setup their vendor tree.
Now this part is the longest and can be the most annoying process as we need to find the changes that are necessary to ensure the device boots when the rom has been compiled. This can be done in a number of ways but the best will be to kindly ask one of your device rom developer/s or member/s that have created the AOSP rom device tree that is been used to port the rom you’re porting. Depending on what type of device you have if it has a locked or unlocked bootloader then changes will have to be cherry-picked or merged in different places such as frameworks_base, system_core, etc.
Refer back to the git guide in the requirements on how to use these commands like git cherry-pick, git merge. I can’t really guide you here as each device is different so this is the part where you need your brain at maximum capacity.
Here you will be cloning all the repos where changes need to happen from the rom’s github page you’re porting. Then cherry-picking and merging these changes. Remember to first add the remote with git remote add before you start cherry-picking so the SHA number can be found.
Also remember to add your repos to the platform_mainfest or android(if it’s a CM based rom) Additionally, check your device maintainer’s setup to see if any additional repos any needed.
Once that has been resolved push the changes to your remote and make a new directory in your home directory then, repo init and repo sync, chose your device target with the lunch command and finally use mka to compile the rom. Pat yourself if it compile without errors.
Good Luck and Enjoy your hard work if it’s successful. However, if the unfortunate happens then report any issues here and me and the others members of XDA will try help out as this is XDA after all where we help each other, learn and expand our knowledge of Android.
Re: [GUIDE] Port AOSP ROMs using source code
Great guide, thx
exactly what i was looking for ... thanks OP
Nice guide!
Thank you a lot
I think you should change the title to "Compile AOSP from source" .
thachtunganh said:
Nice guide!
Thank you a lot
I think you should change the title to "Compile AOSP from source" .
Click to expand...
Click to collapse
changed
Sent from my Desire HD using xda app-developers app
Good to start with
A Good Guide to start with, Thanks a lot.
Nice work! Maybe add those screenshots "inline" so they flow with the text?
......... deleted....

[Q]Upload a project to GitHub

Hello guys, I wanted to add my project on GitHub so everyone can see it but i don't know if i am doing everything right.
this is mt project tree
Code:
~/name_of_the_project_folder/project_files
I created a repository on GitHub with the same name of my project and i want to put in there my project's files and that's how i'm doing it
Code:
$ cd ~/name_of_the_project_folder
$ git init
$ git add .
$ git commit -m "first commit"
$ git remote add origin [email protected]:blablabla
$ git push origin master
are these steps right?
One more question, 2 days ago i followe these steps but at 98% of the uploading project the terminal gave my a problem that was something like "maximum size reached" or something like that. My project weights about 7Gb, could you guys give me some directions on how to upload something like this? thanks in advance
matt95 said:
Hello guys, I wanted to add my project on GitHub so everyone can see it but i don't know if i am doing everything right.
this is mt project tree
Code:
~/name_of_the_project_folder/project_files
I created a repository on GitHub with the same name of my project and i want to put in there my project's files and that's how i'm doing it
Code:
$ cd ~/name_of_the_project_folder
$ git init
$ git add .
$ git commit -m "first commit"
$ git remote add origin [email protected]:blablabla
$ git push origin master
are these steps right?
One more question, 2 days ago i followe these steps but at 98% of the uploading project the terminal gave my a problem that was something like "maximum size reached" or something like that. My project weights about 7Gb, could you guys give me some directions on how to upload something like this? thanks in advance
Click to expand...
Click to collapse
You can try to clone it first and then copy the content, commit and push. That's a little nooby way, but works
Also if your project is so big, you should consider dividing it into some smaller parts and push.
Good luck.
eagleeyetom said:
You can try to clone it first and then copy the content, commit and push. That's a little nooby way, but works
Also if your project is so big, you should consider dividing it into some smaller parts and push.
Good luck.
Click to expand...
Click to collapse
thanks for the info, yeah i'm totally new to github that's why

Categories

Resources