GitTheSource

Differences between revisions 14 and 15
Revision 14 as of 2020-10-26 15:44:27
Size: 3421
Editor: setuid
Comment:
Revision 15 as of 2024-01-23 08:24:46
Size: 4153
Editor: anthonywong
Comment: Lots of updates
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
For example, the standard Cosmic kernel is available at: For example, the standard Jammy kernel is available at:
Line 13: Line 13:
git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/cosmic}}} git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy}}}
Line 15: Line 15:
There is a tree for each of the currently supported releases as well as any open development and upcoming releases: There is a tree for each of the currently supported releases as well as any open development and upcoming releases. For example:
Line 17: Line 17:
 || groovy || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/groovy ||
Line 19: Line 18:
 || bionic || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic ||  || jammy || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy ||
 || noble || git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/noble ||
Line 21: Line 21:
Replace your intended OS series in the above, and pull the source for the kernels you need. Replace your intended Ubuntu series in the above URL, and pull the source for the kernels you need.
Line 23: Line 23:
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. 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 into the `master` branch and become the next SRU release for that series.
Line 27: Line 27:
If you cannot use the git protocol (perhaps because of a firewall), you can use the slower http protocol. For example: If you cannot use the git protocol (perhaps because of a firewall), you can use the slower https protocol. For example:
Line 29: Line 29:
 || focal || https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal ||  || jammy || https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy ||
 || noble || https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/noble ||
Line 33: Line 34:
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. To obtain a local copy you can simply `git clone` the repository for the release you are interested in. The {{{git}}} command is part of the {{{git}}} package.
Line 35: Line 36:
For example to obtain the Bionic tree: For example to obtain the Jammy tree:
Line 38: Line 39:
git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/bionic}}} git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy}}}
Line 40: Line 41:
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: 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, and use it as a reference. Note that once these two trees are tied together you cannot simply delete or move the virgin Linus tree without manually updating `.git/objects/info/alternates` in your Ubuntu kernel tree:
Line 44: Line 45:
git clone --reference linux git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/groovy git clone --reference linux git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy
git clone --reference linux git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/noble
Line 47: Line 49:
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. 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.
Line 49: Line 51:
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: If you are an advanced git user, you can also add each Ubuntu series as a remote so that you can have all kernel series you need in a single directory. For example,

    {{{
git remote add jammy git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy
git fetch jammy
git checkout -b jammy --track jammy/master
git checkout -b jammy-next --track jammy/master-next
}}}

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, use the `git tag` command below:

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 Jammy kernel is available at:

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

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

  • focal

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

    jammy

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

    noble

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

Replace your intended Ubuntu series in the above URL, and pull the source for the kernels you need.

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 into the master branch and become the next SRU release for that series.

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 https protocol. For example:

Obtaining a copy

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

For example to obtain the Jammy tree:

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

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, and use it as a reference. Note that once these two trees are tied together you cannot simply delete or move the virgin Linus tree without manually updating .git/objects/info/alternates in your Ubuntu kernel tree:

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

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.

If you are an advanced git user, you can also add each Ubuntu series as a remote so that you can have all kernel series you need in a single directory. For example,

  • git remote add jammy git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy
    git fetch jammy
    git checkout -b jammy --track jammy/master
    git checkout -b jammy-next --track jammy/master-next

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, use the git tag command 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)