KernelGitGuide

Differences between revisions 4 and 23 (spanning 19 versions)
Revision 4 as of 2005-10-23 17:01:36
Size: 3567
Editor: richmond-209-163-125-229
Comment: Add Ubuntu kernel developer notes.
Revision 23 as of 2007-06-21 13:06:04
Size: 4955
Editor: a81-197-135-210
Comment: Warn about preserving local changes
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
= Where is it? =

http://kernel.ubuntu.com/

= Current GIT Trees =

 * gutsy: git://kernel.ubuntu.com/ubuntu/ubuntu-gutsy.git
 * feisty: git://kernel.ubuntu.com/ubuntu/ubuntu-feisty.git
 * edgy: git://kernel.ubuntu.com/ubuntu/ubuntu-edgy.git
 * dapper: git://kernel.ubuntu.com/ubuntu/ubuntu-dapper.git

(actually there are a few more and of special note are the -updates git trees. To find out what else is available try browsing http://kernel.ubuntu.com/git and searching for ubuntu)
Line 5: Line 18:
To obtain the git binaries, please go to [http://www.kernel.org/pub/software/scm/git-core kernel.org] and download the latest source. Folow the build instructions included, and make sure to install them in a location in your PATH.
To obtain the git binaries, simply install the `git-core` package from dapper, e.g.:
{{{
sudo apt-get install git-core
}}}

'''Note that the `git` package is an entirely different tool which will not do what you want.'''
Line 8: Line 27:
The Ubuntu Linux kernel git repository is located at rsync://rsync.kernel.org/pub/scm/linux/kernel/git/bcollins/ubuntu-2.6.git. To download a local copy of the repo, use this command: The Ubuntu Linux kernel git repository is located at git://kernel.ubuntu.com/ubuntu/ubuntu-<release>.git. To download a local copy of the repo, use this command:
Line 10: Line 29:
  git clone rsync://rsync.kernel.org/pub/scm/linux/kernel/git/bcollins/ubuntu-2.6.git ubuntu-2.6   git clone git://kernel.ubuntu.com/ubuntu/ubuntu-gutsy.git ubuntu-gutsy
Line 13: Line 32:
This will take some time depending on your connection. There's around 110Megs of data to download currently (and this always increases). This will take some time depending on your connection. There's around 220 MiB of data to download currently (and this always increases).
Line 18: Line 37:
}}}

'''** Warning **'''
During development, the kernel git repository is being constantly rebased against Linus' tree. IOW, Ubuntu specific changes are not being ''merged'', but rather popped off, the tree rebased and then pushed on to keep them on top. This will cause git pull to fail. To track the git tree during such a phase, the alternative set of commands are:
{{{
  git fetch origin master:new
  cp .git/refs/heads/new .git/refs/heads/master
  git reset --hard
}}}

Please keep in mind that {{{ git reset --hard }}} will destroy all local changes you might have made. In order to preserve them, use the following instead:
{{{
   git reset new
Line 26: Line 58:
In "debian/commit-templates/" there are several templates that must be used when commiting changes that you expect to be integrated with the Ubuntu kernel repo. The commit templates contain comments for how to fill out the required information. Also note that all commits must have a Signed-off-by line (the "-s" option to "git-commit"). An example commit log will look like such: In ''debian/commit-templates/'' there are several templates that must be used when commiting changes that you expect to be integrated with the Ubuntu kernel repo. The commit templates contain comments for how to fill out the required information. Also note that all commits must have a Signed-off-by line (the "-s" option to ''git-commit''). A typical ''git-commit'' command will look like:
Line 28: Line 60:
  [UBUNTU:scsi] My cool change to the scsi subsystem   git-commit -s -F debian/commit-templates/patch -e
}}}
Note that the -e (edit) option must follow the -F option, else git will not let you edit the commit-template before committing.

