[TUTORIAL] How to git - Samsung Galaxy S Blaze 4G

To sync your changes, for the first time github says to do this:
Code:
git init
git add <FILE NAME>
git commit -m "Initial commit"
git remote add <remote name> <url>
git pull <remote> <branch>
git push <remote> <branch>
Sometimes that works... sometimes it doesn't
Real way:
Code:
git remote add LZkernel [URL]https://github.com/TeamFahQ/msm8660-common_lz_kernel.git[/URL]
git add -A
git commit -m "I made some changes"
git push LZkernel HEAD:jellybean
git pull <remote> <branch>
git push <remote> HEAD:<branch>
Example
Code:
git pull LZkernel HEAD:jellybean
git push LZkernel HEAD:jellybean
sync upstream
Code:
git remote add <NAME> <URL>
git pull <NAME> <BRANCH>
git push <remote> HEAD:<branch>
Example
Code:
git remote add Cyanogenmod https://github.com/CyanogenMod/android_kernel_samsung_msm8660-common.git
git pull Cyanogenmod jellybean
git push LZkernel HEAD:jellybean
Code:
git remote add TeamFahQ https://github.com/TeamFahQ/msm8660-common_lz_kernel.git
git pull TeamFahQ jellybean
git push Thomas-is-a-BAMF HEAD:jellybean
How bout git fetch?
Well, I'm still new to using fetch, but here's that basics
Now let's say you want to add some spicey goodness froma particular commit. So you go on github.com and
find that commit. It is represented but a code, i.e. cac585fcd52fa5ed2e0fbbc4d2b292575ccc10a2 (or the short/nice number cac585fcd5)
You can find this by going to that particular repo, clicking on "commits" at the top and then finding the commit you want to pick.
Here's how we are going to do it:
Code:
git remote add <NAME> <URL>
git fetch <NAME> <BRANCH> (or you can use git fetch --all)
Now that we have to commits, it time to choose our commit and pick it.
You will now type:
Code:
git cherry-pick <COMMIT NUMBER>
But it's not all that easy..normally. Let's say we have conflicts. Usually the output will tell you what files conflict. You can either use:
git mergetool and fix them one bye one (provided you have a comparing program like meld), or you can open the files and look at them in your text editor.
I woul;d have to say, it is much easier with something like meld or beyond compare. This allows you to see your current file the lines to be merged and
the upstream files. But the best rule I use is this:
everything from:
Code:
<<<<<<<< HEAD
to
=============
is what you currently have.
Everything below
Code:
=============
to
cherry-pick <COMMIT DESCRIPTION>
is what will be inserted. I typically delete everything between
Code:
<<<<<<<< HEAD
to
============
as well as the pointers
Code:
<<<<<<<< HEAD
to
============
cherry-pick <COMMIT DESCRIPTION>
Leaving the new code, and it usually works out...lol
Now the we have our conflicts fixed we now must commit and continue. Simply type:
Code:
git add -A
git cherry-pick --continue
This will bring up the commit in nano (terminal). At this point, if you have text to add, you can added it, press ctrl+x, etc...
Another useful tool. Say you looked at the upstream of which you forked your repo from and see they have updated a few thing, and you want/need to add those changes. You can chery-pick, or merge with upstream:
Code:
git merge <NAME> <BRANCH>
fix conflicts
Code:
git add -A (The commit will come up in terminal)
git push <NAME> HEAD:<BRANCH>
Now, let's say you made A LOT, or a few changes. You built and found out they didn't work like how you wanted. Or you accidentally made changes and wanted to revert back to you original source. Here's what you can do:
Code:
git log
This will give you all the current commit numbers. Note the commit you want to revert back to and copy the commit number only (type q to exit). Now you can type:
Code:
git reset --hard <COMMIT NUMBER>
Now you repo is back to it's pre oops state as I like to call it...lol
According to git, this will undo ALL your changes and restore your repo back to that particular commits state; however, I have found that if you added a completely new file, it does not remove it. To check, type:
Code:
git status
This will tell you any files that are untracked and files that you have un-commited changes. I frequently use this command to track where I am with a project,and I also run this command before I commit to make sure I don't miss noting or commiting all my changes.
Now let's say you made changes and pushed them, but found later that you made a mistake. So you quickly git reset then try to push. However, you get a fast forward fail broke, holy crap I don't know what to do error... Well, there is a fix for that:
Code:
git push -f <NAME> <BRANCH>
You WILL be removing ALL changes the occurred before the particular commit you reset. So be sure you don't reset too far back...
You can now build and test your changes. After you have verified everything is a go, you can now push your changes to your repo.
This is a living document. I would actually like to see this stickied for quicker, easier access. As I learn new things, I will add on to this tutorial. Enjoy!

