User:Srilakshmi sonim/sandbox/CM Reference page
This is not a Wikipedia article: It is an individual user's work-in-progress page, and may be incomplete and/or unreliable. For guidance on developing this draft, see Wikipedia:So you made a userspace draft. Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
CM Reference page
Create SSH key
[edit]SSH public key is used to access source code present at build server 10.15.1.31 (ANDBUILD). Follow the below steps to generate the SSH key.
- Login to 10.15.1.31 (ANDBUILD) using your id and create a directory using the following command.
mkdir ~/.ssh chmod 700 ~/.ssh ssh-keygen -t rsa -C "username@sonimtech.com"
Note: When prompt to enter passphrase skip by pressing enter key.
Public key will be generated at ~/.ssh/id_rsa.pub , share this key with server admin (Naveen Balaji K) to provide access for git repositories.
Downloading the source
[edit]Source code received from SIMT is mirrored at 10.15.1.31 (ANDBUILD) machine, follow the below steps to download the local copy.
Installing Repo Tool
[edit]Repo is a repository management tool built on to of Git it makes easier to work with multiple git repositories.
- Create a bin directory under your home directory and included it in path environment variable.
- Download the Repo tool and change it as executable.
$ mkdir ~/bin $ PATH=~/bin:$PATH
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo
Initializing a Repo client
[edit]- Create an empty directory to hold your working files.
- Run repo init to bring down the latest version of code and must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.
- To set default editor like vim, invoke emacs while editing comments.
- Enter global username and email ID
- You can create a new tag on the local workspace using the below command.
- Push the new tag to remote repository. For example, the following sample contains remote git repository url
- Run the following command to view the difference between the two tags. .
- Create a new tag pointing the old tag, in working directory.
- Push tag from working directory to remote repository.
- Delete the old tag on remote repository.
- Delete tag from working directory.
- Check out the source from the tag.
- Login to 10.15.1.31 (with your user id) and create a branch directory.
mkdir <workspace_child_branch_name> cd <workspace_child_branch_name> Example: mkdir workspace_8926-X700-10152-COMMON-TECH Example: cd workspace_8926-X700-10152-COMMON-TECH
- Run the init command to get the latest of the parent branch, to create branch at HEAD of the parent branch.
repo init -u repouser@10.15.1.31:/home/repouser/gitrepos/simt_mirror/platform/manifest -b <parent-branch> Example: repo init -u repouser@10.15.1.31:/home/repouser/gitrepos/simt_mirror/platform/manifest -b 8926-X700-10152-COMMON
- If you need to use a manifest file, to create a branch at a stable point, follow the step 2 with -m option.
repo init -u repouser@10.15.1.31:/home/repouser/gitrepos/simt_mirror/platform/manifest -b <parent-branch > -m <manifest-file> Example: repo init -u repouser@10.15.1.31:/home/repouser/gitrepos/simt_mirror/platform/manifest -b 8926-X700-10152-COMMON -m <manifest-file> repo sync Example: repo sync
- Create branch on all projects using repo tool.
repo forall -p -c 'git checkout -b <new-branch_name / child branch>' Example: repo forall -p -c 'git checkout -b 8926-X700-10152-COMMON-TECH
- Push all branches to remote server.
- Verify the newly created branch by following command.
repo branches
- Go to directory .repo/manifests from the root directory of workspace.
cd .repo/manifests
- Create the manifest branch with git command.
git checkout -b <branch_name>
- Verify if the branch is created, using the following command.
git branch
- Set revision to new branch name in file \.repo\manifests\default.xml.
<default remote="sim" revision="branch_name"/>
- Commit changes to local repository.
git commit -am "Changed manifest file to reflect new branch"
- Push the manifest branch to remote repository.
git push origin <branch_name>
Note: This is the branch name given with -b option in repo init command. - Add the following entry to the wiki: http://10.15.1.17/kip/index.php/Smart_Phone_Release_Notes#AP_Source_Code
repo init -u ssh://username@10.15.1.31:29418/simt_mirror/platform/manifest -b <child branch / new branch> Example: repo init -u ssh://username@10.15.1.31:29418/simt_mirror/platform/manifest -b 8926-X700-10152-COMMON-TECH
- Test syncing a sample repo to verify the branch creation.
mkdir test_workspace cd test_workspace repo init -u ssh://username@10.15.1.31:29418/simt_mirror/platform/manifest -b <child branch / new branch> repo sync <test project / repo> Example : repo sync "platform/project"
git push origin --delete <branchName>
- Fetch the remote branch to local workspace.
git fetch <remote_name> <from_branch_name>
- Checkout the branch where cherry-pick to be applied.
git checkout -b <to_branch_name>
- Run cherry-pick with commit id.
git cherry-pick <commit_id>
- Once the cherry-pick commit is verified run the following command to push change to remote repository.
git push <remote_name> <to_branch_name>
- Find the branch from which the commit was generated.
git branch -a --contains <commit_id>
- Find the common ancestors between two commits.
git merge-base <commit_id_1> <commit_id_2>
- Identify the changes done in commit.
git show --format=full <commit_id>
- Edit the commit message.
git commit --amend
- Change the author details.
git commit --amend --author "New Author Name <email@address.com>"
- Build the apk file.
- Download the platform keys from Image:PlatformKeys.zip
- Run the below command to sign it with platform signature.
java -jar signapk.jar [platform cert *.pem] [platform cert *.pk8] [Source Apk path] [Target Apk path] Example: java -jar signapk.jar platform.x509.pem platform.pk8 bin/Test1.apk Test.apk
- The following git error might be generated.
error.GitError: manifests rev-list (u'^bbf87fd82774c4ffcaa46f12a04b969f68010880', 'HEAD', '--'): fatal: bad revision 'HEAD
This problem is due to wrong/corrupted .repo folder. locate this folder and delete the same, to resolve the issue. This folder is created accidentally in user home folder(~/) or (.) current folder. - Enter into fast boot (Power Key + Volume Up).
- Select the 2nd option in fast boot mode(apply update from ADB) and press OK(Power key). To navigate to 2nd option use volume down button.
- Enter adb sideload package path(c:/).
- Place a package in Innopath server.
- Launch MU Update app and download software and install the update.
- Press Vol down + power key.
- Enter the following command, to erase the user build boot image.
fastboot erase boot
- Keep the boot image file of ENG build in the command path and enter the following command.
fastboot flash boot boot.img
- Reboot the device.
- Pull the last log from the path to your system with the below command.
adb pull /cache/recovery/last_log c:/
- Login to repouser on build server 10.15.1.31 (ANDBUILD). Follow the below steps to sync the modem code.
- Check the modem code / path for the url: 10.15.1.17/kip/index.php/Smart_Phone_Release_Notes#CP_Source_Code, based on the the CP init commands and cd to the corresponding paths (inside the /home/repouser/gitrepos/)and run below commands. Refer to the following example for syncing modem code on 8926-X700-1011310-DEV branch.
login to 10.15.1.31 using userid repouser Example : cd /home/repouser/gitrepos/modem_code/AMSS.git git fetch --all
$ mkdir WORKING_DIRECTORY $ cd WORKING_DIRECTORY
$ repo init -u ssh://username@10.15.1.31:29418/simt_mirror/platform/manifest -b <branch_name>
Downloading Source Tree
[edit]Move the Android source tree to your working directory from the repositories as specified in the default manifest.
repo forall –p –c $ repo sync
Initializing a empty repo on a requested branch
[edit]Refer to http://kip.sonimtech.com/kip/index.php/Prashant_new_empty_repo_creation for more information.
Building the source
[edit]Initializing the Environment
[edit]Initialize the environment with the envsetup.sh script.
$ . build/envsetup.sh
Choosing a target
[edit]Choose which target to build with lunch. The exact configuration can be passed as an argument, e.g
$ lunch XP6700-Bell_Gen-eng
Cleaning the target
[edit]Run the following commands to clean the target.
$ make clean $ make update-api
Building the Code
[edit]Below command build the source, number adjecent to -j signifies the parallel jobs.
$ make -j4
Creating a Distribution TAR file
[edit]Run the below command to create target file which is used in FOTA packages.
$ make dist
Git Configuration
[edit]Global Configuration
[edit]git config --global core.editor "vim"
git config --global user.name "ABC" git config --global user.email abc@example.com
Tagging
[edit]Creating a New Tag
[edit]Lightweight Tag
[edit]repo forall -p -c 'git tag <tag_name>'
Annotated Tag
[edit]git tag -a <tag_name> -m "message"
repo forall -p -c 'git push sim <tag_name>'
repo forall -p -c 'git diff <oldtag>..<newtag>' | grep ^project
Updating tag to different commit
[edit]git tag -a <tag_name> <commit_id> -f git push <remote_name> <tag_name
Renaming the Tag
[edit]git tag <new_name> <old_name>
git push --tags
git push origin :refs/tags/<old_name>
git tag -d <old_name>
Checking Out from Tag
[edit]git checkout -b <branch_name> <tag_name>
Remote Branching
[edit]Follow the below steps to create a remote branch.
Project Branching
[edit]Create a workspace on the parent branch (i.e. from which child needs to be pulled) and sync it. For example, to create a branch 8926-X700-10152-COMMON-TECH (child branch) from 8926-X700-10152-COMMON (parent branch), complete the following steps.
repo forall -c 'git push sim <child branch >' Example: repo forall -c 'git push sim 8926-X700-10152-COMMON-TECH'
Manifesting the Branch
[edit]Deleting a Remote Branch
[edit]Cherry-pick from Remote Branch
[edit]Complete the following steps to cherry-pick from remote <from_branch_name> to local <to_branch_name>.
Identifying the Commit ID
[edit]Amending the Commit
[edit]FAQ
[edit]How to sign apk with platform keys?
[edit]To sign the apk file with platform keys complete the following steps.
FAQ FOTA
[edit]How can I upgrade Fota manually using adb side load?
[edit]To upgrade Fota manually using adb side load, complete the following steps.
How to do Fota Upgrade through Air
[edit]To upgrade Fota manually through air, complete the following steps.
How to change User build boot image file to ENG build boot image to collect the last_log
[edit]To change User build boot image file to ENG build boot image to collect the last_log, complete the following steps.
Creating a checking of the projects
[edit]SSH public key is used to access source code present at build server 10.15.1.31 (ANDBUILD). Follow the below steps to generate the ssh key.
mkdir ~/.ssh chmod 700 ~/.ssh ssh-keygen -t rsa -C "username@sonimtech.com"
Note: When prompted to enter passphrase skip by pressing enter key.
Public key will be generated at ~/.ssh/id_rsa.pub , share this key with server admin (Naveen Balaji K) to provide access for git repositories.
Downloading the source
[edit]Source code received from SIMT is mirrored at 10.15.1.31 (ANDBUILD) machine, follow the below steps to download the local copy.