An example commit log will look like such:
{{{
  UBUNTU: scsi: My cool change to the scsi subsystem
Line 33: Line 71:
  magically to 1.7Gb/sec.   magically to 124GiB/sec.
Line 38: Line 76:
= Ubuntu kernel developers (with access to rookery) =
In order to have your git repo pulled automatically, follow these instructions.
= Developers with access to kernel.ubuntu.com =
The kernel team has a ''git'' repo located on ''kernel.ubuntu.com'' (AKA zinc.ubuntu.com) in /srv/kernel.ubuntu.com/git/ubuntu.
Line 41: Line 79:
First, login to rookery, and perform these commands. In order to have the git commands in your PATH, you can either install your own version locally in your homedirectory, or use some already there (adding ''/home/bcollins/bin'' to your path should work). Then perform these commands: You can, if you want, create a clone for yourself in your directory, and just have your changes pulled when ready.

Suggested way to do this:
Line 43: Line 84:
  mkdir public_html/archives
  cd public_html/archives
  git clone -s -n -l /home/bcollins/public_html/archives/ubuntu-2.6.git ubuntu-2.6
  mv ubuntu-2.6/.git ubuntu-2.6.git
  rmdir ubuntu-2.6
git-clone -l -n -s /srv/kernel.ubuntu.com/git/ubuntu/ubuntu-gutsy.git
vi ubuntu-gutsy/.git/description
( give it a descriptive name )
mv ubuntu-gutsy/.git /srv/kernel.ubuntu.com/git/<user>/my-git-tree.git
Line 50: Line 90:
This will create ~/public_html/archives/ubuntu-2.6.git. Note, this is not used for your to pull from (since you should always pull from rsync.kernel.org). However, you can let others pull from this repo if you have things you want them to test. The ''-s'' flag allows your repo to share objects with the main one. This helps reduce space used on rookery. You can now push your changes to this tree via '''ssh'''. Note the '''-l -n -s''' options do a few special things, mainly making your repo share objects with ours (saves space).
Line 52: Line 92:
Any work you do in the master (HEAD) will '''automatically''' be merged into the main repo. Any work that you perform that you wish to keep locally, should be done on a branch. Suggest method for keeping this tree synced with the ubuntu tree, instead of git-pull, is to do:

{{{
cd my-tree
git-fetch origin
git-rebase origin
}}}

This will keep your changes on top of the original tree (as opposed to being merged). This is also a good idea because during development (e.g. while following the upstream git repo), we frequently rebase to linux-2.6.git upstream, so the '''HEAD''' is not always suitable for pull/merge.
Line 55: Line 103:
Please read the documentation included with the git source for more details on git commands. Please read the documentation included with the '''git-core''' package for more details on git commands.

Summary

Git is the new SCM used by the Linux kernel developers. Ubuntu has adopted this tool for our own Linux kernel source code so that we can interact better with the community and the other kernel developers.

Where is it?

http://kernel.ubuntu.com/

Current GIT Trees

  • gutsy: git://kernel.ubuntu.com/ubuntu/ubuntu-gutsy.git
  • feisty: git://kernel.ubuntu.com/ubuntu/ubuntu-feisty.git
  • edgy: git://kernel.ubuntu.com/ubuntu/ubuntu-edgy.git
  • dapper: git://kernel.ubuntu.com/ubuntu/ubuntu-dapper.git

(actually there are a few more and of special note are the -updates git trees. To find out what else is available try browsing http://kernel.ubuntu.com/git and searching for ubuntu)

Getting GIT

To obtain the git binaries, simply install the git-core package from dapper, e.g.:

sudo apt-get install git-core

Note that the git package is an entirely different tool which will not do what you want.

Getting the Ubuntu Linux kernel repo

The Ubuntu Linux kernel git repository is located at git://kernel.ubuntu.com/ubuntu/ubuntu-<release>.git. To download a local copy of the repo, use this command:

  git clone git://kernel.ubuntu.com/ubuntu/ubuntu-gutsy.git ubuntu-gutsy

This will take some time depending on your connection. There's around 220 MiB of data to download currently (and this always increases).

Once this is complete, you can keep your tree up-to-date by running this command:

  git pull

** Warning ** During development, the kernel git repository is being constantly rebased against Linus' tree. IOW, Ubuntu specific changes are not being merged, but rather popped off, the tree rebased and then pushed on to keep them on top. This will cause git pull to fail. To track the git tree during such a phase, the alternative set of commands are:

  git fetch origin master:new
  cp .git/refs/heads/new .git/refs/heads/master
  git reset --hard

Please keep in mind that  git reset --hard  will destroy all local changes you might have made. In order to preserve them, use the following instead:

   git reset new

Pushing changes to the main repo

Since the main repo is not publicly writable, the primary means for sending patches to the kernel team is using git-format-patch. The output from this command can then be sent to the [mailto:kernel-team@lists.ubuntu.com kernel-team] mailing list.

Alternatively, if you have a publicly available git repository for which changes can be pulled from, you can use git-request-pull to generate an email message to send to the [mailto:kernel-team@lists.ubuntu.com kernel-team] mailing list.

Commit templates

In debian/commit-templates/ there are several templates that must be used when commiting changes that you expect to be integrated with the Ubuntu kernel repo. The commit templates contain comments for how to fill out the required information. Also note that all commits must have a Signed-off-by line (the "-s" option to git-commit). A typical git-commit command will look like:

  git-commit -s -F debian/commit-templates/patch -e

Note that the -e (edit) option must follow the -F option, else git will not let you edit the commit-template before committing.

An example commit log will look like such:

  UBUNTU: scsi: My cool change to the scsi subsystem

  UpstreamStatus: Merged with 2.6.15-rc3

  My cool change to the scsi subsystem makes scsi transfers increase
  magically to 124GiB/sec.

  Signed-off-by: Joe Cool Hacker <jch@reet.com>

Developers with access to kernel.ubuntu.com

The kernel team has a git repo located on kernel.ubuntu.com (AKA zinc.ubuntu.com) in /srv/kernel.ubuntu.com/git/ubuntu.

You can, if you want, create a clone for yourself in your directory, and just have your changes pulled when ready.

Suggested way to do this:

git-clone -l -n -s /srv/kernel.ubuntu.com/git/ubuntu/ubuntu-gutsy.git
vi ubuntu-gutsy/.git/description
( give it a descriptive name )
mv ubuntu-gutsy/.git /srv/kernel.ubuntu.com/git/<user>/my-git-tree.git

You can now push your changes to this tree via ssh. Note the -l -n -s options do a few special things, mainly making your repo share objects with ours (saves space).

Suggest method for keeping this tree synced with the ubuntu tree, instead of git-pull, is to do:

cd my-tree
git-fetch origin
git-rebase origin

This will keep your changes on top of the original tree (as opposed to being merged). This is also a good idea because during development (e.g. while following the upstream git repo), we frequently rebase to linux-2.6.git upstream, so the HEAD is not always suitable for pull/merge.

More information

Please read the documentation included with the git-core package for more details on git commands.


CategoryKernel

KernelTeam/KernelGitGuide (last edited 2010-06-28 23:55:41 by c-76-105-148-120)