Nice

Related

Building rom from sources problem (32A)

I did all like there http://source.android.com/download
Then i tried to do http://github.com/koush/platform_vendor_htc_magic-open/blob/master/README.txt
And i have problem with building functional boot.img files with HTC offsets for the kernel:
[email protected]:~/mydroid$ pushd build
~/mydroid/build ~/mydroid
[email protected]:~/mydroid/build$ git cherry-pick 1e0847c2fcbe1b95464f32a719d2b9e620d1e6ec
Auto-merged core/Makefile
Finished one cherry-pick.
# Not currently on any branch.
nothing to commit (working directory clean)
[email protected]:~/mydroid/build$ git cherry-pick 6ea3b8856d656752c0310ca237ed99e7451be83b
Auto-merged core/Makefile
CONFLICT (content): Merge conflict in core/Makefile
Automatic cherry-pick failed. After resolving the conflicts,
mark the corrected paths with 'git add <paths>' or 'git rm <paths>' and commit the result.
When commiting, use the option '-c 6ea3b88' to retain authorship and message.
[email protected]:~/mydroid/build$ popd
~/mydroid
[email protected]:~/mydroid$ pushd system/core
~/mydroid/system/core ~/mydroid
[email protected]:~/mydroid/system/core$ git cherry-pick 67eacb9affe645dea23c753fcca0776c33a5eb2a
fatal: Could not find 67eacb9affe645dea23c753fcca0776c33a5eb2a
Click to expand...
Click to collapse
Without this when i start phone with my rom i see only htc logo. What do i do?

How do I upload to git?

I want to upload my custom kernel or rom to my git.
I have the SSH key setup.
But then I do:
git clone https://android.googlesource.com/kernel/samsung.git -b android-samsung-3.0-jb
then I do cd samsung
Global setup:
Download and install Git
git config --global user.name "Your Name"
git config --global user.email {username}@gmail.com
Next steps:
mkdir projectname
cd projectname
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin [email protected]:{username}/{projectname}.git
git push origin master
Click to expand...
Click to collapse
I only skipped the README part.
my git is https://github.com/jonashendrickx/Public-Jellybean

Supercharging your Github workflow with hub

