From dc29a92b020dc0ae37450b634479b252f16e0b2a Mon Sep 17 00:00:00 2001 From: Tim Whisonant Date: Fri, 12 Jun 2026 17:12:01 -0700 Subject: [PATCH 1/4] Migrate kernel-wiki:Kernel-Action-GitTheSource.md Signed-off-by: Tim Whisonant --- docs/.custom_wordlist.txt | 1 + .../source-code/obtain-kernel-source-git.md | 86 ++++++++++++++++++- 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/docs/.custom_wordlist.txt b/docs/.custom_wordlist.txt index 9500f12..2beb819 100644 --- a/docs/.custom_wordlist.txt +++ b/docs/.custom_wordlist.txt @@ -25,6 +25,7 @@ respins selftests signoff subtree +subtrees unported UKIs UKN diff --git a/docs/how-to/source-code/obtain-kernel-source-git.md b/docs/how-to/source-code/obtain-kernel-source-git.md index 4f747ea..d70fc1a 100644 --- a/docs/how-to/source-code/obtain-kernel-source-git.md +++ b/docs/how-to/source-code/obtain-kernel-source-git.md @@ -37,6 +37,90 @@ git clone https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jam See {ref}`exp-ubuntu-kernel-source-protocols` for more information. +## Clone multiple releases using a shared reference repository + +Cloning a single kernel tree downloads several hundred megabytes of data. If +you plan to work with more than one kernel release, you can save space and time +by first downloading the upstream kernel tree and using it as a reference for +subsequent clones: + +```{code-block} shell +git clone https://kernel.ubuntu.com/ubuntu/linux.git +git clone --reference linux https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy +git clone --reference linux https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/noble +``` + +Each clone produces a new directory containing the full source and history. + +```{caution} +Once two trees are linked this way, you cannot delete or move the upstream +`linux` reference tree without manually updating +`.git/objects/info/alternates` in each Ubuntu kernel tree that references it. +``` + +## Add multiple series as remotes + +If you are an advanced Git user, you can add each Ubuntu series as a remote to +have all kernel series in a single Git repository, and switch between them +using branches: + +```{code-block} shell +git remote add jammy https://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 +``` + +## Work with multiple series in separate subdirectories + +To have the source for each kernel series available in its own subdirectory +within a single Git repository, use `git subtree add`: + +```{code-block} shell +git subtree add --prefix=jammy https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy master +git subtree add --prefix=noble https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/noble master +``` + +This creates a `jammy/` subdirectory containing the Jammy kernel source and a +`noble/` subdirectory containing the Noble kernel source, all within the same +repository. + +To pull future updates into a subtree, specify the remote URL and ref +explicitly — there is no automatic upstream tracking for subtrees: + +```{code-block} shell +git subtree pull --prefix=jammy https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy master +``` + +## Work with a specific kernel version using tags + +By default, cloning gives you the latest state of the `master` branch. To work +with a specific previously released kernel version, use release tags. To list +all available tags for a release: + +```{code-block} shell +git tag -l Ubuntu-* +``` + +Example output: + +```{code-block} text +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 check out a specific version, create a branch pointing to that tag: + +```{code-block} shell +git checkout -b temp Ubuntu-5.4.0-52.57 +``` + +You can then work with that version — for example, by adding new commits. + ## Related topics - {doc}`/explanation/ubuntu-linux-kernel-sources` @@ -45,5 +129,3 @@ See {ref}`exp-ubuntu-kernel-source-protocols` for more information. % LINKS [git package]: https://packages.ubuntu.com/search?keywords=git - -% TODO: migrate the rest of the Wiki content From 96b53e98d4c4cad14a41129283c6b944d1e75eca Mon Sep 17 00:00:00 2001 From: Tim Whisonant Date: Wed, 24 Jun 2026 08:51:37 -0700 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: AnneCYH Signed-off-by: Tim Whisonant --- docs/how-to/source-code/obtain-kernel-source-git.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/how-to/source-code/obtain-kernel-source-git.md b/docs/how-to/source-code/obtain-kernel-source-git.md index d70fc1a..d3bcd58 100644 --- a/docs/how-to/source-code/obtain-kernel-source-git.md +++ b/docs/how-to/source-code/obtain-kernel-source-git.md @@ -50,7 +50,7 @@ git clone --reference linux https://git.launchpad.net/~ubuntu-kernel/ubuntu/+sou git clone --reference linux https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/noble ``` -Each clone produces a new directory containing the full source and history. +Each `git clone` creates a new directory for a given release, containing the full source and history of the repository. ```{caution} Once two trees are linked this way, you cannot delete or move the upstream @@ -86,7 +86,7 @@ This creates a `jammy/` subdirectory containing the Jammy kernel source and a repository. To pull future updates into a subtree, specify the remote URL and ref -explicitly — there is no automatic upstream tracking for subtrees: +explicitly - there is no automatic upstream tracking for subtrees: ```{code-block} shell git subtree pull --prefix=jammy https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy master @@ -95,7 +95,7 @@ git subtree pull --prefix=jammy https://git.launchpad.net/~ubuntu-kernel/ubuntu/ ## Work with a specific kernel version using tags By default, cloning gives you the latest state of the `master` branch. To work -with a specific previously released kernel version, use release tags. To list +with a specific, previously released kernel version, use release tags. To list all available tags for a release: ```{code-block} shell @@ -119,7 +119,7 @@ To check out a specific version, create a branch pointing to that tag: git checkout -b temp Ubuntu-5.4.0-52.57 ``` -You can then work with that version — for example, by adding new commits. +You can then work with that version - for example, by adding new commits. ## Related topics From d4b542be9c9278c9a1e35002db2e018c830348b7 Mon Sep 17 00:00:00 2001 From: AnneCYH Date: Thu, 25 Jun 2026 10:55:18 +0800 Subject: [PATCH 3/4] Revise kernel source management instructions Updated description and title for clarity on managing kernel source code. Signed-off-by: AnneCYH --- docs/how-to/source-code/obtain-kernel-source-git.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/how-to/source-code/obtain-kernel-source-git.md b/docs/how-to/source-code/obtain-kernel-source-git.md index d3bcd58..e762f9d 100644 --- a/docs/how-to/source-code/obtain-kernel-source-git.md +++ b/docs/how-to/source-code/obtain-kernel-source-git.md @@ -1,17 +1,17 @@ --- myst: html_meta: - description: "Obtain Ubuntu kernel source code using Git. Follow step-by-step instructions for cloning kernel repositories for any Ubuntu release." + description: "Obtain and manage Ubuntu kernel source code using Git. Guide for cloning kernel repositories for one or more Ubuntu releases, working with subtrees, tags, and more." --- -# How to obtain kernel source for an Ubuntu release using Git +# How to obtain and manage kernel source for an Ubuntu release using Git The kernel source code for each Ubuntu release is maintained in its own repository in Launchpad. Downloading the kernel source may be needed for customization, development, or troubleshooting the kernel. -This document shows how you can obtain the kernel source for an Ubuntu release -using Git. +This document shows how you can obtain and manage the kernel source for an +Ubuntu release using Git. ## Prerequisites From eb129d4e38e419ab3166ca18d7b04f5b4e4b0910 Mon Sep 17 00:00:00 2001 From: AnneCYH Date: Thu, 25 Jun 2026 10:55:59 +0800 Subject: [PATCH 4/4] Update documentation for obtaining kernel source Signed-off-by: AnneCYH --- docs/how-to/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/how-to/index.md b/docs/how-to/index.md index 64c3d68..d2af1f7 100644 --- a/docs/how-to/index.md +++ b/docs/how-to/index.md @@ -15,7 +15,7 @@ kernel packages and components. :hidden: Enable kernel source package repositories -Obtain kernel source for an Ubuntu release using Git +Obtain and manage kernel source for an Ubuntu release using Git Send patches to the mailing-list Build an Ubuntu Linux kernel Build an Ubuntu Linux kernel snap