How to Use git and repo to download the Android-2.6.29 Kernel

Source: Internet
Author: User
Tags how to use git

Git is Linux Torvalds to help manage Linux
An open source distributed version control software developed by the kernel is different from a centralized version control system such as subversion and CVS. There is only one warehouse in the centralized version control system.
Library (repository), multiple working directories (Working
Copy), while in a distributed version control system such as git (other major distributed version control systems include bitkeeper, mercurial, GNU
Arch, bazaar, darcs, SVK, monotone, etc.), each working directory contains a complete repository, which supports offline work, local submission can be submitted
Server. In theory, distributed systems are more robust than centralized single-server systems. Once a single-server system encounters a server problem, the entire system cannot run. distributed systems generally do not have one or two nodes.
Affected.

Because Android is composed of multiple git projects such as kernel, Dalvik, bionic, prebuilt, and build, the android project has compiled a Python script named repo to manage the repositories of these projects in a unified manner, this makes git easier to use.

In order to get the latest sourcecode of Android, William Learned some basic operations of git and repo, sorted out how-to for how to get the android code, and pasted it today.

1. Install git

Download the latest gitsource code package from http://git-scm.com/and decompress:

# Tar-xjf git-1.6.3.3.tar.bz2

Compile and install:

# Cd git-1.6.3.3

#./Configure

# Make; make install

# Git -- version

Git version 1.6.3.3

2. Install Repo

First, make sure to create a/bin directory under the current user's home directory (if not), and then put it (~ /Bin) added to the PATH environment variable

Download the repo script through curl and save it ~ /Bin/repo File

Curl http://android.git.kernel.org/repo> ~ /Bin/Repo

Do not forget to grant repo executable permissions

Chmod A + x ~ /Bin/Repo

3. initialize the version Library

If you want to take down all the sourcecodes in the latest version of the current Android main line, we need repo help.

First create a directory, such ~ /Android. Use the repo init command after entering the file.

Repo init-u git: // android.git.kernel.org/platform/manifest.git

This process will last for a long time (at least you can have a good sleep). The specific time depends on the network conditions.

The repo initialized in
/Android indicates that the local version library has been initialized and contains the latest sourcecode.

 

If you want to use a branch instead of the Code on the main line, you need to use the-B parameter to specify the branch name, for example:

Repo init-u git: // android.git.kernel.org/platform/manifest.git-B
Cupcake

In another case, we only need the code of a project, such as kernel/common, without Repo. Just use git.

Git clone git: // android.git.kernel.org/kernel/common.git

This also takes a lot of time, because it will copy the entire Linux kernel code.

If you need a branch code, use git
Checkout. For example, if we have just obtained the kernel/common. Get code, we should first enter the common directory and then use the following command:

Git checkout origin/Android-goldfish-2.6.27-B goldfish

So we built a local Android-goldfish-2.6.27 branch named goldfish, and the code was synchronized with the android-goldgish-2.6.27. We can use git
Branch to list all local branches.

4. Synchronize the version Library

Using the repo sync command, we synchronize the entire android code tree to the local device. Similarly, we can use

Repo sync project1 project2...

This command is used to synchronize several projects.

To synchronize a single project in Android, you only need to execute a simple

Git pull

You can.

5. Download Code through gitweb

In addition, if you only need the code of a project on the main line, you can also download the Code through gitweb and search for a specific version using keywords in audit log, you can also find several new tags to download.

Git was initially designed for Linux kernel development, so it is not good to support other platforms, especially Windows platforms, which must have cygwin. Now, thanks to the msysgit project, we can use git without cygwin. In addition, git
Extensions is a very useful Windows Shell extension, which can be closely integrated with the resource manager, and even provides visual
Studio plug-in. There is a good instruction document on its official website. If you are interested, you can take a look.

For git reference documents, I recommend git magic. Here is a Chinese version of git magic.

Obtain anroid Linux kernel:

[Root @ localhost ~] # Mkdir Bin

[Root @ localhost ~] # Curl http://android.git.kernel.org/repo
> ~ /Bin/Repo

[Root @ localhost bin] # cd bin/

[Root @ localhost bin] # chmod A + x ~ /Bin/Repo

 

[Root @ localhost bin] # cd/usr/local/src/

[Root @ localhost SRC] # mkdir project-android

[Root @ localhost SRC] # cd project-android/

[Root @ localhost project-android] # git clone
Git: // android.git.kernel.org/kernel/common.git

It will be downloaded for half a day. After the download is completed:

[Root @ localhost SRC] # cd common

[Root @ localhost common] # ls

Arch credits drivers include kbuild maintainers net samples sound

Block crypto firmware init kernel makefile readme scripts USR

Copying documentation fs ipc lib mm reporting-bugs Security virt

[Root @ localhost common] # git branch-

* Android-2.6.27:

Diff

Remotes/ORIGIN/head-> origin/Android-2.6.27

Remotes/ORIGIN/Android-2.6.25

Remotes/ORIGIN/Android-2.6.27

Remotes/ORIGIN/Android-2.6.29

Remotes/ORIGIN/Android-goldfsh-2.6.27

Remotes/ORIGIN/Android-goldfsh-2.6.29

To download the 2.6.29 kernel, run the GIT checkout origin/Android-2.6.29 command.

Check if the Code has changed to 2.6.29? I 've been depressed for a long time here. How can I always download 2.6.27 kernel code?

Related Article

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.