Github being the world's biggest code hosting platform is also an OSS powerhouse. Their most under popularised creation is hub.
According to the official website, "hub helps you win at git". I'll be covering the installation and use below, and we shall see if we win or not
Installation
Installation is clean and easy. Download the latest release from https://github.com/github/hub/releases and unzip the archive. You should see the following files
Code:
.:
bin etc install LICENSE README.md share
./bin:
hub
./etc:
hub.bash_completion.sh hub.zsh_completion README.md
./share:
man
./share/man:
man1
./share/man/man1:
hub.1
Executing a simple ./install will install the hub binary, the man pages, and the hub+git bash completion script. You need to do one additional step before you're ready to use hub. Add alias git=hub to your .bashrc and then save it. Now every new terminal is ready to use hub, by using our good old git invocation.
Before adding the alias :
Code:
[email protected]:~$ git
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak your common history
branch List, create, or delete branches
checkout Switch branches or restore working tree files
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
merge Join two or more development histories together
rebase Forward-port local commits to the updated upstream head
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
After adding the alias:
Code:
[email protected]:~$ git
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak your common history
branch List, create, or delete branches
checkout Switch branches or restore working tree files
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
merge Join two or more development histories together
rebase Forward-port local commits to the updated upstream head
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
These GitHub commands are provided by hub:
pull-request Open a pull request on GitHub
fork Make a fork of a remote repository on GitHub and add as remote
create Create this repository on GitHub and add GitHub as origin
browse Open a GitHub page in the default browser
compare Open a compare page on GitHub
release List or create releases (beta)
issue List or create issues (beta)
ci-status Show the CI status of a commit
You will see the second code snippet has some additional commands listed. We'll be going over all of these shortly.
Functionality
hub lets you simplify your clone commands. To clone your own repos, just specify the repo name, as in git clone local_manifests
Code:
[email protected]:~$ git clone local_manifests
Cloning into 'local_manifests'...
remote: Counting objects: 69, done.
remote: Total 69 (delta 0), reused 0 (delta 0), pack-reused 69
Receiving objects: 100% (69/69), 8.55 KiB | 0 bytes/s, done.
Resolving deltas: 100% (23/23), done.
Checking connectivity... done.
[email protected]:~$ cd local_manifests/
[email protected]:~/local_manifests$ git remote -v
origin [email protected]:MSF-Jarvis/local_manifests.git (fetch)
origin [email protected]:MSF-Jarvis/local_manifests.git (push)
To clone someone else's repo, just add the username to it
Code:
[email protected]:~$ git clone regalstreak/skadoosh
Cloning into 'skadoosh'...
remote: Counting objects: 176, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 176 (delta 10), reused 0 (delta 0), pack-reused 153
Receiving objects: 100% (176/176), 27.75 KiB | 0 bytes/s, done.
Resolving deltas: 100% (67/67), done.
Checking connectivity... done.
[email protected]:~$ cd skadoosh/
[email protected]:~/skadoosh$ git remote -v
origin [email protected]:regalstreak/skadoosh.git (fetch)
origin [email protected]:regalstreak/skadoosh.git (push)
All standard switches are supported as well, so you can pass -b cm-13.0 with the clone command.
hub also makes forking a very easy task, simply type git fork in a cloned repository's folder
Code:
[email protected]:~/skadoosh$ git fork
Updating MSF-Jarvis
From ssh://github.com/regalstreak/skadoosh
* [new branch] lol2 -> MSF-Jarvis/lol2
* [new branch] lolita -> MSF-Jarvis/lolita
new remote: MSF-Jarvis
[email protected]:~/skadoosh$ git remote -v
MSF-Jarvis [email protected]:MSF-Jarvis/skadoosh.git (fetch)
MSF-Jarvis [email protected]:MSF-Jarvis/skadoosh.git (push)
origin [email protected]:regalstreak/skadoosh.git (fetch)
origin [email protected]:regalstreak/skadoosh.git (push)
git fork --no-remote will fork the repo but will not add a remote as it did in the earlier example.
Another powerful feature of hub is the ability to create Pull Requests from the terminal. Here you can see me adding a commit to @regalstreak's automated ROM source compression script
Code:
[email protected]:~/skadoosh$ nano compress.bash
[email protected]:~/skadoosh$ git status
On branch lolita
Your branch is up-to-date with 'origin/lolita'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: compress.bash
no changes added to commit (use "git add" and/or "git commit -a")
[email protected]:~/skadoosh$ git add -A
[email protected]:~/skadoosh$ git commit -asm "Exodus 6.0"
You need a passphrase to unlock the secret key for
user: "Harsh Shandilya (MSF Jarvis) <[email protected]>"
4096-bit RSA key, ID A950D459, created 2016-08-21
[lolita 6972288] Exodus 6.0
1 file changed, 3 insertions(+), 3 deletions(-)
[email protected]:~/skadoosh$ git push MSF-Jarvis lolita
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 1014 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To [email protected]:MSF-Jarvis/skadoosh.git
aeff4d3..6972288 lolita -> lolita
I pushed this commit to my fork of the repo (I could have pushed directly as well, I'm a contributor ). Now we'll see how to start a PR from MSF-Jarvis/skadoosh to regalstreak/skadoosh, from the terminal.
To start a PR, use the following command
Code:
[email protected]:~/skadoosh$ git pull-request -h MSF-Jarvis:lolita -b regalstreak:lolita
https://github.com/regalstreak/skadoosh/pull/33
This command brings up a PR message editor that behaves much like the commit message editor we see all the time. Fill in and hit enter
create lets you, umm, create a new github repository from the current local repository. create also accepts some flags, which you'll see below
Code:
[email protected]:~/hub-rocks$ git status
On branch master
nothing to commit, working directory clean
[email protected]:~/hub-rocks$ git create -p -d "Super secret stuff here" hub-rocks
Updating origin
created repository: MSF-Jarvis/hub-rocks
[email protected]:~/hub-rocks$ git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 897 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To [email protected]:MSF-Jarvis/hub-rocks.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
the 'hub-rocks' at the end is the repository name, which defaults to the current directory name, and goes up the folder structure until a folder name is found that does not match the name of an existing repository.
The created repo
{
"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"
}
browse lets you visit specific pages of any repo
Code:
git browse MSF-Jarvis/android_device_google_seedmtk commits
will open the commits view of my device tree repo for seedmtk
Code:
git browse regalstreak/skadoosh pulls
will show the PRs on @regalstreak's skadoosh repo, and so on.
compare is a pretty straight-forward command, to show a webpage with the diff between two tags, commits, or branches or a permutation of both.
Code:
[email protected]:~/skadoosh$ git compare -u MSF-Jarvis lolita..lol2
will compare the lolita and lol2 branches on my fork of regalstreak/skadoosh
release lets you create a new release on your repository and also adds tags, and uploads assets.
Code:
[email protected]:~/git-repos/reg-api$ git release create -a app.py v1.0
Uploading assets (1/1)
https://github.com/MSF-Jarvis/reg-api/releases/tag/v1.0
Which results in
issue works in a similar way
Code:
[email protected]:~/git-repos/reg-api$ git issue create -m "No authorisation enforced on endpoints" -l BUG,Will\ be\ fixed,Enhancement
https://github.com/MSF-Jarvis/reg-api/issues/1
Result
ci-status will show the Travis-CI response code for the latest commit on the repo and may return one of, success, pending, failure. On repos where CI has not been enabled, this returns a 404.
This is just a minor introduction to the things hub can do for you. Play around, and you'll find some more hidden goodies
@MSF Jarvis Another useful and awesome thread. I will check it out when I get home .
Very cool. Also another convenient thing I started doing with Hub is being able to `git clone user/repo` rather than having to manually copy&paste link to the repo. I’m definitely gonna use this extensively.
JacobVR said:
Very cool. Also another convenient thing I started doing with Hub is being able to `git clone user/repo` rather than having to manually copy&paste link to the repo. I’m definitely gonna use this extensively.
Click to expand...
Click to collapse
I just realized you can use the same notation for 'git remote set-url' as well, now how cool is that

How To Compile Rom From Source full guide step by step by Jai Sharma

How To Compile Rom From Source
We need following things to compile ROM from source
A Computer( Linux or Mac)
Java JDK
Some required Package for building Rom
Rules for Accessing USB devices
Choosing a Branch
Installing Java on the Machine
Here i am using Ubuntu(14.04 LTS) as a Linux machine but it should work for other Linux variant
Open a terminal and type following
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
This command will remove other existing openjdk installation
2. Once java is uninstalled use following command for installing correct version of java
sudo apt-get update
sudo apt-get install openjdk-s8-jdk
Check java version by typing following command
java -version
2. Installing some required packages
Type following in terminal to install some required packages
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
3. Downloading Repo Tool and setting PATH
mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now open the bashrc file and so we can include the repo tool:
sudo nano ~/.bashrc
Add following in the end of the file
export PATH=~/bin:$PATH
Now we need to reload bash variables to include the new path:
source ~/.bashrc
4. Initializing a Repo client
Now we need to create a directory where our source code will be downloaded. I am creating a directory AOSP here
mkdir AOSP
cd AOSP
In the following command insert your name and email address
git config --global user.name "Your_Name"
git config --global user.email "Your_EMail"
Now care fully select your branch whether you are downloading aosp or Cyanogenmod
repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.0_r7
type your desired branch name after the -b. This also applies to Cyanogenmod
5. Downloading source code
Now start downloading source code by typing following
repo sync
Note: this may take some time depending upon your internet speed and also please make sure you have enough storage
6. Configuring USB Access
type your username in following command and type enter
wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
7. Now building Rom for your device
To build rom we need following
Device tree
Vendor tree
kernel
Finding device tree and Vendor Tree
To find your device tree search on Github or similar sources with your device code name. If you are lucky you will find it there and believe me it is the easiest way to build your rom rather than creating device tree and vendor tree from scratch
Your device tree will go on following location
device/device_manufacturer_name/device_codename
Same for vendor tree
vendor/device_manufacturer_name/device_codename
If you find device tree and vendor tree then how to download it
For device tree
git clone “Github url” -b (branch_tag) device/device_manufacturer_name/device_codename
2. For vendor tree
git clone “Github url” -b (branch_tag) vendor/device_manufacturer_name/device_codename
Note1: You may need to change some files if everything is not working or giving you some error in rom compiling. Look into output to find out error. You can use Google if you can't correct it
Note2: You may be not found your device tree and vendor tree then what to do?. You may need to create them. Please follow my guide
Creating Device tree and vendor tree from scratch
For creating device tree
http://azodik.com/how-to-create-device-tree-for-android-rom-building/
2. For creating Vendor tree
“Coming Soon”
Kernel
For kernel part if you are lucky than you can find your kernel source from Github or similar sources. If not you can use your prebuilt kernel Foolow this to extract your kernel http://azodik.com/how-to-create-device-tree-for-android-rom-building/
Kernel location
/kernel/device_manufacturer_name/device_codename
Downloading your kernel
Manually download it and extract to kernel location or use following command
git clone “Github url” kernel/device_manufacturer_name/device_codename
Note1: You can use your prebuilt kernel. To use your prebuilt kernel edit BoardConfig.mk file in your device tree.
Note2: If you created device tree from scratch following my guide. Use of prebuilt kernel set to default
How to build
Use following command for building your rom
Source build/envsetup.sh
lunch
Now select your device from menu
3. make or mka
I hope you found it usefull. Please follow my website for interesting guide. Please comment here if you face any error.
Thank You
Really a great guide bro!
Can you please post a rom porting guide? easy to understand and effective
sohamsen said:
Really a great guide bro!
Can you please post a rom porting guide? easy to understand and effective
Click to expand...
Click to collapse
Thank you very much. Sure i will post soon.
jai44 said:
Thank you very much. Sure i will post soon.
Click to expand...
Click to collapse
Nice tutor.. But it looks need an enormous data usage to do that. If i wanna porting rom for example slim rom nougat to my device (kenzo) can you give me some info how many data should i provide and how to do that? Thanks
thanks
elanglangit said:
Nice tutor.. But it looks need an enormous data usage to do that. If i wanna porting rom for example slim rom nougat to my device (kenzo) can you give me some info how many data should i provide and how to do that? Thanks
Click to expand...
Click to collapse
You can follow this guide. Read it again and again. I hope soon you will build your own Rom. You can comment here if you face any problem
While compiling pure nexus. I got this error. How to solve thishttp://cloud.tapatalk.com/s/589b479597bc0/tapatalk_1486571095280.jpeg?
@jai44 wow! you make it look so easy! :') I have subscribed to this thread. When I get free time, Ill build my own rom
Thank you so much!
not able to sync rr source...
After i type repo sync it doesnt do anything. I double checked my site direction and it appears to be fine. Any hints??
could you please spare some time and make a post about how to create vendor tree?
can anyone help with this error while porting dotos rom for lenovo a700
/home/ubuntu/android/dotos/out/build-dot_aio_row.ninja is missing, regenerating...
device/lenovo/aio_row/board/ril.mk:4: error: cannot assign to readonly variable: PRODUCT_PROPERTY_OVERRIDES
10:14:07 ckati failed with: exit status 1
and ril.mk script
# RIL
BOARD_PROVIDES_RILD := true
BOARD_RIL_CLASS := ../../../device/lenovo/aio_row/ril
PRODUCT_PROPERTY_OVERRIDES += ro.telephony.sim.count=2
Hy I'm building lineage os 14.1 for SM-J250F
Samsung Galaxy J2 Pro 2018 (SM-J250F) but im not going to giveup .. so I'm started to build roms my self .. fixed some build errors and successfully compiled but it stuck on Samsung logo(no bootanimation) also took pstore logs but it only store recovery logs .. sir can you please help to make it boot? Can u kindly tell me what changes i need to do in sources to make it boot? Or can u fix the issue in my tree? Please I'm hoping your feedback
Source android base : Android 7.1.1
Tried compilation : Lineage OS 14.1
I cant post my tree links due to new account please pm
jai44 said:
How To Compile Rom From Source
We need following things to compile ROM from source
A Computer( Linux or Mac)
Java JDK
Some required Package for building Rom
Rules for Accessing USB devices
Choosing a Branch
Installing Java on the Machine
Here i am using Ubuntu(14.04 LTS) as a Linux machine but it should work for other Linux variant
Open a terminal and type following
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
This command will remove other existing openjdk installation
2. Once java is uninstalled use following command for installing correct version of java
sudo apt-get update
sudo apt-get install openjdk-s8-jdk
Check java version by typing following command
java -version
2. Installing some required packages
Type following in terminal to install some required packages
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
3. Downloading Repo Tool and setting PATH
mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now open the bashrc file and so we can include the repo tool:
sudo nano ~/.bashrc
Add following in the end of the file
export PATH=~/bin:$PATH
Now we need to reload bash variables to include the new path:
source ~/.bashrc
4. Initializing a Repo client
Now we need to create a directory where our source code will be downloaded. I am creating a directory AOSP here
mkdir AOSP
cd AOSP
In the following command insert your name and email address
git config --global user.name "Your_Name"
git config --global user.email "Your_EMail"
Now care fully select your branch whether you are downloading aosp or Cyanogenmod
repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.0_r7
type your desired branch name after the -b. This also applies to Cyanogenmod
5. Downloading source code
Now start downloading source code by typing following
repo sync
Note: this may take some time depending upon your internet speed and also please make sure you have enough storage
6. Configuring USB Access
type your username in following command and type enter
wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
7. Now building Rom for your device
To build rom we need following
Device tree
Vendor tree
kernel
Finding device tree and Vendor Tree
To find your device tree search on Github or similar sources with your device code name. If you are lucky you will find it there and believe me it is the easiest way to build your rom rather than creating device tree and vendor tree from scratch
Your device tree will go on following location
device/device_manufacturer_name/device_codename
Same for vendor tree
vendor/device_manufacturer_name/device_codename
If you find device tree and vendor tree then how to download it
For device tree
git clone “Github url” -b (branch_tag) device/device_manufacturer_name/device_codename
2. For vendor tree
git clone “Github url” -b (branch_tag) vendor/device_manufacturer_name/device_codename
Note1: You may need to change some files if everything is not working or giving you some error in rom compiling. Look into output to find out error. You can use Google if you can't correct it
Note2: You may be not found your device tree and vendor tree then what to do?. You may need to create them. Please follow my guide
Creating Device tree and vendor tree from scratch
For creating device tree
http://azodik.com/how-to-create-device-tree-for-android-rom-building/
2. For creating Vendor tree
“Coming Soon”
Kernel
For kernel part if you are lucky than you can find your kernel source from Github or similar sources. If not you can use your prebuilt kernel Foolow this to extract your kernel http://azodik.com/how-to-create-device-tree-for-android-rom-building/
Kernel location
/kernel/device_manufacturer_name/device_codename
Downloading your kernel
Manually download it and extract to kernel location or use following command
git clone “Github url” kernel/device_manufacturer_name/device_codename
Note1: You can use your prebuilt kernel. To use your prebuilt kernel edit BoardConfig.mk file in your device tree.
Note2: If you created device tree from scratch following my guide. Use of prebuilt kernel set to default
How to build
Use following command for building your rom
Source build/envsetup.sh
lunch
Now select your device from menu
3. make or mka
I hope you found it usefull. Please follow my website for interesting guide. Please comment here if you face any error.
Thank You
Click to expand...
Click to collapse
how much storage is used to sync sir?
BryanHafidz said:
how much storage is used to sync sir?
Click to expand...
Click to collapse
depend on rom for me los17 took almost 70gb

Building AOSP Emulator

Though it's not necessary to build AOSP to build AOSP emulator, but I will discuss it here anyway.
Note: From here on we are considering, $HOME/AOSP is our AOSP repo download folder.
Android Build:
-----------------
Everything are already explained in source.andorid clearly except some step. I am going to explain those.
1. Follow this url, "https://source.android.com/setup/build/requirements".
2. Replace branch name of,
repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
by going "https://android.googlesource.com/platform/manifest" and select chosen branch. Download may take up to 20 hours or more.
3. If not sure what argument to choose from lunch command, just type lunch and a bunch of options will be shown. Then select the correct one.
4. Replace "make –jN" to the number of threads you have in your PC. For example for a 4 thread processor "make –j4" will be the command.
5. If jack server has any memory issue run following command,
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
./prebuilts/sdk/tools/jack-admin kill-server
./prebuilts/sdk/tools/jack-admin start-server
Remember to replace –Xmx4g accordingly, here 4g means 4GB. Total build may take up to 9hrs.
6. After that, for every incremental build, type source and lunch command then make command for fresh started terminal otherwise only make will do.
Adding Default Application to android Source:
--------------------------------------------------------
1. Create an application in Android Studio.
2. We don’t need any gradle related folders for AOSP build. Take only java, assets and res folder and copy that in a new folder. Then take that folder to "AOSP/packages/apps" folder.
3. Add "Android.mk" file to that folder and add following lines (replace AppName accordingly and if app has assets un-comment line starting with "LOCAL_ASSETS_DIR"),
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := AppName
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, java)
# Include libraries
#LOCAL_JAVA_LIBRARIES := <Java lib dependencies>
LOCAL_STATIC_JAVA_LIBRARIES := android-common
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
#LOCAL_ASSETS_DIR := $(LOCAL_PATH)/assets
LOCAL_AAPT_FLAGS := --auto-add-overlay
LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.appcompat
include $(BUILD_PACKAGE)
4. Don't use newly introduced layouts, which may create run-time exception (use linear, relative or other old layouts). Also use properly scoped style. For example,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_weight="1"
android:text="Hello World!"
android:textAppearance="@android:style/TextAppearance.Large" />
</LinearLayout>
In andorid studio "android:layout_width" may be written as "layout_width" and "@android:style/TextAppearance.Large" may be written as "TextAppearance.Large". We've to add full scope to every item, as AOSP build doesn't use gradle build system.
5. Add app name to "PRODUCT_PACKAGES" variable of "AOSP/build/target/product/core.mk" and "AOSP/device/generic/armv7-a-neon/mini_common.mk" files.
6. Build app using make appName then use make –jN or make snod.
NOTE: In emulator, settings page might crash. To fix this, go to "AOSP/packages/apps/Settings/src/com/android/settings/wfd/WifiDisplaySettgins.java", replace existing code by code below,
public static boolean isAvailable(Context context) {
return false;
//return context.getSystemService(Context.DISPLAY_SERVICE) != null
// && context.getSystemService(Context.WIFI_P2P_SERVICE) != null;
}
Emulator Build:
------------------
1. Android emulator is build upon QEMU. Branch for QEMU on "https://android.googlesource.com" is named qemu and generic kernel is in goldfish branch. Note that though we can build goldfish kernel using simple make commands, we've used prebuilt kernel for our approach.
2. Emulator source:
git clone https://android.googlesource.com/platform/external/qemu
(note there is another branch named qemu-android, this branch is not used any more so avoid cloning that branch)
Goldfish source:
git clone https://android.googlesource.com/device/generic/goldfish
(not needed to build emulator)
3. Remember we've to use the appropriate branch after repo name for example for emulator we are using latest 2.8 version which is in branch, "emu-2.8-release". So our command will be,
git clone https://android.googlesource.com/platform/external/qemu-android -b emu-2.8-release
or we can switch to that branch after cloning for master.
4. After cloning, copy the whole directory to "$HOME/AOSP/external" folder, rename older to qemu (if we've cloned qemu into our chosen named folder). We need this because qemu build uses "AOSP/external" and "AOSP/prebuilt" folder for its dependencies. By doing this we can avoid copying multiple repos for emulator, as we've already pulled it during AOSP cloning.
5. Run,
./android/configure.sh
./configure
6. We need to clone some other branches to build the emulator. Below branches should be copied to external folder,
git clone https://android.googlesource.com/platform/external/gtest -b emu-2.8-release
git clone https://android.googlesource.com/platform/external/tinyobjloader -b emu-2.8-release
put below branches in prebuilts/android-emulator-build folder,
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/archive -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/common -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/curl -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/mesa -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/mesa-deps -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/protobuf -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/qemu-android-deps -b emu-2.8-release
git clone https://android.googlesource.com/platform/prebuilts/android-emulator-build/qt -b emu-2.8-release
also we may need below branch, (we've to put it in "prebuilts/clang/host/linux-x86" folder)
git clone https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86 -b emu-2.8-release
Note: if we look through git path of each branch they are same as AOSP folder structure. So we can get the hint, where to put them
If any ssl problem occures to download repo, run below command,
export GIT_SSL_NO_VERIFY=1
7. Run "make -jN". if any other things are missing we will be shown the message and please clone those items from googlesource and put it in the correct location.
8. If emulator build failed for warning the run this "./configure --disable-werror", then make again.
9. After successful build we will get obs folder. Replace contents of "$home/AOSP/prebuilts/android-emulator/linux-x86_64" by the contents of our built folder.
10. Go back to AOSP root folder, now if we run "emulator" command, our custom built emulator will be used from now on.
11. We can run "emulator -verbose" to see generated commands.
Note: to buid AOSP again, we need to remove qemu, gtest, tinyobjloader from AOSP source, as they interfere with AOSP prebuilt packages. So after buiding emulator remove those folders from AOSP source folder.
Some Commands:
----------------------
This commands may or may not be needed, depending on the status of Ubuntu or source code.
1. Adding qt library in path
export PATH=/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/gles_swiftshader:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/gles_angle:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/gles_angle9:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/gles_angle11:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/libstdc++:/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/qt/lib:$PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=/home/saikat/AOSP/prebuilts/android-emulator/linux-x86_64/lib64/qt/plugins
2. Library installation commands
apt-get install build-essential zlib1g-dev pkg-config libglib2.0-dev binutils-dev libboost-all-dev autoconf libtool libssl-dev libpixman-1-dev libpython-dev python-pip python-capstone virtualenv
sudo apt-get install libsdl1.2-dev libsdl1.2debian libsdl-gfx1.2-5 libsdl-gfx1.2-dev libsdl-gfx1.2-doc libsdl-image1.2 libsdl-image1.2-dbg libsdl-image1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dbg libsdl-mixer1.2-dev libsdl-net1.2 libsdl-net1.2-dbg libsdl-net1.2-dev libsdl-sound1.2 libsdl-sound1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev
sudo apt-get install libgtk-3-dev libspice-server-dev libusb-1.0-0-dev libusbredirparser-dev
3. QEMU default command, (not working just given for reference)
qemu-system-x86_64 \
-enable-kvm -smp 2 \
-append "console=ttyS0 vt.global_cursor_default=0 androidboot.selinux=permissive debug drm.debug=0 -device VGA" \
-m 1024 \
-serial mon:stdio \
-kernel $HOME/AOSP/out/target/product/generic_x86_64/kernel-ranchu \
-initrd $HOME/AOSP/out/target/product/generic_x86_64/ramdisk.img \
-drive index=0,if=none,id=system,file=$HOME/AOSP/out/target/product/generic_x86_64/system.img \
-device virtio-blk-pci,drive=system \
-drive index=1,if=none,id=cache,file=$HOME/AOSP/out/target/product/generic_x86_64/cache.img \
-device virtio-blk-pci,drive=cache \
-drive index=2,if=none,id=userdata,file=$HOME/AOSP/out/target/product/generic_x86_64/userdata.img \
-device virtio-blk-pci,drive=userdata \
-netdev user,id=mynet,hostfwd=tcp::5400-:5555 -device virtio-net-pci,netdev=mynet \
-device virtio-mouse-pci -device virtio-keyboard-pci \
-d guest_errors \
-nodefaults \
-display gtk,gl=on
I will add an sample app later
Sample emulator app
shoaibsaikat said:
I will add an sample app later
Click to expand...
Click to collapse
Here is the emulator client app
https://github.com/shoaibsaikat/ScreenTransferFromAndroidEmulatorToPhone
Why the emulator repo isn't updates since 6 years ago? Where is the emulator app right now?

Categories

Resources