[[TableOfContents]] = 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. = 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. = Reading list = If you are not familiar with git usage, it is recommended to read these documents first. * Version control for Linux : http://www.ibm.com/developerworks/linux/library/l-vercon/index.html [[BR]] http://www.ibm.com/developerworks/kr/library/l-vercon/index.html (korean) * Manage source code using Git : http://www-128.ibm.com/developerworks/linux/library/l-git/index.html * gittutorial(7) : http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html * gittutorial-2(7) : http://www.kernel.org/pub/software/scm/git/docs/gittutorial-2.html * Everyday GIT With 20 Commands Or So : http://www.kernel.org/pub/software/scm/git/docs/everyday.html * Git User's Manual : http://www.kernel.org/pub/software/scm/git/docs/user-manual.html * Git Community Book : http://book.git-scm.com/ = 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. * http://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/ 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 = 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. {{{#!vim $ 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: * http://www.sourcemage.org/Git_Guide = 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. == setup a remote git repository - public machine == {{{#!vim $ 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 }}} == 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. {{{#!vim # 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. {{{#!vim # 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. {{{#!vim # cd /var/www # ln -s /usr/share/gitweb/* . }}} You can see the result in the location below. http://url.to.repo/cgi-bin/gitweb.cgi/ == start git daemon == There are several ways to setup a git server and it uses 9418 port. {{{#!vim $ 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. {{{#!vim 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. {{{#!vim $ 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. {{{#!vim # 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. {{{#!vim $ git clone git://url.to.repo/linux-2.6-mine linux-2.6-mine }}} == 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. {{{#!vim $ git clone ssh://url.to.repo/path/to/repo/linux-2.6-mine linux-2.6-mine }}} == 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. {{{#!vim $ 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. {{{#!vim $ 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. = 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". {{{#!vim $ git checkout -b my-2.6.29 v2.6.29 $ git push -v origin my-2.6.29 }}} = Git Tips = View log in short format. {{{#!vim $ 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. {{{#!vim $ git branch -r korg/android-2.6.25 korg/android-2.6.27 korg/android-goldfish-2.6.27 m/master $ 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 android-goldfish-2.6.27 master $ git checkout master Checking out files: 100% (18838/18838), done. Switched to branch "master" $ git branch android-2.6.25 android-goldfish-2.6.27 * master }}} The bisection is used to find out a certain point among the commits. "git bisect run" helps those operation. See the following link. * http://lwn.net/Articles/317070/ = References and Links = * http://lkml.org/lkml/2008/12/12/240 : git haters guide by David Howells