Using Git

Introduction

Xilinx maintains a public GIT tree for each of its open source projects. The goal of this page is provide basic information about using GIT with Xilinx repositories. For more detailed information about GIT and how to use it, please refer to http://git-scm.com.

Xilinx Git Trees

The public Git tree is located at git://git.xilinx.com. The http site, http://git.xilinx.com, can be used to browse the code. The main branch of the public repository is the master branch. This is considered the most stable and tested code from Xilinx.

The following projects are supported on the Git repository:

Project name Description
linux-xlnx.git Linux sources
u-boot-xlnx.git U-boot sources
qemu-xarm.git Zynq-7000 AP SoC QEMU system model

Without GIT Installed

A snapshot of a repository can be created using the snapshot feature at http://git.xilinx.com. There are specific instructions on the web page about how to use the snapshot feature. This is not a recommended approach as there is no history in a snapshot.

Firewall Issues

It is very typical for firewalls to have the GIT port blocked. An HTTP proxy is typically setup to allow access to the internet through the firewall. GIT can be configured such that it will go thru the proxy thru the firewall. There are a number of utilities to help with this including netcat, curl and corkscrew.

Using Corkscrew Through a Firewall

The following assumes that the corkscrew utility has been installed on the Linux host running GIT. Create the file git-proxy.sh with the following contents.

#!/bin/sh
exec corkscrew <name of proxy server> <port> $*

Set up the proxy command for GIT by setting the environment variable as illustrated below.

bash> export GIT_PROXY_COMMAND="/<path>/git-proxy.sh"

Cloning a Xilinx Repository with GIT

git clone git://git.xilinx.com/<project name>

The project names are listed above.

Creating A Git Patch

1. Make a branch in the repository for the change you desire which is based on one of the original branches in the repository you cloned. This command creates the branch and makes it the active branch.

bash> git checkout –b <my_change>

Make the changes to any files or add new files and do your testing.

2. Set your email and your name for commit messages. Git creates a .gitconfig file in the directory specified by the HOME environment variable such that this only has to be done once.

bash> git config --global user.email johndoe@example.com
bash> git config --global user.name 'John Doe'

3. Add any new files to the repository by telling git about them. The following command adds all new files if executed in the root of the linux tree. Specific files may also be added by specifying a path and file name.

bash> git add .

4. Review the changes that will be committed on the next commit command.

bash> git status

5. Commit the files that were changed and added into your local branch of your local repository. A commit should be done when a change is ready to be put in the repository. Keep the granularity of each commit small (a single functional change) as each commit will become a separate patch.

bash> git commit

You will be put into an editor to enter your commit message. There is a specific format that should be followed and illustrated below.

In the following text, “[ ]” denotes a required field and “< >” is an optional field.

  1. [kernel architecture]: [subsystem]: <descriptor>: [short summary]
  2. blank line
  3. Several lines: describing the specifics of the change
  4. blank line
  5. Signed-off-by: [your name] [<moc.erehwemos|liameruoy#moc.erehwemos|liameruoy>]

Where:

kernel architecture = powerpc, microblaze, arm
subsystem = Xilinx
descriptor = the driver name, BSP, etc…
short summary = a short text summary of the change
Signed-off-by is the person making change (commit)

6. Review the last commit(s).

bash> git log

7. Generate patches for each commit in your branch. A patch file, named *.patch, is generated in the current directory. The following command generates a patch for the last commit. The “1” in the command specifies the number of commit to generate patches for.

git format-patch -1

8. Send the email patch to moc.xnilix|tig#moc.xnilix|tig for review and incorporation back into the Git tree. Using Git to send the email will ensure that it’s format is not altered by email clients such as Outlook.

git send-email --to git@xilinx.com *.patch
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License