· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Git Guide For Kernel Development

1. Introduction

This article is written for tracking recent Linux kernel development. Especially focusing on setting up a development environment to follow up the speed of the kernel development and make a git pull request with a local change set.

2. Copyright and Acknowledgements

This document is copyright (c) Kwangwoo Lee (kwangwoo.lee at gmail dot com). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License.

4. Git repositories

The lists below show some repositories to track the kernel development. The ultimate repository is a Torvalds's repository. You can see many other repositories in http://git.kernel.org .

Torvalds's git repository.
  • git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

rmk's git tree for ARM architecture. Ben's git tree for s3c SoCs.
  • git://aeryn.fluff.org.uk/bjdooks/linux.git

Dmitry's git tree for input subsystem
  • git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git

u-boot git repository.
  • git://git.denx.de/u-boot.git

rt git tree for real time related work.
  • git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-rt.git

5. Git config

To setup a local development environment, your name and mail address are required. They are used for signing on a patch set, which you will post to the mailing list.

$ git config --global user.name "Your Name Comes Here"
$ git config --global user.email you@yourdomain.example.com

$ git config --global core.editor vim

$ git config --global color.branch "auto"
$ git config --global color.status "auto"
$ git config --global color.diff "auto"

The following link shows some other configuration examples:

6. Setup git server

It is assumed that we have two machines. One for a remote machine and the other for a local development. The remote machine is used for a public machine, which exposed to the other people in the world. So they can pull your repository. The local machine is used for a normal development for testing and amendment.

6.1. setup a remote git repository - public machine

$ cd /path/to/repo/
$ git clone -n --bare git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6-mine
$ echo "My kernel development" > linux-2.6-mine/description

6.2. gitweb

To see the git resources via web interface, install gitweb. The configuration file - gitweb.conf - is part of perl script. Set $projectroot with /path/to/repo and $projects_list with a filename such as /path/to/repo/projects_list.

# vi /etc/gitweb.conf

$projectroot = "/path/to/repo/";
$projects_list = "/path/to/repo/projects_list";

The file in $projects_list has a format. A line represents one project and each line contains a project path relative to the $projectroot and owner.

# vi /path/to/repo/projects_list

linux-2.6-mine kwlee

Link the css file and image files to the web root. The web root is assumed with /var/www.

# cd /var/www
# ln -s /usr/share/gitweb/* .

You can see the result in the location below.

6.3. start git daemon

There are several ways to setup a git server and it uses 9418 port.

$ grep 9418 /etc/services
git             9418/tcp                        # Git Version Control System

The way using inetd server are explained below. See the help with "git daemon --help" to get more information. In this method, all directories in the /path/to/repo are exported.

git stream tcp nowait nobody /usr/bin/git-daemon git-daemon --inetd --verbose --export-all /path/to/repo

If --export-all option is not used, git-daemon-export-ok file is required to export the repository.

$ touch /path/to/repo/linux-2.6-mine/git-daemon-export-ok

If you installed git-daemon-run package, then you can use the other way instead of using inetd. Change the configuation file in /etc/sv/git-daemon. The file run has the base path and whitelist. whitelist is the path list of permitted repository path.

# vi run
exec git-daemon --verbose --base-path=/path/to/repo /path/to/repo/linux-2.6-mine

# /etc/init.d/git-daemon restart

After starting the daemon, the files in the repository can be downloaded via git port. In this case, the repository path is relative to the base path.

$ git clone git://url.to.repo/linux-2.6-mine linux-2.6-mine

6.4. setup a local git repository - development machine

In the local machine for a normal development work, clone the repository. Use ssh connection instead of git for pushing the patch set of a local development to the remote repository later.

$ git clone ssh://url.to.repo/path/to/repo/linux-2.6-mine linux-2.6-mine

6.5. track upstream tree

This procedure is just for tracking upstream tree. If you are not interested in tracking upstream tree, it is not necessary to do. This job will fetch and update current working repository.

$ git remote add linus git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
$ git fetch -v linus

Now you can push your local development repository to the remote repository and pull again.

$ git push -v origin
$ git pull -v

After setting up the whole things above, you can use those things to expose your patch sets in your own way.

7. Creating your own branch

If you want to make your own branch for testing, do the following steps. These steps will make local branch - my-2.6.29 - using v2.6.29 tag. Then push it to create a branch with the same name in the remote machine. See the help with "git push --help".

$ git checkout -b my-2.6.29 v2.6.29
$ git push -v origin my-2.6.29

8. Git Tips

View log in short format.

$ git shortlog --no-merges v2.6.28.. drivers/input/touchscreen

Tracking remote branch. In this case, an Android git tree is used for the example. These steps will create local branches to track the remote branches.

$ git branch -r

$ git checkout -b master m/master
$ git checkout -b android-goldfish-2.6.27 korg/android-goldfish-2.6.27
$ git checkout -b android-2.6.25 korg/android-2.6.25

$ git branch
* android-2.6.25

$ git checkout master
Checking out files: 100% (18838/18838), done.
Switched to branch "master"

$ git branch
* master

The bisection is used to find out a certain point among the commits. "git bisect run" helps those operation. See the following link.

9. References and Links

* http://lkml.org/lkml/2008/12/12/240 : git haters guide by David Howells

A man who fishes for marlin in ponds will put his money in Etruscan bonds.

sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2009-06-17 16:32:59
Processing time 0.0089 sec