Android Kernel Development: Understanding and mastering repo tools

Source: Internet
Author: User

Because Android source code is managed with repo tools, so, to engage in Android kernel development, first of all to understand what repo is, how it should be used? As the second installment of the Android Kernel Development series, let's first talk about understanding and using repo tools.


1. What is repo?


Repo is a code versioning tool that consists of a series of Python scripts that encapsulate a series of GIT commands for unified management of multiple Git repositories.


2. Why use repo?


Because Android source code refers to a lot of open source projects, each sub-project is a git repository, each git repository has a lot of branch version, in order to facilitate the unified management of the various sub-projects of the Git repository, need a top tool batch processing, so repo was born.


Repo also builds a git repository that records which branch of the GIT repository for each sub-project under the current Android version, which is often called the manifest repository.


3. How to install repo?


Official Repo script Download method:


Curl Http://commondatastorage.googleapis.com/git-repo-downloads/repo >./repo


As the official website is wall, the currently available repo script download method is as follows (choose one):


$ git clone git://git.omapzoom.org/git-repo.git$ git clone git://aosp.tuna.tsinghua.edu.cn/android/git-repo.git/$ cp Git-repo/repo./repo


or modify the repo file of the wall that is already in hand:


Repo_url = ' git://git.omapzoom.org/git-repo.git ' repo_url = ' Git://aosp.tuna.tsinghua.edu.cn/android/git-repo ' REPO_ REV = ' stable '


Of course, you can also go to my github to download this repo file, address:


Https://github.com/Jhuster/AOSP/blob/master/repo


4. How to download the source code?


Said above, the Android source code branch in fact by a call manifest warehouse to manage, therefore, download the source code first to clone this manifest warehouse. This repository contains an XML file, which is actually a list of files, which lists what code the repository relies on, where to download, and what the branch is.


Generally use the repo init command to clone this manifest warehouse, for example, if you want to download Android source code, the method is as follows:


$ repo Init-u https://android.googlesource.com/platform/manifest


Of course, the above official website is wall, therefore, the following image is recommended (choose one):


$ repo init-u git://git.omapzoom.org/platform/manifest.git$ repo init-u Git://aosp.tuna.tsinghua.edu.cn/android/ Platform/manifest


After initialization, you will see the contents of the manifest repository in the local. Repo folder, the most important file in this folder is Manifest.xml (some warehouses use default.xml and then point to specific XML), which is the list of files mentioned above.


You can use the-B option if you want to select a specific version of the Android source code or switch to a different version based on the downloaded source code:


$ repo init-u git://git.omapzoom.org/platform/manifest.git-b android-5.0.2_r1 $ repo init-u GIT://AOSP.TUNA.TSINGHUA.E Du.cn/android/platform/manifest-b ANDROID-5.0.2_R1


Then use the Repo Sync command to sync to download all the Android source code.


5. Composition of the list of manifest.xml documents


The above mentioned repo Init needs to initialize a manifest repository, The warehouse contains a very important list of manifest.xml files, in fact, this manifest.xml is not complicated, it is in the format of the XML file is the name of the various git repositories that the project relies on, address, and branch information. The common elements are as follows:


(1) Manifest top-level XML element


(2) Remote set the properties of a git server, such as name, root URL address, etc.


(3) project requires clone's Git repository, path represents a native path, and name indicates the relative path of the remote repository


(4) CopyFile perform copy operation, copy the file of url/$SRC address to./$dest


In fact, if you do not use the Repo tool, you can use Git clone directly against the Manifest.xml file list, a project that is downloaded by the one, and then git checkout specific branch for each project.


7. Common Repo Commands


This piece of online article a lot, I will not explain in detail, only list common commands.


(1) Repo init//Initialize Repo warehouse


(2) Repo sync//Download source code


(3) Repo start//Create Branch


(4) Repo checkout//Toggle Branch


(5) Repo branches//view Branch


(6) Repo status//view file statuses


8. Summary


About Repo tool is introduced here, have any questions welcome message or letter [email protected] exchange, also welcome to follow my Sina Weibo @ Lou _ June get the latest articles and information.


This article is from the "Shadow Three People" blog, please be sure to keep this source http://ticktick.blog.51cto.com/823160/1653304

Android Kernel Development: Understanding and mastering repo tools

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.