Preface a long time no double Hugh a weekend, alas, gossip not much to say, no matter how much to learn to enrich themselves. Rom porting work is very cumbersome, involving a lot of knowledge, here to introduce the ROM porting often hear the use of nouns and repo tools.
AOSP, AOKP, CM believe that a lot of Android enthusiasts are familiar with these words, here is still to the new entry of friends to popularize the meaning behind the few words. AOSP is an abbreviation for "Android Open-source Project", the Chinese name is the Android open source project. Everyone knows that Android is an open-source operating system, so every Android version that Google releases will release the source code for the open source community, which is what we call the Aosp ROM, which can be called the purest Android system. You can use analogies to make things clearer, such as most pirated Windows systems in the country, almost all based on Microsoft's MSDN production, and AOSP ROM is equivalent to the Microsoft MSDN Mother's role. AOKP is "Android open-source Kang Project", a "Kang" more than AOSP. In the Android community, Kang said it was a custom-made ROM, a ROM from the private sector. CM is the abbreviation of CyanogenMod, the Cyanogen team is the world's largest third-party ROM compilation team, covering a very wide range of models, domestic well-known ROM such as MIUI, Hammer ROM are based on the CM implementation. In a strict sense, CM Rom belongs to the AOKP category. Although the CM ROM has always been in compliance with native Android, only Google's official AOSP is true.
Why use repo the AOSP described above is made up of many git-managed projects, such as 329 projects in Android4.2, each with a separate git repository. This means that if we are going to create a AOSP branch to do the new feature development, then we need to go to each sub-project to create the corresponding branch. This obviously cannot be done manually in each sub-project to create the branch, it must be handled in an automated manner. These automated processes are done by the repo tool. Of course, the repo tool is responsible for automating the task of not just creating a branch, but looking at the branching status, committing the code, updating the code, and so on, the git operation can be replaced by the repo.
The Reoporepo tool is made up of a series of Python scripts that perform their functions by invoking a git command. Interestingly, the Python script that makes up the repo tool is itself a git repository, and this git repository is called the Repo repository in AOSP, and every time we execute the repo command, the Repo warehouse will update itself. Above we are talking about the repo warehouse, but in fact we do repo command want to operate is AOSP. This requires the repo command to know which sub-items are included in the AOSP, and to know the name of the subproject and what the warehouse address is. In other words, it is the repo command to know the GIT repository meta-information for all AOSP sub-projects. Because AOSP is also constantly iterating, each version contains sub-items that may be different. This means that you need to manage git repository meta information for all of the AOSP's sub-projects through another Git repository. This git repository is called the manifest repository in AOSP. So far, we've mentioned three types of git repositories, namely the Repo warehouse, the manifest warehouse, and the AOSP sub-project repository. The Repo warehouse provides meta-information for all AOSP sub-project warehouses through the manifest warehouse. With these meta-information, we can manipulate AOSP's sub-projects by repo the Python script inside the repository. So, how did the repo warehouse and the manifest warehouse come from? The answer is obtained through a separate repo script, which is located on an official website of AOSP and can be downloaded via the HTTP protocol. Now, let's sketch a picture of the entire AOSP, which consists of the repo script, the repo repository, the manifest warehouse, and the AOSP sub-project repository, which is shown in 1:
Repo script we can get the latest repo script directly via the Curl command via the HTTP protocol:
$ Curl Https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo$ chmod a+x ~/bin/repo
Repo command
Repo Init-u <url> [OPTIONS]
Initializing the repo in the current directory will generate a. Repo directory in the current directory, just like the. git of the GIT project directory. -u: Specify a URL from which to get the repository manifest file. The obtained manifest file is placed in the. Repo directory, named Manifest.xml, and the contents of this file are all repositories managed by Git list. [Options]-M: choose to get a specific manifest file in repository, if not specified, then the default manifest file (default.xml). [OPTIONS]-B: Specifies a manifest branch. If you do not specify the-b parameter, the master branch is used by default.
Repo Sync [project-list]
Synchronize the code, download the latest local working file, the update succeeds, and the code in the local file and repository is consistent. You can specify which project needs to be updated, and if you do not specify any parameters, all git projects in the manifest file. If you are running Repo sync for the first time, this command is equivalent to Git clone, which copies everything in the repository to local. If you're not running repo sync for the first time, it's equivalent to running git remote update && git rebase original/branch
Repo Update [project-list]
Upload the modified code, if your local code has been modified, then run Repo sync, you will be prompted to upload the modified code, all the modified Code branch will be uploaded to Gerrit (Web-based Code review system). Gerrit receives the uploaded code and converts it into a change, allowing others to compare and review to modify the submitted code.
Repo diff [Project-list]
Displays the differences between the code that is currently being modified by project and the current work code.
Repo start new_branch_name [Specified-project]
Creates a new branch on the specified project.
Repo Branch
View all Branches
Repo Abandon <branch>
Deletes the specified branch, whether merged or not.
Repo ForAll [project-list]-C COMMAND
Executes command commands on the specified project list or all project.
Repo status
Displays the status of each project in the Repo warehouse.
Repo Download Target Revision
Download the specific modified version to local.
I understand that because the AOSP project is made up of many git repositories, if one of the git clones is too wasteful, you need to use the Repo tool to download the Git repository collection to the local. Once project has been downloaded locally, it can be manipulated directly with GIT commands for a single project. Because I'm more familiar with git commands, I don't need to memorize repo other than repo init commands, just use the corresponding GIT commands.
Android source repository and Repo tool use