GitTheSource

Differences between revisions 6 and 13 (spanning 7 versions)
Revision 6 as of 2010-06-21 08:34:44
Size: 1121
Editor: 85-210-146-14
Comment:
Revision 13 as of 2020-10-15 16:03:44
Size: 3880
Editor: setuid
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
All of the Ubuntu Kernel source is maintained under {{{git}}}. The source for each release is maintained in its own git repository on {{{kernel.ubuntu.com}}}. These can be browsed in [[http://kernel.ubuntu.com/git|gitweb]], the official Ubuntu trees are in the {{{ubuntu/}}} directory. To obtain a local copy you can simply git clone the repository for the release you are interested in as below. The {{{git}}} command is part of the {{{git-core}}} package: The source for each release is maintained in its own git repository on Launchpad.

The git repository is listed in the `Vcs-Git:` header in the source package and is of the following form:
Line 6: Line 8:
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-<release>.git git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/<source package>/+git/<series>}}}

For example, the standard Cosmic kernel is available at:

    {{{
git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/cosmic}}}

There is a tree for each of the currently supported releases as well as any open development and upcoming releases:

 || groovy || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/groovy ||
 || focal || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal ||
 || eoan || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/eoan ||
 || disco || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/disco ||
 || bionic || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic ||
 || xenial || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenial ||
 || trusty || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/trusty ||
 || precise || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/precise ||

The distro kernel is always on the master branch in these repositories. Each release also has a master-next branch containing the commits that will go onto the master branch and become the next release for that release.

A number of releases also have other source packages which represent other related but divergent kernels for other purposes. For example, there is a specialized AWS kernel available in the linux-aws source package. (Previously these sorts of things were done in [[KernelTeam/TopicBranches|Topic Branches]] and some older kernels and projects still use them.)

If you cannot use the git protocol (perhaps because of a firewall), you can use the slower http protocol. For example:

 || focal || https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal ||

=== Obtaining a copy ===

To obtain a local copy you can simply `git clone` the repository for the release you are interested. The {{{git}}} command is part of the {{{git}}} package.

For example to obtain the Bionic tree:

    {{{
git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic}}}

This will download several hundred megabytes of data. If you plan on working on more than one kernel release you can save space and time by downloading the upstream kernel tree. Note that once these two trees are tied together you cannot remove the virgin Linus tree without damage to the Ubuntu tree:

    {{{
git clone git://kernel.ubuntu.com/ubuntu/linux.git
git clone --reference linux git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic
git clone --reference linux git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/cosmic
Line 9: Line 51:
For example to obtain the maverick tree: In each case you will end up with a new directory {{{ubuntu-<release>}}} containing the source and the full history which can be manipulated using the {{{git}}} command from within each directory.

By default you will have the latest version of the kernel tree, the master tree. You can switch to any previously released kernel version using the release tags. To obtain a full list of the tagged versions in the release as below:
Line 12: Line 56:
git clone git://kernel.ubuntu.com/ubuntu/ubuntu-maverick.git $ git tag -l Ubuntu-*
Ubuntu-5.4.0-47.51
Ubuntu-5.4.0-48.52
Ubuntu-5.4.0-49.53
Ubuntu-5.4.0-51.56
Ubuntu-5.4.0-52.57
$}}}

To look at the {{{Ubuntu-5.4.0-52.57}}} version you can simply checkout a new branch pointing to that version:

    {{{
git checkout -b temp Ubuntu-5.4.0-52.57
Line 15: Line 70:
This will download some 300MB of data. If you have a virgin Linus tree locally you can significantly reduce the size of this download through object sharing. Note that once these two trees are tied together you cannot remove the virgin Linus tree without damage to the Ubuntu tree:

    {{{
git clone --reference linux-2.6 git://kernel.ubuntu.com/ubuntu/ubuntu-maverick.git
}}}
You may then manipulate the release - for example, by adding new commits.

Obtaining the kernel sources for an Ubuntu release using git

The source for each release is maintained in its own git repository on Launchpad.

The git repository is listed in the Vcs-Git: header in the source package and is of the following form:

  • git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/<source package>/+git/<series>

For example, the standard Cosmic kernel is available at:

  • git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/cosmic

There is a tree for each of the currently supported releases as well as any open development and upcoming releases:

  • groovy

    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/groovy

    focal

    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal

    eoan

    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/eoan

    disco

    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/disco

    bionic

    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic

    xenial

    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenial

    trusty

    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/trusty

    precise

    git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/precise

The distro kernel is always on the master branch in these repositories. Each release also has a master-next branch containing the commits that will go onto the master branch and become the next release for that release.

A number of releases also have other source packages which represent other related but divergent kernels for other purposes. For example, there is a specialized AWS kernel available in the linux-aws source package. (Previously these sorts of things were done in Topic Branches and some older kernels and projects still use them.)

If you cannot use the git protocol (perhaps because of a firewall), you can use the slower http protocol. For example:

Obtaining a copy

To obtain a local copy you can simply git clone the repository for the release you are interested. The git command is part of the git package.

For example to obtain the Bionic tree:

  • git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic

This will download several hundred megabytes of data. If you plan on working on more than one kernel release you can save space and time by downloading the upstream kernel tree. Note that once these two trees are tied together you cannot remove the virgin Linus tree without damage to the Ubuntu tree:

  • git clone git://kernel.ubuntu.com/ubuntu/linux.git
    git clone --reference linux git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic
    git clone --reference linux git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/cosmic

In each case you will end up with a new directory ubuntu-<release> containing the source and the full history which can be manipulated using the git command from within each directory.

By default you will have the latest version of the kernel tree, the master tree. You can switch to any previously released kernel version using the release tags. To obtain a full list of the tagged versions in the release as below:

  • $ git tag -l Ubuntu-*
    Ubuntu-5.4.0-47.51
    Ubuntu-5.4.0-48.52
    Ubuntu-5.4.0-49.53
    Ubuntu-5.4.0-51.56
    Ubuntu-5.4.0-52.57
    $

To look at the Ubuntu-5.4.0-52.57 version you can simply checkout a new branch pointing to that version:

  • git checkout -b temp Ubuntu-5.4.0-52.57

You may then manipulate the release - for example, by adding new commits.

Kernel/Action/GitTheSource (last edited 2024-01-23 08:28:28 by anthonywong)