sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}(hhparenthuba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget;/translations/zh_CN/admin-guide/quickly-build-trimmed-linuxmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}(hhhh2ubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget;/translations/zh_TW/admin-guide/quickly-build-trimmed-linuxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}(hhhhFubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget;/translations/it_IT/admin-guide/quickly-build-trimmed-linuxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}(hhhhZubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget;/translations/ja_JP/admin-guide/quickly-build-trimmed-linuxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}(hhhhnubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget;/translations/ko_KR/admin-guide/quickly-build-trimmed-linuxmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}(hhhhubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget;/translations/sp_SP/admin-guide/quickly-build-trimmed-linuxmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h0SPDX-License-Identifier: (GPL-2.0+ OR CC-BY-4.0)h]h0SPDX-License-Identifier: (GPL-2.0+ OR CC-BY-4.0)}(hhhhubah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhU/var/lib/git/docbuild/linux/Documentation/admin-guide/quickly-build-trimmed-linux.rsthKubh)}(h<[see the bottom of this file for redistribution information]h]h<[see the bottom of this file for redistribution information]}(hhhhubah}(h]h ]h"]h$]h&]hhuh1hhhhhhhhKubhsection)}(hhh](htitle)}(h+How to quickly build a trimmed Linux kernelh]h+How to quickly build a trimmed Linux kernel}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hThis guide explains how to swiftly build Linux kernels that are ideal for testing purposes, but perfectly fine for day-to-day use, too.h]hThis guide explains how to swiftly build Linux kernels that are ideal for testing purposes, but perfectly fine for day-to-day use, too.}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(h(The essence of the process (aka 'TL;DR')h]h,The essence of the process (aka ‘TL;DR’)}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh)}(hXU*[If you are new to compiling Linux, ignore this TLDR and head over to the next section below: it contains a step-by-step guide, which is more detailed, but still brief and easy to follow; that guide and its accompanying reference section also mention alternatives, pitfalls, and additional aspects, all of which might be relevant for you.]*h]hemphasis)}(hhh]hXS[If you are new to compiling Linux, ignore this TLDR and head over to the next section below: it contains a step-by-step guide, which is more detailed, but still brief and easy to follow; that guide and its accompanying reference section also mention alternatives, pitfalls, and additional aspects, all of which might be relevant for you.]}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hX{If your system uses techniques like Secure Boot, prepare it to permit starting self-compiled Linux kernels; install compilers and everything else needed for building Linux; make sure to have 12 Gigabyte free space in your home directory. Now run the following commands to download fresh Linux mainline sources, which you then use to configure, build and install your own kernel::h]hXzIf your system uses techniques like Secure Boot, prepare it to permit starting self-compiled Linux kernels; install compilers and everything else needed for building Linux; make sure to have 12 Gigabyte free space in your home directory. Now run the following commands to download fresh Linux mainline sources, which you then use to configure, build and install your own kernel:}(hXzIf your system uses techniques like Secure Boot, prepare it to permit starting self-compiled Linux kernels; install compilers and everything else needed for building Linux; make sure to have 12 Gigabyte free space in your home directory. Now run the following commands to download fresh Linux mainline sources, which you then use to configure, build and install your own kernel:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh literal_block)}(hXgit clone --depth 1 -b master \ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git ~/linux/ cd ~/linux/ # Hint: if you want to apply patches, do it at this point. See below for details. # Hint: it's recommended to tag your build at this point. See below for details. yes "" | make localmodconfig # Hint: at this point you might want to adjust the build configuration; you'll # have to, if you are running Debian. See below for details. make -j $(nproc --all) # Note: on many commodity distributions the next command suffices, but on Arch # Linux, its derivatives, and some others it does not. See below for details. command -v installkernel && sudo make modules_install install rebooth]hXgit clone --depth 1 -b master \ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git ~/linux/ cd ~/linux/ # Hint: if you want to apply patches, do it at this point. See below for details. # Hint: it's recommended to tag your build at this point. See below for details. yes "" | make localmodconfig # Hint: at this point you might want to adjust the build configuration; you'll # have to, if you are running Debian. See below for details. make -j $(nproc --all) # Note: on many commodity distributions the next command suffices, but on Arch # Linux, its derivatives, and some others it does not. See below for details. command -v installkernel && sudo make modules_install install reboot}(hhhj"ubah}(h]h ]h"]h$]h&]hhuh1j hhhKhhhhubh)}(hJIf you later want to build a newer mainline snapshot, use these commands::h]hIIf you later want to build a newer mainline snapshot, use these commands:}(hIIf you later want to build a newer mainline snapshot, use these commands:hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hhhhubj!)}(hXcd ~/linux/ git fetch --depth 1 origin # Note: the next command will discard any changes you did to the code: git checkout --force --detach origin/master # Reminder: if you want to (re)apply patches, do it at this point. # Reminder: you might want to add or modify a build tag at this point. make olddefconfig make -j $(nproc --all) # Reminder: the next command on some distributions does not suffice. command -v installkernel && sudo make modules_install install rebooth]hXcd ~/linux/ git fetch --depth 1 origin # Note: the next command will discard any changes you did to the code: git checkout --force --detach origin/master # Reminder: if you want to (re)apply patches, do it at this point. # Reminder: you might want to add or modify a build tag at this point. make olddefconfig make -j $(nproc --all) # Reminder: the next command on some distributions does not suffice. command -v installkernel && sudo make modules_install install reboot}(hhhj?ubah}(h]h ]h"]h$]h&]hhuh1j hhhK*hhhhubeh}(h]$the-essence-of-the-process-aka-tl-drah ]h"](the essence of the process (aka 'tl;dr')ah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(hStep-by-step guideh]hStep-by-step guide}(hjZhjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjUhhhhhK7ubh)}(hCompiling your own Linux kernel is easy in principle. There are various ways to do it. Which of them actually work and is the best depends on the circumstances.h]hCompiling your own Linux kernel is easy in principle. There are various ways to do it. Which of them actually work and is the best depends on the circumstances.}(hjhhjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK9hjUhhubh)}(hXThis guide describes a way perfectly suited for those who want to quickly install Linux from sources without being bothered by complicated details; the goal is to cover everything typically needed on mainstream Linux distributions running on commodity PC or server hardware.h]hXThis guide describes a way perfectly suited for those who want to quickly install Linux from sources without being bothered by complicated details; the goal is to cover everything typically needed on mainstream Linux distributions running on commodity PC or server hardware.}(hjvhjthhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK`] h](h)}(hCreate a fresh backup and put system repair and restore tools at hand, just to be prepared for the unlikely case of something going sideways.h]hCreate a fresh backup and put system repair and restore tools at hand, just to be prepared for the unlikely case of something going sideways.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKUhjubh)}(h[:ref:`details`]h](h[}(h[hjhhhNhNubh)}(h:ref:`details`h]hinline)}(hjh]hdetails}(hhhjhhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdoc'admin-guide/quickly-build-trimmed-linux refdomainjreftyperef refexplicitrefwarn reftargetbackupuh1hhhhKXhjubh]}(h]hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKXhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]bullet*uh1jhhhKUhjubah}(h]jah ]h"] backup_sbsah$]h&]uh1jhjUhhhNhNexpect_referenced_by_name}j#jsexpect_referenced_by_id}jjsubj)}(h.. _secureboot_sbs:h]h}(h]h ]h"]h$]h&]jsecureboot-sbsuh1jhKZhjUhhhhubj)}(hhh]j)}(hhh]j)}(hXOn platforms with 'Secure Boot' or similar techniques, prepare everything to ensure the system will permit your self-compiled kernel to boot later. The quickest and easiest way to achieve this on commodity x86 systems is to disable such techniques in the BIOS setup utility; alternatively, remove their restrictions through a process initiated by ``mokutil --disable-validation``. [:ref:`details`] h](h)}(hX|On platforms with 'Secure Boot' or similar techniques, prepare everything to ensure the system will permit your self-compiled kernel to boot later. The quickest and easiest way to achieve this on commodity x86 systems is to disable such techniques in the BIOS setup utility; alternatively, remove their restrictions through a process initiated by ``mokutil --disable-validation``.h](hX_On platforms with ‘Secure Boot’ or similar techniques, prepare everything to ensure the system will permit your self-compiled kernel to boot later. The quickest and easiest way to achieve this on commodity x86 systems is to disable such techniques in the BIOS setup utility; alternatively, remove their restrictions through a process initiated by }(hX[On platforms with 'Secure Boot' or similar techniques, prepare everything to ensure the system will permit your self-compiled kernel to boot later. The quickest and easiest way to achieve this on commodity x86 systems is to disable such techniques in the BIOS setup utility; alternatively, remove their restrictions through a process initiated by hj?hhhNhNubhliteral)}(h ``mokutil --disable-validation``h]hmokutil --disable-validation}(hhhjJhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj?ubh.}(h.hj?hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK\hj;ubh)}(h[:ref:`details`]h](h[}(hjhjchhhNhNubh)}(h:ref:`details`h]j)}(hjmh]hdetails}(hhhjohhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjkubah}(h]h ]h"]h$]h&]refdocj refdomainjyreftyperef refexplicitrefwarnj securebootuh1hhhhKchjcubh]}(hj hjchhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKchj;ubeh}(h]h ]h"]h$]h&]uh1jhj8ubah}(h]h ]h"]h$]h&]jjuh1jhhhK\hj5ubah}(h]j4ah ]h"]secureboot_sbsah$]h&]uh1jhjUhhhNhNj&}jj*sj(}j4j*subj)}(h.. _buildrequires_sbs:h]h}(h]h ]h"]h$]h&]jbuildrequires-sbsuh1jhKehjUhhhhubj)}(hhh]j)}(hhh]j)}(hXbInstall all software required to build a Linux kernel. Often you will need: 'bc', 'binutils' ('ld' et al.), 'bison', 'flex', 'gcc', 'git', 'openssl', 'pahole', 'perl', and the development headers for 'libelf' and 'openssl'. The reference section shows how to quickly install those on various popular Linux distributions. [:ref:`details`] h](h)}(hX@Install all software required to build a Linux kernel. Often you will need: 'bc', 'binutils' ('ld' et al.), 'bison', 'flex', 'gcc', 'git', 'openssl', 'pahole', 'perl', and the development headers for 'libelf' and 'openssl'. The reference section shows how to quickly install those on various popular Linux distributions.h]hXpInstall all software required to build a Linux kernel. Often you will need: ‘bc’, ‘binutils’ (‘ld’ et al.), ‘bison’, ‘flex’, ‘gcc’, ‘git’, ‘openssl’, ‘pahole’, ‘perl’, and the development headers for ‘libelf’ and ‘openssl’. The reference section shows how to quickly install those on various popular Linux distributions.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKghjubh)}(h[:ref:`details`]h](h[}(hjhjhhhNhNubh)}(h:ref:`details`h]j)}(hjh]hdetails}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj buildrequiresuh1hhhhKmhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKmhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]jjuh1jhhhKghjubah}(h]jah ]h"]buildrequires_sbsah$]h&]uh1jhjUhhhNhNj&}jjsj(}jjsubj)}(h.. _diskspace_sbs:h]h}(h]h ]h"]h$]h&]j diskspace-sbsuh1jhKohjUhhhhubj)}(hhh]j)}(hhh]j)}(hXEnsure to have enough free space for building and installing Linux. For the latter 150 Megabyte in /lib/ and 100 in /boot/ are a safe bet. For storing sources and build artifacts 12 Gigabyte in your home directory should typically suffice. If you have less available, be sure to check the reference section for the step that explains adjusting your kernels build configuration: it mentions a trick that reduce the amount of required space in /home/ to around 4 Gigabyte. [:ref:`details`] h](h)}(hXEnsure to have enough free space for building and installing Linux. For the latter 150 Megabyte in /lib/ and 100 in /boot/ are a safe bet. For storing sources and build artifacts 12 Gigabyte in your home directory should typically suffice. If you have less available, be sure to check the reference section for the step that explains adjusting your kernels build configuration: it mentions a trick that reduce the amount of required space in /home/ to around 4 Gigabyte.h]hXEnsure to have enough free space for building and installing Linux. For the latter 150 Megabyte in /lib/ and 100 in /boot/ are a safe bet. For storing sources and build artifacts 12 Gigabyte in your home directory should typically suffice. If you have less available, be sure to check the reference section for the step that explains adjusting your kernels build configuration: it mentions a trick that reduce the amount of required space in /home/ to around 4 Gigabyte.}(hj+hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKqhj%ubh)}(h[:ref:`details`]h](h[}(hjhj7hhhNhNubh)}(h:ref:`details`h]j)}(hjAh]hdetails}(hhhjChhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj?ubah}(h]h ]h"]h$]h&]refdocj refdomainjMreftyperef refexplicitrefwarnj diskspaceuh1hhhhKyhj7ubh]}(hj hj7hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKyhj%ubeh}(h]h ]h"]h$]h&]uh1jhj"ubah}(h]h ]h"]h$]h&]jjuh1jhhhKqhjubah}(h]jah ]h"] diskspace_sbsah$]h&]uh1jhjUhhhNhNj&}jyjsj(}jjsubj)}(h.. _sources_sbs:h]h}(h]h ]h"]h$]h&]j sources-sbsuh1jhK{hjUhhhhubj)}(hhh]j)}(hhh]j)}(hXRetrieve the sources of the Linux version you intend to build; then change into the directory holding them, as all further commands in this guide are meant to be executed from there. *[Note: the following paragraphs describe how to retrieve the sources by partially cloning the Linux stable git repository. This is called a shallow clone. The reference section explains two alternatives:* :ref:`packaged archives` *and* :ref:`a full git clone` *; prefer the latter, if downloading a lot of data does not bother you, as that will avoid some* :ref:`peculiar characteristics of shallow clones the reference section explains` *.]* First, execute the following command to retrieve a fresh mainline codebase:: git clone --no-checkout --depth 1 -b master \ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git ~/linux/ cd ~/linux/ If you want to access recent mainline releases and pre-releases, deepen you clone's history to the oldest mainline version you are interested in:: git fetch --shallow-exclude=v6.0 origin In case you want to access a stable/longterm release (say v6.1.5), simply add the branch holding that series; afterwards fetch the history at least up to the mainline version that started the series (v6.1):: git remote set-branches --add origin linux-6.1.y git fetch --shallow-exclude=v6.0 origin Now checkout the code you are interested in. If you just performed the initial clone, you will be able to check out a fresh mainline codebase, which is ideal for checking whether developers already fixed an issue:: git checkout --detach origin/master If you deepened your clone, you instead of ``origin/master`` can specify the version you deepened to (``v6.0`` above); later releases like ``v6.1`` and pre-release like ``v6.2-rc1`` will work, too. Stable or longterm versions like ``v6.1.5`` work just the same, if you added the appropriate stable/longterm branch as described. [:ref:`details`] h](h)}(hRetrieve the sources of the Linux version you intend to build; then change into the directory holding them, as all further commands in this guide are meant to be executed from there.h]hRetrieve the sources of the Linux version you intend to build; then change into the directory holding them, as all further commands in this guide are meant to be executed from there.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK}hjubh)}(hX*[Note: the following paragraphs describe how to retrieve the sources by partially cloning the Linux stable git repository. This is called a shallow clone. The reference section explains two alternatives:* :ref:`packaged archives` *and* :ref:`a full git clone` *; prefer the latter, if downloading a lot of data does not bother you, as that will avoid some* :ref:`peculiar characteristics of shallow clones the reference section explains` *.]*h](h)}(h*[Note: the following paragraphs describe how to retrieve the sources by partially cloning the Linux stable git repository. This is called a shallow clone. The reference section explains two alternatives:*h]h[Note: the following paragraphs describe how to retrieve the sources by partially cloning the Linux stable git repository. This is called a shallow clone. The reference section explains two alternatives:}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh }(h hjhhhNhNubh)}(h):ref:`packaged archives`h]j)}(hjh]hpackaged archives}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsources_archiveuh1hhhhKhjubh }(hjhjubh)}(h*and*h]hand}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh }(hjhjubh)}(h%:ref:`a full git clone`h]j)}(hjh]ha full git clone}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sources_fulluh1hhhhKhjubh }(hjhjubh)}(h`*; prefer the latter, if downloading a lot of data does not bother you, as that will avoid some*h]h^; prefer the latter, if downloading a lot of data does not bother you, as that will avoid some}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh }(hjhjubh)}(ha:ref:`peculiar characteristics of shallow clones the reference section explains`h]j)}(hj&h]hIpeculiar characteristics of shallow clones the reference section explains}(hhhj(hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj$ubah}(h]h ]h"]h$]h&]refdocj refdomainj2reftyperef refexplicitrefwarnjsources_shallowuh1hhhhKhjubh }(hjhjubh)}(h*.]*h]h.]}(hhhjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hLFirst, execute the following command to retrieve a fresh mainline codebase::h]hKFirst, execute the following command to retrieve a fresh mainline codebase:}(hKFirst, execute the following command to retrieve a fresh mainline codebase:hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj!)}(hgit clone --no-checkout --depth 1 -b master \ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git ~/linux/ cd ~/linux/h]hgit clone --no-checkout --depth 1 -b master \ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git ~/linux/ cd ~/linux/}(hhhjkubah}(h]h ]h"]h$]h&]hhuh1j hhhKhjubh)}(hIf you want to access recent mainline releases and pre-releases, deepen you clone's history to the oldest mainline version you are interested in::h]hIf you want to access recent mainline releases and pre-releases, deepen you clone’s history to the oldest mainline version you are interested in:}(hIf you want to access recent mainline releases and pre-releases, deepen you clone's history to the oldest mainline version you are interested in:hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj!)}(h'git fetch --shallow-exclude=v6.0 originh]h'git fetch --shallow-exclude=v6.0 origin}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhKhjubh)}(hIn case you want to access a stable/longterm release (say v6.1.5), simply add the branch holding that series; afterwards fetch the history at least up to the mainline version that started the series (v6.1)::h]hIn case you want to access a stable/longterm release (say v6.1.5), simply add the branch holding that series; afterwards fetch the history at least up to the mainline version that started the series (v6.1):}(hIn case you want to access a stable/longterm release (say v6.1.5), simply add the branch holding that series; afterwards fetch the history at least up to the mainline version that started the series (v6.1):hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj!)}(hXgit remote set-branches --add origin linux-6.1.y git fetch --shallow-exclude=v6.0 originh]hXgit remote set-branches --add origin linux-6.1.y git fetch --shallow-exclude=v6.0 origin}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhKhjubh)}(hNow checkout the code you are interested in. If you just performed the initial clone, you will be able to check out a fresh mainline codebase, which is ideal for checking whether developers already fixed an issue::h]hNow checkout the code you are interested in. If you just performed the initial clone, you will be able to check out a fresh mainline codebase, which is ideal for checking whether developers already fixed an issue:}(hNow checkout the code you are interested in. If you just performed the initial clone, you will be able to check out a fresh mainline codebase, which is ideal for checking whether developers already fixed an issue:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj!)}(h#git checkout --detach origin/masterh]h#git checkout --detach origin/master}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhKhjubh)}(hXGIf you deepened your clone, you instead of ``origin/master`` can specify the version you deepened to (``v6.0`` above); later releases like ``v6.1`` and pre-release like ``v6.2-rc1`` will work, too. Stable or longterm versions like ``v6.1.5`` work just the same, if you added the appropriate stable/longterm branch as described.h](h+If you deepened your clone, you instead of }(h+If you deepened your clone, you instead of hjhhhNhNubjI)}(h``origin/master``h]h origin/master}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh* can specify the version you deepened to (}(h* can specify the version you deepened to (hjhhhNhNubjI)}(h``v6.0``h]hv6.0}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh above); later releases like }(h above); later releases like hjhhhNhNubjI)}(h``v6.1``h]hv6.1}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh and pre-release like }(h and pre-release like hjhhhNhNubjI)}(h ``v6.2-rc1``h]hv6.2-rc1}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh2 will work, too. Stable or longterm versions like }(h2 will work, too. Stable or longterm versions like hjhhhNhNubjI)}(h ``v6.1.5``h]hv6.1.5}(hhhj%hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubhV work just the same, if you added the appropriate stable/longterm branch as described.}(hV work just the same, if you added the appropriate stable/longterm branch as described.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(h[:ref:`details`]h](h[}(hjhj>hhhNhNubh)}(h:ref:`details`h]j)}(hjHh]hdetails}(hhhjJhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjFubah}(h]h ]h"]h$]h&]refdocj refdomainjTreftyperef refexplicitrefwarnjsourcesuh1hhhhKhj>ubh]}(hj hj>hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]jjuh1jhhhK}hjubah}(h]jah ]h"] sources_sbsah$]h&]uh1jhjUhhhNhNj&}jj~sj(}jj~subj)}(h.. _patching_sbs:h]h}(h]h ]h"]h$]h&]j patching-sbsuh1jhKhjUhhhhubj)}(hhh]j)}(hhh]j)}(hXIn case you want to apply a kernel patch, do so now. Often a command like this will do the trick:: patch -p1 < ../proposed-fix.patch If the ``-p1`` is actually needed, depends on how the patch was created; in case it does not apply thus try without it. If you cloned the sources with git and anything goes sideways, run ``git reset --hard`` to undo any changes to the sources. [:ref:`details`] h](h)}(hbIn case you want to apply a kernel patch, do so now. Often a command like this will do the trick::h]haIn case you want to apply a kernel patch, do so now. Often a command like this will do the trick:}(haIn case you want to apply a kernel patch, do so now. Often a command like this will do the trick:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj!)}(h!patch -p1 < ../proposed-fix.patchh]h!patch -p1 < ../proposed-fix.patch}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhKhjubh)}(hwIf the ``-p1`` is actually needed, depends on how the patch was created; in case it does not apply thus try without it.h](hIf the }(hIf the hjhhhNhNubjI)}(h``-p1``h]h-p1}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubhi is actually needed, depends on how the patch was created; in case it does not apply thus try without it.}(hi is actually needed, depends on how the patch was created; in case it does not apply thus try without it.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(h{If you cloned the sources with git and anything goes sideways, run ``git reset --hard`` to undo any changes to the sources.h](hCIf you cloned the sources with git and anything goes sideways, run }(hCIf you cloned the sources with git and anything goes sideways, run hjhhhNhNubjI)}(h``git reset --hard``h]hgit reset --hard}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh$ to undo any changes to the sources.}(h$ to undo any changes to the sources.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(h[:ref:`details`]h](h[}(hjhjhhhNhNubh)}(h:ref:`details`h]j)}(hjh]hdetails}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjpatchinguh1hhhhKhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]jjuh1jhhhKhjubah}(h]jah ]h"] patching_sbsah$]h&]uh1jhjUhhhNhNj&}j=jsj(}jjsubj)}(h.. _tagging_sbs:h]h}(h]h ]h"]h$]h&]j tagging-sbsuh1jhKhjUhhhhubj)}(hhh](j)}(hhh]j)}(hX1If you patched your kernel or have one of the same version installed already, better add a unique tag to the one you are about to build:: echo "-proposed_fix" > localversion Running ``uname -r`` under your kernel later will then print something like '6.1-rc4-proposed_fix'. [:ref:`details`] h](h)}(hIf you patched your kernel or have one of the same version installed already, better add a unique tag to the one you are about to build::h]hIf you patched your kernel or have one of the same version installed already, better add a unique tag to the one you are about to build:}(hIf you patched your kernel or have one of the same version installed already, better add a unique tag to the one you are about to build:hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjSubj!)}(h#echo "-proposed_fix" > localversionh]h#echo "-proposed_fix" > localversion}(hhhjfubah}(h]h ]h"]h$]h&]hhuh1j hhhKhjSubh)}(hcRunning ``uname -r`` under your kernel later will then print something like '6.1-rc4-proposed_fix'.h](hRunning }(hRunning hjthhhNhNubjI)}(h ``uname -r``h]huname -r}(hhhj}hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjtubhS under your kernel later will then print something like ‘6.1-rc4-proposed_fix’.}(hO under your kernel later will then print something like '6.1-rc4-proposed_fix'.hjthhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjSubh)}(h[:ref:`details`]h](h[}(hjhjhhhNhNubh)}(h:ref:`details`h]j)}(hjh]hdetails}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjtagginguh1hhhhKhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjSubeh}(h]h ]h"]h$]h&]uh1jhjPubah}(h]h ]h"]h$]h&]jjuh1jhhhKhjMubj)}(h.. _configuration_sbs:h]h}(h]h ]h"]h$]h&]jconfiguration-sbsuh1jhKhjMubj)}(hhh]j)}(hXCreate the build configuration for your kernel based on an existing configuration. If you already prepared such a '.config' file yourself, copy it to ~/linux/ and run ``make olddefconfig``. Use the same command, if your distribution or somebody else already tailored your running kernel to your or your hardware's needs: the make target 'olddefconfig' will then try to use that kernel's .config as base. Using this make target is fine for everybody else, too -- but you often can save a lot of time by using this command instead:: yes "" | make localmodconfig This will try to pick your distribution's kernel as base, but then disable modules for any features apparently superfluous for your setup. This will reduce the compile time enormously, especially if you are running an universal kernel from a commodity Linux distribution. There is a catch: 'localmodconfig' is likely to disable kernel features you did not use since you booted your Linux -- like drivers for currently disconnected peripherals or a virtualization software not haven't used yet. You can reduce or nearly eliminate that risk with tricks the reference section outlines; but when building a kernel just for quick testing purposes it is often negligible if such features are missing. But you should keep that aspect in mind when using a kernel built with this make target, as it might be the reason why something you only use occasionally stopped working. [:ref:`details`] h](h)}(hRCreate the build configuration for your kernel based on an existing configuration.h]hRCreate the build configuration for your kernel based on an existing configuration.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hjIf you already prepared such a '.config' file yourself, copy it to ~/linux/ and run ``make olddefconfig``.h](hXIf you already prepared such a ‘.config’ file yourself, copy it to ~/linux/ and run }(hTIf you already prepared such a '.config' file yourself, copy it to ~/linux/ and run hjhhhNhNubjI)}(h``make olddefconfig``h]hmake olddefconfig}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh.}(hj\hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hUse the same command, if your distribution or somebody else already tailored your running kernel to your or your hardware's needs: the make target 'olddefconfig' will then try to use that kernel's .config as base.h]hUse the same command, if your distribution or somebody else already tailored your running kernel to your or your hardware’s needs: the make target ‘olddefconfig’ will then try to use that kernel’s .config as base.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(h~Using this make target is fine for everybody else, too -- but you often can save a lot of time by using this command instead::h]h}Using this make target is fine for everybody else, too -- but you often can save a lot of time by using this command instead:}(h}Using this make target is fine for everybody else, too -- but you often can save a lot of time by using this command instead:hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj!)}(hyes "" | make localmodconfigh]hyes "" | make localmodconfig}(hhhj2ubah}(h]h ]h"]h$]h&]hhuh1j hhhKhjubh)}(hXThis will try to pick your distribution's kernel as base, but then disable modules for any features apparently superfluous for your setup. This will reduce the compile time enormously, especially if you are running an universal kernel from a commodity Linux distribution.h]hXThis will try to pick your distribution’s kernel as base, but then disable modules for any features apparently superfluous for your setup. This will reduce the compile time enormously, especially if you are running an universal kernel from a commodity Linux distribution.}(hjBhj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hXRThere is a catch: 'localmodconfig' is likely to disable kernel features you did not use since you booted your Linux -- like drivers for currently disconnected peripherals or a virtualization software not haven't used yet. You can reduce or nearly eliminate that risk with tricks the reference section outlines; but when building a kernel just for quick testing purposes it is often negligible if such features are missing. But you should keep that aspect in mind when using a kernel built with this make target, as it might be the reason why something you only use occasionally stopped working.h]hXXThere is a catch: ‘localmodconfig’ is likely to disable kernel features you did not use since you booted your Linux -- like drivers for currently disconnected peripherals or a virtualization software not haven’t used yet. You can reduce or nearly eliminate that risk with tricks the reference section outlines; but when building a kernel just for quick testing purposes it is often negligible if such features are missing. But you should keep that aspect in mind when using a kernel built with this make target, as it might be the reason why something you only use occasionally stopped working.}(hjPhjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(h[:ref:`details`]h](h[}(hjhj\hhhNhNubh)}(h:ref:`details`h]j)}(hjfh]hdetails}(hhhjhhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjdubah}(h]h ]h"]h$]h&]refdocj refdomainjrreftyperef refexplicitrefwarnj configurationuh1hhhhKhj\ubh]}(hj hj\hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]jah ]h"]configuration_sbsah$]h&]jjuh1jhhhKhjMj&}jjsj(}jjsubeh}(h]jLah ]h"] tagging_sbsah$]h&]uh1jhjUhhhNhNj&}jjBsj(}jLjBsubj)}(h.. _configmods_sbs:h]h}(h]h ]h"]h$]h&]jconfigmods-sbsuh1jhKhjUhhhhubj)}(hhh](j)}(hhh]j)}(hPCheck if you might want to or have to adjust some kernel configuration options: h]h)}(hOCheck if you might want to or have to adjust some kernel configuration options:h]hOCheck if you might want to or have to adjust some kernel configuration options:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]jjuh1jhhhKhjubj)}(hhh]j)}(hhh](j)}(hXEvaluate how you want to handle debug symbols. Enable them, if you later might need to decode a stack trace found for example in a 'panic', 'Oops', 'warning', or 'BUG'; on the other hand disable them, if you are short on storage space or prefer a smaller kernel binary. See the reference section for details on how to do either. If neither applies, it will likely be fine to simply not bother with this. [:ref:`details`] h]h)}(hXEvaluate how you want to handle debug symbols. Enable them, if you later might need to decode a stack trace found for example in a 'panic', 'Oops', 'warning', or 'BUG'; on the other hand disable them, if you are short on storage space or prefer a smaller kernel binary. See the reference section for details on how to do either. If neither applies, it will likely be fine to simply not bother with this. [:ref:`details`]h](hXEvaluate how you want to handle debug symbols. Enable them, if you later might need to decode a stack trace found for example in a ‘panic’, ‘Oops’, ‘warning’, or ‘BUG’; on the other hand disable them, if you are short on storage space or prefer a smaller kernel binary. See the reference section for details on how to do either. If neither applies, it will likely be fine to simply not bother with this. [}(hXEvaluate how you want to handle debug symbols. Enable them, if you later might need to decode a stack trace found for example in a 'panic', 'Oops', 'warning', or 'BUG'; on the other hand disable them, if you are short on storage space or prefer a smaller kernel binary. See the reference section for details on how to do either. If neither applies, it will likely be fine to simply not bother with this. [hjhhhNhNubh)}(h':ref:`details`h]j)}(hjh]hdetails}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjconfigmods_debugsymbolsuh1hhhhKhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hAre you running Debian? Then to avoid known problems by performing additional adjustments explained in the reference section. [:ref:`details`]. h]h)}(hAre you running Debian? Then to avoid known problems by performing additional adjustments explained in the reference section. [:ref:`details`].h](hAre you running Debian? Then to avoid known problems by performing additional adjustments explained in the reference section. [}(hAre you running Debian? Then to avoid known problems by performing additional adjustments explained in the reference section. [hjhhhNhNubh)}(h":ref:`details`h]j)}(hj'h]hdetails}(hhhj)hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj%ubah}(h]h ]h"]h$]h&]refdocj refdomainj3reftyperef refexplicitrefwarnjconfigmods_distrosuh1hhhhKhjubh].}(h].hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hIf you want to influence the other aspects of the configuration, do so now by using make targets like 'menuconfig' or 'xconfig'. [:ref:`details`]. h]h)}(hIf you want to influence the other aspects of the configuration, do so now by using make targets like 'menuconfig' or 'xconfig'. [:ref:`details`].h](hIf you want to influence the other aspects of the configuration, do so now by using make targets like ‘menuconfig’ or ‘xconfig’. [}(hIf you want to influence the other aspects of the configuration, do so now by using make targets like 'menuconfig' or 'xconfig'. [hjZhhhNhNubh)}(h%:ref:`details`h]j)}(hjeh]hdetails}(hhhjghhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjcubah}(h]h ]h"]h$]h&]refdocj refdomainjqreftyperef refexplicitrefwarnjconfigmods_individualuh1hhhhKhjZubh].}(h].hjZhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjVubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]jjuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]jah ]h"]configmods_sbsah$]h&]uh1jhjUhhhhhNj&}jjsj(}jjsubj)}(h.. _build_sbs:h]h}(h]h ]h"]h$]h&]j build-sbsuh1jhKhjUhhhhubj)}(hhh]j)}(hhh]j)}(hBuild the image and the modules of your kernel:: make -j $(nproc --all) If you want your kernel packaged up as deb, rpm, or tar file, see the reference section for alternatives. [:ref:`details`] h](h)}(h0Build the image and the modules of your kernel::h]h/Build the image and the modules of your kernel:}(h/Build the image and the modules of your kernel:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubj!)}(hmake -j $(nproc --all)h]hmake -j $(nproc --all)}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhKhjubh)}(hiIf you want your kernel packaged up as deb, rpm, or tar file, see the reference section for alternatives.h]hiIf you want your kernel packaged up as deb, rpm, or tar file, see the reference section for alternatives.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(h[:ref:`details`]h](h[}(hjhjhhhNhNubh)}(h:ref:`details`h]j)}(hjh]hdetails}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjbuilduh1hhhhMhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]jjuh1jhhhKhjubah}(h]jah ]h"] build_sbsah$]h&]uh1jhjUhhhNhNj&}j+ jsj(}jjsubj)}(h.. _install_sbs:h]h}(h]h ]h"]h$]h&]j install-sbsuh1jhMhjUhhhhubj)}(hhh]j)}(hhh]j)}(hXNow install your kernel:: command -v installkernel && sudo make modules_install install Often all left for you to do afterwards is a ``reboot``, as many commodity Linux distributions will then create an initramfs (also known as initrd) and an entry for your kernel in your bootloader's configuration; but on some distributions you have to take care of these two steps manually for reasons the reference section explains. On a few distributions like Arch Linux and its derivatives the above command does nothing at all; in that case you have to manually install your kernel, as outlined in the reference section. If you are running a immutable Linux distribution, check its documentation and the web to find out how to install your own kernel there. [:ref:`details`] h](h)}(hNow install your kernel::h]hNow install your kernel:}(hNow install your kernel:hjE hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjA ubj!)}(h=command -v installkernel && sudo make modules_install installh]h=command -v installkernel && sudo make modules_install install}(hhhjT ubah}(h]h ]h"]h$]h&]hhuh1j hhhMhjA ubh)}(hXLOften all left for you to do afterwards is a ``reboot``, as many commodity Linux distributions will then create an initramfs (also known as initrd) and an entry for your kernel in your bootloader's configuration; but on some distributions you have to take care of these two steps manually for reasons the reference section explains.h](h-Often all left for you to do afterwards is a }(h-Often all left for you to do afterwards is a hjb hhhNhNubjI)}(h ``reboot``h]hreboot}(hhhjk hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjb ubhX, as many commodity Linux distributions will then create an initramfs (also known as initrd) and an entry for your kernel in your bootloader’s configuration; but on some distributions you have to take care of these two steps manually for reasons the reference section explains.}(hX, as many commodity Linux distributions will then create an initramfs (also known as initrd) and an entry for your kernel in your bootloader's configuration; but on some distributions you have to take care of these two steps manually for reasons the reference section explains.hjb hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hjA ubh)}(hOn a few distributions like Arch Linux and its derivatives the above command does nothing at all; in that case you have to manually install your kernel, as outlined in the reference section.h]hOn a few distributions like Arch Linux and its derivatives the above command does nothing at all; in that case you have to manually install your kernel, as outlined in the reference section.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjA ubh)}(hIf you are running a immutable Linux distribution, check its documentation and the web to find out how to install your own kernel there.h]hIf you are running a immutable Linux distribution, check its documentation and the web to find out how to install your own kernel there.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjA ubh)}(h[:ref:`details`]h](h[}(hjhj hhhNhNubh)}(h:ref:`details`h]j)}(hj h]hdetails}(hhhj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnjinstalluh1hhhhMhj ubh]}(hj hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjA ubeh}(h]h ]h"]h$]h&]uh1jhj> ubah}(h]h ]h"]h$]h&]jjuh1jhhhMhj; ubah}(h]j: ah ]h"] install_sbsah$]h&]uh1jhjUhhhNhNj&}j j0 sj(}j: j0 subj)}(h.. _another_sbs:h]h}(h]h ]h"]h$]h&]j another-sbsuh1jhMhjUhhhhubj)}(hhh]j)}(hhh]j)}(hXTo later build another kernel you need similar steps, but sometimes slightly different commands. First, switch back into the sources tree:: cd ~/linux/ In case you want to build a version from a stable/longterm series you have not used yet (say 6.2.y), tell git to track it:: git remote set-branches --add origin linux-6.2.y Now fetch the latest upstream changes; you again need to specify the earliest version you care about, as git otherwise might retrieve the entire commit history:: git fetch --shallow-exclude=v6.0 origin Now switch to the version you are interested in -- but be aware the command used here will discard any modifications you performed, as they would conflict with the sources you want to checkout:: git checkout --force --detach origin/master At this point you might want to patch the sources again or set/modify a build tag, as explained earlier. Afterwards adjust the build configuration to the new codebase using olddefconfig, which will now adjust the configuration file you prepared earlier using localmodconfig (~/linux/.config) for your next kernel:: # reminder: if you want to apply patches, do it at this point # reminder: you might want to update your build tag at this point make olddefconfig Now build your kernel:: make -j $(nproc --all) Afterwards install the kernel as outlined above:: command -v installkernel && sudo make modules_install install [:ref:`details`] h](h)}(h`To later build another kernel you need similar steps, but sometimes slightly different commands.h]h`To later build another kernel you need similar steps, but sometimes slightly different commands.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubh)}(h*First, switch back into the sources tree::h]h)First, switch back into the sources tree:}(h)First, switch back into the sources tree:hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubj!)}(h cd ~/linux/h]h cd ~/linux/}(hhhj ubah}(h]h ]h"]h$]h&]hhuh1j hhhM hj ubh)}(h{In case you want to build a version from a stable/longterm series you have not used yet (say 6.2.y), tell git to track it::h]hzIn case you want to build a version from a stable/longterm series you have not used yet (say 6.2.y), tell git to track it:}(hzIn case you want to build a version from a stable/longterm series you have not used yet (say 6.2.y), tell git to track it:hj' hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM"hj ubj!)}(h0git remote set-branches --add origin linux-6.2.yh]h0git remote set-branches --add origin linux-6.2.y}(hhhj6 ubah}(h]h ]h"]h$]h&]hhuh1j hhhM%hj ubh)}(hNow fetch the latest upstream changes; you again need to specify the earliest version you care about, as git otherwise might retrieve the entire commit history::h]hNow fetch the latest upstream changes; you again need to specify the earliest version you care about, as git otherwise might retrieve the entire commit history:}(hNow fetch the latest upstream changes; you again need to specify the earliest version you care about, as git otherwise might retrieve the entire commit history:hjD hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM'hj ubj!)}(h'git fetch --shallow-exclude=v6.0 originh]h'git fetch --shallow-exclude=v6.0 origin}(hhhjS ubah}(h]h ]h"]h$]h&]hhuh1j hhhM+hj ubh)}(hNow switch to the version you are interested in -- but be aware the command used here will discard any modifications you performed, as they would conflict with the sources you want to checkout::h]hNow switch to the version you are interested in -- but be aware the command used here will discard any modifications you performed, as they would conflict with the sources you want to checkout:}(hNow switch to the version you are interested in -- but be aware the command used here will discard any modifications you performed, as they would conflict with the sources you want to checkout:hja hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM-hj ubj!)}(h+git checkout --force --detach origin/masterh]h+git checkout --force --detach origin/master}(hhhjp ubah}(h]h ]h"]h$]h&]hhuh1j hhhM1hj ubh)}(hX;At this point you might want to patch the sources again or set/modify a build tag, as explained earlier. Afterwards adjust the build configuration to the new codebase using olddefconfig, which will now adjust the configuration file you prepared earlier using localmodconfig (~/linux/.config) for your next kernel::h]hX:At this point you might want to patch the sources again or set/modify a build tag, as explained earlier. Afterwards adjust the build configuration to the new codebase using olddefconfig, which will now adjust the configuration file you prepared earlier using localmodconfig (~/linux/.config) for your next kernel:}(hX:At this point you might want to patch the sources again or set/modify a build tag, as explained earlier. Afterwards adjust the build configuration to the new codebase using olddefconfig, which will now adjust the configuration file you prepared earlier using localmodconfig (~/linux/.config) for your next kernel:hj~ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hj ubj!)}(h# reminder: if you want to apply patches, do it at this point # reminder: you might want to update your build tag at this point make olddefconfigh]h# reminder: if you want to apply patches, do it at this point # reminder: you might want to update your build tag at this point make olddefconfig}(hhhj ubah}(h]h ]h"]h$]h&]hhuh1j hhhM9hj ubh)}(hNow build your kernel::h]hNow build your kernel:}(hNow build your kernel:hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM=hj ubj!)}(hmake -j $(nproc --all)h]hmake -j $(nproc --all)}(hhhj ubah}(h]h ]h"]h$]h&]hhuh1j hhhM?hj ubh)}(h1Afterwards install the kernel as outlined above::h]h0Afterwards install the kernel as outlined above:}(h0Afterwards install the kernel as outlined above:hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMAhj ubj!)}(h=command -v installkernel && sudo make modules_install installh]h=command -v installkernel && sudo make modules_install install}(hhhj ubah}(h]h ]h"]h$]h&]hhuh1j hhhMChj ubh)}(h[:ref:`details`]h](h[}(hjhj hhhNhNubh)}(h:ref:`details`h]j)}(hj h]hdetails}(hhhj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnjanotheruh1hhhhMEhj ubh]}(hj hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMEhj ubeh}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]jjuh1jhhhMhj ubah}(h]j ah ]h"] another_sbsah$]h&]uh1jhjUhhhNhNj&}j j sj(}j j subj)}(h.. _uninstall_sbs:h]h}(h]h ]h"]h$]h&]j uninstall-sbsuh1jhMGhjUhhhhubj)}(hhh]j)}(hhh]j)}(hXSYour kernel is easy to remove later, as its parts are only stored in two places and clearly identifiable by the kernel's release name. Just ensure to not delete the kernel you are running, as that might render your system unbootable. Start by deleting the directory holding your kernel's modules, which is named after its release name -- '6.0.1-foobar' in the following example:: sudo rm -rf /lib/modules/6.0.1-foobar Now try the following command, which on some distributions will delete all other kernel files installed while also removing the kernel's entry from the bootloader configuration:: command -v kernel-install && sudo kernel-install -v remove 6.0.1-foobar If that command does not output anything or fails, see the reference section; do the same if any files named '*6.0.1-foobar*' remain in /boot/. [:ref:`details`] h](h)}(hYour kernel is easy to remove later, as its parts are only stored in two places and clearly identifiable by the kernel's release name. Just ensure to not delete the kernel you are running, as that might render your system unbootable.h]hYour kernel is easy to remove later, as its parts are only stored in two places and clearly identifiable by the kernel’s release name. Just ensure to not delete the kernel you are running, as that might render your system unbootable.}(hj3 hj1 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMIhj- ubh)}(hStart by deleting the directory holding your kernel's modules, which is named after its release name -- '6.0.1-foobar' in the following example::h]hStart by deleting the directory holding your kernel’s modules, which is named after its release name -- ‘6.0.1-foobar’ in the following example:}(hStart by deleting the directory holding your kernel's modules, which is named after its release name -- '6.0.1-foobar' in the following example:hj? hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMNhj- ubj!)}(h%sudo rm -rf /lib/modules/6.0.1-foobarh]h%sudo rm -rf /lib/modules/6.0.1-foobar}(hhhjN ubah}(h]h ]h"]h$]h&]hhuh1j hhhMQhj- ubh)}(hNow try the following command, which on some distributions will delete all other kernel files installed while also removing the kernel's entry from the bootloader configuration::h]hNow try the following command, which on some distributions will delete all other kernel files installed while also removing the kernel’s entry from the bootloader configuration:}(hNow try the following command, which on some distributions will delete all other kernel files installed while also removing the kernel's entry from the bootloader configuration:hj\ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMShj- ubj!)}(hGcommand -v kernel-install && sudo kernel-install -v remove 6.0.1-foobarh]hGcommand -v kernel-install && sudo kernel-install -v remove 6.0.1-foobar}(hhhjk ubah}(h]h ]h"]h$]h&]hhuh1j hhhMWhj- ubh)}(hIf that command does not output anything or fails, see the reference section; do the same if any files named '*6.0.1-foobar*' remain in /boot/.h](hpIf that command does not output anything or fails, see the reference section; do the same if any files named ‘}(hnIf that command does not output anything or fails, see the reference section; do the same if any files named 'hjy hhhNhNubh)}(h*6.0.1-foobar*h]h 6.0.1-foobar}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjy ubh’ remain in /boot/.}(h' remain in /boot/.hjy hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMYhj- ubh)}(h[:ref:`details`]h](h[}(hjhj hhhNhNubh)}(h:ref:`details`h]j)}(hj h]hdetails}(hhhj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnj uninstalluh1hhhhM\hj ubh]}(hj hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM\hj- ubeh}(h]h ]h"]h$]h&]uh1jhj* ubah}(h]h ]h"]h$]h&]jjuh1jhhhMIhj' ubah}(h]j& ah ]h"] uninstall_sbsah$]h&]uh1jhjUhhhNhNj&}j j sj(}j& j subj)}(h.. _submit_improvements:h]h}(h]h ]h"]h$]h&]jsubmit-improvementsuh1jhM^hjUhhhhubh)}(hXDid you run into trouble following any of the above steps that is not cleared up by the reference section below? Or do you have ideas how to improve the text? Then please take a moment of your time and let the maintainer of this document know by email (Thorsten Leemhuis ), ideally while CCing the Linux docs mailing list (linux-doc@vger.kernel.org). Such feedback is vital to improve this document further, which is in everybody's interest, as it will enable more people to master the task described here.h](hXDid you run into trouble following any of the above steps that is not cleared up by the reference section below? Or do you have ideas how to improve the text? Then please take a moment of your time and let the maintainer of this document know by email (Thorsten Leemhuis <}(hXDid you run into trouble following any of the above steps that is not cleared up by the reference section below? Or do you have ideas how to improve the text? Then please take a moment of your time and let the maintainer of this document know by email (Thorsten Leemhuis ), ideally while CCing the Linux docs mailing list (}(h5>), ideally while CCing the Linux docs mailing list (hj hhhNhNubj )}(hlinux-doc@vger.kernel.orgh]hlinux-doc@vger.kernel.org}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]refuri mailto:linux-doc@vger.kernel.orguh1j hj ubh). Such feedback is vital to improve this document further, which is in everybody’s interest, as it will enable more people to master the task described here.}(h). Such feedback is vital to improve this document further, which is in everybody's interest, as it will enable more people to master the task described here.hj hhhNhNubeh}(h]j ah ]h"]submit_improvementsah$]h&]uh1hhhhM`hjUhhj&}j& j sj(}j j subeh}(h]step-by-step-guideah ]h"]step-by-step guideah$]h&]uh1hhhhhhhhK7ubh)}(hhh](h)}(h,Reference section for the step-by-step guideh]h,Reference section for the step-by-step guide}(hj8 hj6 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj3 hhhhhMiubh)}(hSThis section holds additional information for each of the steps in the above guide.h]hSThis section holds additional information for each of the steps in the above guide.}(hjF hjD hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMkhj3 hhubj)}(h .. _backup:h]h}(h]h ]h"]h$]h&]jbackupuh1jhMnhj3 hhhhubh)}(hhh](h)}(hPrepare for emergenciesh]hPrepare for emergencies}(hjb hj` hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj] hhhhhMqubj)}(hhh]h)}(ha*Create a fresh backup and put system repair and restore tools at hand* [:ref:`... `]h](h)}(hG*Create a fresh backup and put system repair and restore tools at hand*h]hECreate a fresh backup and put system repair and restore tools at hand}(hhhju hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjq ubh [}(h [hjq hhhNhNubh)}(h:ref:`... `h]j)}(hj h]h...}(hhhj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnj backup_sbsuh1hhhhMshjq ubh]}(hj hjq hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMshjn ubah}(h]h ]h"]h$]h&]uh1jhj] hhhhhNubh)}(hX*Remember, you are dealing with computers, which sometimes do unexpected things -- especially if you fiddle with crucial parts like the kernel of an operating system. That's what you are about to do in this process. Hence, better prepare for something going sideways, even if that should not happen.h]hX,Remember, you are dealing with computers, which sometimes do unexpected things -- especially if you fiddle with crucial parts like the kernel of an operating system. That’s what you are about to do in this process. Hence, better prepare for something going sideways, even if that should not happen.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMvhj] hhubh)}(h0[:ref:`back to step-by-step guide `]h](h[}(hjhj hhhNhNubh)}(h.:ref:`back to step-by-step guide `h]j)}(hj h]hback to step-by-step guide}(hhhj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnj backup_sbsuh1hhhhM{hj ubh]}(hj hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM{hj] hhubj)}(h.. _secureboot:h]h}(h]h ]h"]h$]h&]j securebootuh1jhM}hj] hhhhubeh}(h](prepare-for-emergenciesj\ eh ]h"](prepare for emergenciesbackupeh$]h&]uh1hhj3 hhhhhMqj&}j jR sj(}j\ jR subh)}(hhh](h)}(h(Dealing with techniques like Secure Booth]h(Dealing with techniques like Secure Boot}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubj)}(hhh]h)}(h*On platforms with 'Secure Boot' or similar techniques, prepare everything to ensure the system will permit your self-compiled kernel to boot later.* [:ref:`... `]h](h)}(h*On platforms with 'Secure Boot' or similar techniques, prepare everything to ensure the system will permit your self-compiled kernel to boot later.*h]hOn platforms with ‘Secure Boot’ or similar techniques, prepare everything to ensure the system will permit your self-compiled kernel to boot later.}(hhhj& hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj" ubh [}(h [hj" hhhNhNubh)}(h:ref:`... `h]j)}(hj; h]h...}(hhhj= hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj9 ubah}(h]h ]h"]h$]h&]refdocj refdomainjG reftyperef refexplicitrefwarnjsecureboot_sbsuh1hhhhMhj" ubh]}(hj hj" hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubh)}(hMany modern systems allow only certain operating systems to start; they thus by default will reject booting self-compiled kernels.h]hMany modern systems allow only certain operating systems to start; they thus by default will reject booting self-compiled kernels.}(hjk hji hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hXaYou ideally deal with this by making your platform trust your self-built kernels with the help of a certificate and signing. How to do that is not described here, as it requires various steps that would take the text too far away from its purpose; 'Documentation/admin-guide/module-signing.rst' and various web sides already explain this in more detail.h]hXeYou ideally deal with this by making your platform trust your self-built kernels with the help of a certificate and signing. How to do that is not described here, as it requires various steps that would take the text too far away from its purpose; ‘Documentation/admin-guide/module-signing.rst’ and various web sides already explain this in more detail.}(hjy hjw hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hTemporarily disabling solutions like Secure Boot is another way to make your own Linux boot. On commodity x86 systems it is possible to do this in the BIOS Setup utility; the steps to do so are not described here, as they greatly vary between machines.h]hTemporarily disabling solutions like Secure Boot is another way to make your own Linux boot. On commodity x86 systems it is possible to do this in the BIOS Setup utility; the steps to do so are not described here, as they greatly vary between machines.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hX6On mainstream x86 Linux distributions there is a third and universal option: disable all Secure Boot restrictions for your Linux environment. You can initiate this process by running ``mokutil --disable-validation``; this will tell you to create a one-time password, which is safe to write down. Now restart; right after your BIOS performed all self-tests the bootloader Shim will show a blue box with a message 'Press any key to perform MOK management'. Hit some key before the countdown exposes. This will open a menu and choose 'Change Secure Boot state' there. Shim's 'MokManager' will now ask you to enter three randomly chosen characters from the one-time password specified earlier. Once you provided them, confirm that you really want to disable the validation. Afterwards, permit MokManager to reboot the machine.h](hOn mainstream x86 Linux distributions there is a third and universal option: disable all Secure Boot restrictions for your Linux environment. You can initiate this process by running }(hOn mainstream x86 Linux distributions there is a third and universal option: disable all Secure Boot restrictions for your Linux environment. You can initiate this process by running hj hhhNhNubjI)}(h ``mokutil --disable-validation``h]hmokutil --disable-validation}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj ubhXm; this will tell you to create a one-time password, which is safe to write down. Now restart; right after your BIOS performed all self-tests the bootloader Shim will show a blue box with a message ‘Press any key to perform MOK management’. Hit some key before the countdown exposes. This will open a menu and choose ‘Change Secure Boot state’ there. Shim’s ‘MokManager’ will now ask you to enter three randomly chosen characters from the one-time password specified earlier. Once you provided them, confirm that you really want to disable the validation. Afterwards, permit MokManager to reboot the machine.}(hX_; this will tell you to create a one-time password, which is safe to write down. Now restart; right after your BIOS performed all self-tests the bootloader Shim will show a blue box with a message 'Press any key to perform MOK management'. Hit some key before the countdown exposes. This will open a menu and choose 'Change Secure Boot state' there. Shim's 'MokManager' will now ask you to enter three randomly chosen characters from the one-time password specified earlier. Once you provided them, confirm that you really want to disable the validation. Afterwards, permit MokManager to reboot the machine.hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(h4[:ref:`back to step-by-step guide `]h](h[}(hjhj hhhNhNubh)}(h2:ref:`back to step-by-step guide `h]j)}(hj h]hback to step-by-step guide}(hhhj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnjsecureboot_sbsuh1hhhhMhj ubh]}(hj hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj)}(h.. _buildrequires:h]h}(h]h ]h"]h$]h&]j buildrequiresuh1jhMhj hhhhubeh}(h]((dealing-with-techniques-like-secure-bootj eh ]h"]((dealing with techniques like secure boot securebooteh$]h&]uh1hhj3 hhhhhMj&}j j sj(}j j subh)}(hhh](h)}(hInstall build requirementsh]hInstall build requirements}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubj)}(hhh]h)}(hX*Install all software required to build a Linux kernel.* [:ref:`...`]h](h)}(h8*Install all software required to build a Linux kernel.*h]h6Install all software required to build a Linux kernel.}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh [}(h [hjhhhNhNubh)}(h:ref:`...`h]j)}(hj*h]h...}(hhhj,hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj(ubah}(h]h ]h"]h$]h&]refdocj refdomainj6reftyperef refexplicitrefwarnjbuildrequires_sbsuh1hhhhMhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubh)}(hThe kernel is pretty stand-alone, but besides tools like the compiler you will sometimes need a few libraries to build one. How to install everything needed depends on your Linux distribution and the configuration of the kernel you are about to build.h]hThe kernel is pretty stand-alone, but besides tools like the compiler you will sometimes need a few libraries to build one. How to install everything needed depends on your Linux distribution and the configuration of the kernel you are about to build.}(hjZhjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hQHere are a few examples what you typically need on some mainstream distributions:h]hQHere are a few examples what you typically need on some mainstream distributions:}(hjhhjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj)}(hhh]j)}(hhh](j)}(hDebian, Ubuntu, and derivatives:: sudo apt install bc binutils bison dwarves flex gcc git make openssl \ pahole perl-base libssl-dev libelf-dev h](h)}(h!Debian, Ubuntu, and derivatives::h]h Debian, Ubuntu, and derivatives:}(h Debian, Ubuntu, and derivatives:hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjzubj!)}(hosudo apt install bc binutils bison dwarves flex gcc git make openssl \ pahole perl-base libssl-dev libelf-devh]hosudo apt install bc binutils bison dwarves flex gcc git make openssl \ pahole perl-base libssl-dev libelf-dev}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhMhjzubeh}(h]h ]h"]h$]h&]uh1jhjwubj)}(hFedora and derivatives:: sudo dnf install binutils /usr/include/{libelf.h,openssl/pkcs7.h} \ /usr/bin/{bc,bison,flex,gcc,git,openssl,make,perl,pahole} h](h)}(hFedora and derivatives::h]hFedora and derivatives:}(hFedora and derivatives:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj!)}(hsudo dnf install binutils /usr/include/{libelf.h,openssl/pkcs7.h} \ /usr/bin/{bc,bison,flex,gcc,git,openssl,make,perl,pahole}h]hsudo dnf install binutils /usr/include/{libelf.h,openssl/pkcs7.h} \ /usr/bin/{bc,bison,flex,gcc,git,openssl,make,perl,pahole}}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjwubj)}(hopenSUSE and derivatives:: sudo zypper install bc binutils bison dwarves flex gcc git make perl-base \ openssl openssl-devel libelf-dev h](h)}(hopenSUSE and derivatives::h]hopenSUSE and derivatives:}(hopenSUSE and derivatives:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubj!)}(hnsudo zypper install bc binutils bison dwarves flex gcc git make perl-base \ openssl openssl-devel libelf-devh]hnsudo zypper install bc binutils bison dwarves flex gcc git make perl-base \ openssl openssl-devel libelf-dev}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjwubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjtubah}(h]h ]h"]h$]h&]uh1jhj hhhNhNubh)}(hIn case you wonder why these lists include openssl and its development headers: they are needed for the Secure Boot support, which many distributions enable in their kernel configuration for x86 machines.h]hIn case you wonder why these lists include openssl and its development headers: they are needed for the Secure Boot support, which many distributions enable in their kernel configuration for x86 machines.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hlSometimes you will need tools for compression formats like bzip2, gzip, lz4, lzma, lzo, xz, or zstd as well.h]hlSometimes you will need tools for compression formats like bzip2, gzip, lz4, lzma, lzo, xz, or zstd as well.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hXUYou might need additional libraries and their development headers in case you perform tasks not covered in this guide. For example, zlib will be needed when building kernel tools from the tools/ directory; adjusting the build configuration with make targets like 'menuconfig' or 'xconfig' will require development headers for ncurses or Qt5.h]hX]You might need additional libraries and their development headers in case you perform tasks not covered in this guide. For example, zlib will be needed when building kernel tools from the tools/ directory; adjusting the build configuration with make targets like ‘menuconfig’ or ‘xconfig’ will require development headers for ncurses or Qt5.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(h7[:ref:`back to step-by-step guide `]h](h[}(hjhj%hhhNhNubh)}(h5:ref:`back to step-by-step guide `h]j)}(hj/h]hback to step-by-step guide}(hhhj1hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj-ubah}(h]h ]h"]h$]h&]refdocj refdomainj;reftyperef refexplicitrefwarnjbuildrequires_sbsuh1hhhhMhj%ubh]}(hj hj%hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj)}(h.. _diskspace:h]h}(h]h ]h"]h$]h&]j diskspaceuh1jhMhj hhhhubeh}(h](install-build-requirementsj eh ]h"](install build requirements buildrequireseh$]h&]uh1hhj3 hhhhhMj&}jhj sj(}j j subh)}(hhh](h)}(hSpace requirementsh]hSpace requirements}(hjrhjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhjmhhhhhMubj)}(hhh]h)}(hb*Ensure to have enough free space for building and installing Linux.* [:ref:`... `]h](h)}(hE*Ensure to have enough free space for building and installing Linux.*h]hCEnsure to have enough free space for building and installing Linux.}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh [}(h [hjhhhNhNubh)}(h:ref:`... `h]j)}(hjh]h...}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj diskspace_sbsuh1hhhhMhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj~ubah}(h]h ]h"]h$]h&]uh1jhjmhhhhhNubh)}(hvThe numbers mentioned are rough estimates with a big extra charge to be on the safe side, so often you will need less.h]hvThe numbers mentioned are rough estimates with a big extra charge to be on the safe side, so often you will need less.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjmhhubh)}(hIf you have space constraints, remember to read the reference section when you reach the :ref:`section about configuration adjustments' `, as ensuring debug symbols are disabled will reduce the consumed disk space by quite a few gigabytes.h](hYIf you have space constraints, remember to read the reference section when you reach the }(hYIf you have space constraints, remember to read the reference section when you reach the hjhhhNhNubh)}(h<:ref:`section about configuration adjustments' `h]j)}(hjh]h*section about configuration adjustments’}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj configmodsuh1hhhhMhjubhf, as ensuring debug symbols are disabled will reduce the consumed disk space by quite a few gigabytes.}(hf, as ensuring debug symbols are disabled will reduce the consumed disk space by quite a few gigabytes.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjmhhubh)}(h3[:ref:`back to step-by-step guide `]h](h[}(hjhj hhhNhNubh)}(h1:ref:`back to step-by-step guide `h]j)}(hjh]hback to step-by-step guide}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnj diskspace_sbsuh1hhhhMhj ubh]}(hj hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjmhhubj)}(h .. _sources:h]h}(h]h ]h"]h$]h&]jsourcesuh1jhMhjmhhhhubeh}(h](space-requirementsjaeh ]h"](space requirements diskspaceeh$]h&]uh1hhj3 hhhhhMj&}jMjWsj(}jajWsubh)}(hhh](h)}(hDownload the sourcesh]hDownload the sources}(hjWhjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjRhhhhhMubj)}(hhh]h)}(hZ*Retrieve the sources of the Linux version you intend to build.* [:ref:`...`]h](h)}(h@*Retrieve the sources of the Linux version you intend to build.*h]h>Retrieve the sources of the Linux version you intend to build.}(hhhjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjfubh [}(h [hjfhhhNhNubh)}(h:ref:`...`h]j)}(hjh]h...}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj}ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sources_sbsuh1hhhhMhjfubh]}(hj hjfhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjcubah}(h]h ]h"]h$]h&]uh1jhjRhhhhhNubh)}(hXThe step-by-step guide outlines how to retrieve Linux' sources using a shallow git clone. There is :ref:`more to tell about this method` and two alternate ways worth describing: :ref:`packaged archives` and :ref:`a full git clone`. And the aspects ':ref:`wouldn't it be wiser to use a proper pre-release than the latest mainline code `' and ':ref:`how to get an even fresher mainline codebase `' need elaboration, too.h](heThe step-by-step guide outlines how to retrieve Linux’ sources using a shallow git clone. There is }(hcThe step-by-step guide outlines how to retrieve Linux' sources using a shallow git clone. There is hjhhhNhNubh)}(h6:ref:`more to tell about this method`h]j)}(hjh]hmore to tell about this method}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsources_shallowuh1hhhhMhjubh* and two alternate ways worth describing: }(h* and two alternate ways worth describing: hjhhhNhNubh)}(h):ref:`packaged archives`h]j)}(hjh]hpackaged archives}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsources_archiveuh1hhhhMhjubh and }(h and hjhhhNhNubh)}(h%:ref:`a full git clone`h]j)}(hjh]ha full git clone}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sources_fulluh1hhhhMhjubh. And the aspects ‘}(h. And the aspects 'hjhhhNhNubh)}(hh:ref:`wouldn't it be wiser to use a proper pre-release than the latest mainline code `h]j)}(hj'h]hPwouldn’t it be wiser to use a proper pre-release than the latest mainline code}(hhhj)hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj%ubah}(h]h ]h"]h$]h&]refdocj refdomainj3reftyperef refexplicitrefwarnjsources_snapshotuh1hhhhMhjubh ’ and ‘}(h' and 'hjhhhNhNubh)}(hE:ref:`how to get an even fresher mainline codebase `h]j)}(hjLh]h,how to get an even fresher mainline codebase}(hhhjNhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjJubah}(h]h ]h"]h$]h&]refdocj refdomainjXreftyperef refexplicitrefwarnjsources_fresheruh1hhhhMhjubh’ need elaboration, too.}(h' need elaboration, too.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjRhhubh)}(hX1Note, to keep things simple the commands used in this guide store the build artifacts in the source tree. If you prefer to separate them, simply add something like ``O=~/linux-builddir/`` to all make calls; also adjust the path in all commands that add files or modify any generated (like your '.config').h](hNote, to keep things simple the commands used in this guide store the build artifacts in the source tree. If you prefer to separate them, simply add something like }(hNote, to keep things simple the commands used in this guide store the build artifacts in the source tree. If you prefer to separate them, simply add something like hjuhhhNhNubjI)}(h``O=~/linux-builddir/``h]hO=~/linux-builddir/}(hhhj~hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjuubhz to all make calls; also adjust the path in all commands that add files or modify any generated (like your ‘.config’).}(hv to all make calls; also adjust the path in all commands that add files or modify any generated (like your '.config').hjuhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjRhhubh)}(h1[:ref:`back to step-by-step guide `]h](h[}(hjhjhhhNhNubh)}(h/:ref:`back to step-by-step guide `h]j)}(hjh]hback to step-by-step guide}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sources_sbsuh1hhhhMhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjRhhubj)}(h.. _sources_shallow:h]h}(h]h ]h"]h$]h&]jsources-shallowuh1jhMhjRhhhhubh)}(hhh](h)}(h,Noteworthy characteristics of shallow clonesh]h,Noteworthy characteristics of shallow clones}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hThe step-by-step guide uses a shallow clone, as it is the best solution for most of this document's target audience. There are a few aspects of this approach worth mentioning:h]hThe step-by-step guide uses a shallow clone, as it is the best solution for most of this document’s target audience. There are a few aspects of this approach worth mentioning:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(hhh]j)}(hhh](j)}(hXThis document in most places uses ``git fetch`` with ``--shallow-exclude=`` to specify the earliest version you care about (or to be precise: its git tag). You alternatively can use the parameter ``--shallow-since=`` to specify an absolute (say ``'2023-07-15'``) or relative (``'12 months'``) date to define the depth of the history you want to download. As a second alternative, you can also specify a certain depth explicitly with a parameter like ``--depth=1``, unless you add branches for stable/longterm kernels. h]h)}(hXThis document in most places uses ``git fetch`` with ``--shallow-exclude=`` to specify the earliest version you care about (or to be precise: its git tag). You alternatively can use the parameter ``--shallow-since=`` to specify an absolute (say ``'2023-07-15'``) or relative (``'12 months'``) date to define the depth of the history you want to download. As a second alternative, you can also specify a certain depth explicitly with a parameter like ``--depth=1``, unless you add branches for stable/longterm kernels.h](h"This document in most places uses }(h"This document in most places uses hjhhhNhNubjI)}(h ``git fetch``h]h git fetch}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh with }(h with hjhhhNhNubjI)}(h``--shallow-exclude=``h]h--shallow-exclude=}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubhy to specify the earliest version you care about (or to be precise: its git tag). You alternatively can use the parameter }(hy to specify the earliest version you care about (or to be precise: its git tag). You alternatively can use the parameter hjhhhNhNubjI)}(h``--shallow-since=``h]h--shallow-since=}(hhhj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh to specify an absolute (say }(h to specify an absolute (say hjhhhNhNubjI)}(h``'2023-07-15'``h]h '2023-07-15'}(hhhj?hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh) or relative (}(h) or relative (hjhhhNhNubjI)}(h``'12 months'``h]h '12 months'}(hhhjRhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh) date to define the depth of the history you want to download. As a second alternative, you can also specify a certain depth explicitly with a parameter like }(h) date to define the depth of the history you want to download. As a second alternative, you can also specify a certain depth explicitly with a parameter like hjhhhNhNubjI)}(h ``--depth=1``h]h --depth=1}(hhhjehhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh6, unless you add branches for stable/longterm kernels.}(h6, unless you add branches for stable/longterm kernels.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hXWhen running ``git fetch``, remember to always specify the oldest version, the time you care about, or an explicit depth as shown in the step-by-step guide. Otherwise you will risk downloading nearly the entire git history, which will consume quite a bit of time and bandwidth while also stressing the servers. Note, you do not have to use the same version or date all the time. But when you change it over time, git will deepen or flatten the history to the specified point. That allows you to retrieve versions you initially thought you did not need -- or it will discard the sources of older versions, for example in case you want to free up some disk space. The latter will happen automatically when using ``--shallow-since=`` or ``--depth=``. h](h)}(hX6When running ``git fetch``, remember to always specify the oldest version, the time you care about, or an explicit depth as shown in the step-by-step guide. Otherwise you will risk downloading nearly the entire git history, which will consume quite a bit of time and bandwidth while also stressing the servers.h](h When running }(h When running hjhhhNhNubjI)}(h ``git fetch``h]h git fetch}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubhX, remember to always specify the oldest version, the time you care about, or an explicit depth as shown in the step-by-step guide. Otherwise you will risk downloading nearly the entire git history, which will consume quite a bit of time and bandwidth while also stressing the servers.}(hX, remember to always specify the oldest version, the time you care about, or an explicit depth as shown in the step-by-step guide. Otherwise you will risk downloading nearly the entire git history, which will consume quite a bit of time and bandwidth while also stressing the servers.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hjubh)}(hXNote, you do not have to use the same version or date all the time. But when you change it over time, git will deepen or flatten the history to the specified point. That allows you to retrieve versions you initially thought you did not need -- or it will discard the sources of older versions, for example in case you want to free up some disk space. The latter will happen automatically when using ``--shallow-since=`` or ``--depth=``.h](hXNote, you do not have to use the same version or date all the time. But when you change it over time, git will deepen or flatten the history to the specified point. That allows you to retrieve versions you initially thought you did not need -- or it will discard the sources of older versions, for example in case you want to free up some disk space. The latter will happen automatically when using }(hXNote, you do not have to use the same version or date all the time. But when you change it over time, git will deepen or flatten the history to the specified point. That allows you to retrieve versions you initially thought you did not need -- or it will discard the sources of older versions, for example in case you want to free up some disk space. The latter will happen automatically when using hjhhhNhNubjI)}(h``--shallow-since=``h]h--shallow-since=}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh or }(h or hjhhhNhNubjI)}(h ``--depth=``h]h--depth=}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh.}(hj\hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jhjubj)}(hBe warned, when deepening your clone you might encounter an error like 'fatal: error in object: unshallow cafecaca0c0dacafecaca0c0dacafecaca0c0da'. In that case run ``git repack -d`` and try again`` h]h)}(hBe warned, when deepening your clone you might encounter an error like 'fatal: error in object: unshallow cafecaca0c0dacafecaca0c0dacafecaca0c0da'. In that case run ``git repack -d`` and try again``h](hBe warned, when deepening your clone you might encounter an error like ‘fatal: error in object: unshallow cafecaca0c0dacafecaca0c0dacafecaca0c0da’. In that case run }(hBe warned, when deepening your clone you might encounter an error like 'fatal: error in object: unshallow cafecaca0c0dacafecaca0c0dacafecaca0c0da'. In that case run hjhhhNhNubjI)}(h``git repack -d``h]h git repack -d}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh and try again``}(h and try again``hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hX*In case you want to revert changes from a certain version (say Linux 6.3) or perform a bisection (v6.2..v6.3), better tell ``git fetch`` to retrieve objects up to three versions earlier (e.g. 6.0): ``git describe`` will then be able to describe most commits just like it would in a full git clone. h]h)}(hX)In case you want to revert changes from a certain version (say Linux 6.3) or perform a bisection (v6.2..v6.3), better tell ``git fetch`` to retrieve objects up to three versions earlier (e.g. 6.0): ``git describe`` will then be able to describe most commits just like it would in a full git clone.h](h{In case you want to revert changes from a certain version (say Linux 6.3) or perform a bisection (v6.2..v6.3), better tell }(h{In case you want to revert changes from a certain version (say Linux 6.3) or perform a bisection (v6.2..v6.3), better tell hjhhhNhNubjI)}(h ``git fetch``h]h git fetch}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh> to retrieve objects up to three versions earlier (e.g. 6.0): }(h> to retrieve objects up to three versions earlier (e.g. 6.0): hjhhhNhNubjI)}(h``git describe``h]h git describe}(hhhj0hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubhS will then be able to describe most commits just like it would in a full git clone.}(hS will then be able to describe most commits just like it would in a full git clone.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhNhNubh)}(hZ[:ref:`back to step-by-step guide `] [:ref:`back to section intro `]h](h[}(hjhj[hhhNhNubh)}(h/:ref:`back to step-by-step guide `h]j)}(hjeh]hback to step-by-step guide}(hhhjghhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjcubah}(h]h ]h"]h$]h&]refdocj refdomainjqreftyperef refexplicitrefwarnj sources_sbsuh1hhhhM"hj[ubh] [}(h] [hj[hhhNhNubh)}(h&:ref:`back to section intro `h]j)}(hjh]hback to section intro}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsourcesuh1hhhhM"hj[ubh]}(hj hj[hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM"hjhhubj)}(h.. _sources_archive:h]h}(h]h ]h"]h$]h&]jsources-archiveuh1jhM$hjhhhhubeh}(h](,noteworthy-characteristics-of-shallow-clonesjeh ]h"](,noteworthy characteristics of shallow clonessources_shalloweh$]h&]uh1hhjRhhhhhMj&}jjsj(}jjsubh)}(hhh](h)}(h0Downloading the sources using a packages archiveh]h0Downloading the sources using a packages archive}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM'ubh)}(hX}People new to compiling Linux often assume downloading an archive via the front-page of https://kernel.org is the best approach to retrieve Linux' sources. It actually can be, if you are certain to build just one particular kernel version without changing any code. Thing is: you might be sure this will be the case, but in practice it often will turn out to be a wrong assumption.h](hXPeople new to compiling Linux often assume downloading an archive via the front-page of }(hXPeople new to compiling Linux often assume downloading an archive via the front-page of hjhhhNhNubj )}(hhttps://kernel.orgh]hhttps://kernel.org}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1j hjubhX is the best approach to retrieve Linux’ sources. It actually can be, if you are certain to build just one particular kernel version without changing any code. Thing is: you might be sure this will be the case, but in practice it often will turn out to be a wrong assumption.}(hX is the best approach to retrieve Linux' sources. It actually can be, if you are certain to build just one particular kernel version without changing any code. Thing is: you might be sure this will be the case, but in practice it often will turn out to be a wrong assumption.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM)hjhhubh)}(hXThat's because when reporting or debugging an issue developers will often ask to give another version a try. They also might suggest temporarily undoing a commit with ``git revert`` or might provide various patches to try. Sometimes reporters will also be asked to use ``git bisect`` to find the change causing a problem. These things rely on git or are a lot easier and quicker to handle with it.h](hThat’s because when reporting or debugging an issue developers will often ask to give another version a try. They also might suggest temporarily undoing a commit with }(hThat's because when reporting or debugging an issue developers will often ask to give another version a try. They also might suggest temporarily undoing a commit with hjhhhNhNubjI)}(h``git revert``h]h git revert}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubhX or might provide various patches to try. Sometimes reporters will also be asked to use }(hX or might provide various patches to try. Sometimes reporters will also be asked to use hjhhhNhNubjI)}(h``git bisect``h]h git bisect}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubhr to find the change causing a problem. These things rely on git or are a lot easier and quicker to handle with it.}(hr to find the change causing a problem. These things rely on git or are a lot easier and quicker to handle with it.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM/hjhhubh)}(hX5A shallow clone also does not add any significant overhead. For example, when you use ``git clone --depth=1`` to create a shallow clone of the latest mainline codebase git will only retrieve a little more data than downloading the latest mainline pre-release (aka 'rc') via the front-page of kernel.org would.h](hVA shallow clone also does not add any significant overhead. For example, when you use }(hVA shallow clone also does not add any significant overhead. For example, when you use hj1hhhNhNubjI)}(h``git clone --depth=1``h]hgit clone --depth=1}(hhhj:hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj1ubh to create a shallow clone of the latest mainline codebase git will only retrieve a little more data than downloading the latest mainline pre-release (aka ‘rc’) via the front-page of kernel.org would.}(h to create a shallow clone of the latest mainline codebase git will only retrieve a little more data than downloading the latest mainline pre-release (aka 'rc') via the front-page of kernel.org would.hj1hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM5hjhhubh)}(hXA shallow clone therefore is often the better choice. If you nevertheless want to use a packaged source archive, download one via kernel.org; afterwards extract its content to some directory and change to the subdirectory created during extraction. The rest of the step-by-step guide will work just fine, apart from things that rely on git -- but this mainly concerns the section on successive builds of other versions.h]hXA shallow clone therefore is often the better choice. If you nevertheless want to use a packaged source archive, download one via kernel.org; afterwards extract its content to some directory and change to the subdirectory created during extraction. The rest of the step-by-step guide will work just fine, apart from things that rely on git -- but this mainly concerns the section on successive builds of other versions.}(hjUhjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM:hjhhubh)}(hZ[:ref:`back to step-by-step guide `] [:ref:`back to section intro `]h](h[}(hjhjahhhNhNubh)}(h/:ref:`back to step-by-step guide `h]j)}(hjkh]hback to step-by-step guide}(hhhjmhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjiubah}(h]h ]h"]h$]h&]refdocj refdomainjwreftyperef refexplicitrefwarnj sources_sbsuh1hhhhMAhjaubh] [}(h] [hjahhhNhNubh)}(h&:ref:`back to section intro `h]j)}(hjh]hback to section intro}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsourcesuh1hhhhMAhjaubh]}(hj hjahhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMAhjhhubj)}(h.. _sources_full:h]h}(h]h ]h"]h$]h&]j sources-fulluh1jhMChjhhhhubeh}(h](0downloading-the-sources-using-a-packages-archivejeh ]h"](0downloading the sources using a packages archivesources_archiveeh$]h&]uh1hhjRhhhhhM'j&}jjsj(}jjsubh)}(hhh](h)}(h.Downloading the sources using a full git cloneh]h.Downloading the sources using a full git clone}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMFubh)}(hXIf downloading and storing a lot of data (~4,4 Gigabyte as of early 2023) is nothing that bothers you, instead of a shallow clone perform a full git clone instead. You then will avoid the specialties mentioned above and will have all versions and individual commits at hand at any time::h]hXIf downloading and storing a lot of data (~4,4 Gigabyte as of early 2023) is nothing that bothers you, instead of a shallow clone perform a full git clone instead. You then will avoid the specialties mentioned above and will have all versions and individual commits at hand at any time:}(hXIf downloading and storing a lot of data (~4,4 Gigabyte as of early 2023) is nothing that bothers you, instead of a shallow clone perform a full git clone instead. You then will avoid the specialties mentioned above and will have all versions and individual commits at hand at any time:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMHhjhhubj!)}(hX^curl -L \ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/clone.bundle \ -o linux-stable.git.bundle git clone linux-stable.git.bundle ~/linux/ rm linux-stable.git.bundle cd ~/linux/ git remote set-url origin \ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git git fetch origin git checkout --detach origin/masterh]hX^curl -L \ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/clone.bundle \ -o linux-stable.git.bundle git clone linux-stable.git.bundle ~/linux/ rm linux-stable.git.bundle cd ~/linux/ git remote set-url origin \ https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git git fetch origin git checkout --detach origin/master}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhMMhjhhubh)}(hZ[:ref:`back to step-by-step guide `] [:ref:`back to section intro `]h](h[}(hjhjhhhNhNubh)}(h/:ref:`back to step-by-step guide `h]j)}(hjh]hback to step-by-step guide}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sources_sbsuh1hhhhMXhjubh] [}(h] [hjhhhNhNubh)}(h&:ref:`back to section intro `h]j)}(hj+h]hback to section intro}(hhhj-hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj)ubah}(h]h ]h"]h$]h&]refdocj refdomainj7reftyperef refexplicitrefwarnjsourcesuh1hhhhMXhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMXhjhhubj)}(h.. _sources_snapshot:h]h}(h]h ]h"]h$]h&]jsources-snapshotuh1jhMZhjhhhhubeh}(h](.downloading-the-sources-using-a-full-git-clonejeh ]h"](.downloading the sources using a full git clone sources_fulleh$]h&]uh1hhjRhhhhhMFj&}jdjsj(}jjsubh)}(hhh](h)}(h-Proper pre-releases (RCs) vs. latest mainlineh]h-Proper pre-releases (RCs) vs. latest mainline}(hjnhjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjihhhhhM]ubh)}(hXoWhen cloning the sources using git and checking out origin/master, you often will retrieve a codebase that is somewhere between the latest and the next release or pre-release. This almost always is the code you want when giving mainline a shot: pre-releases like v6.1-rc5 are in no way special, as they do not get any significant extra testing before being published.h]hXoWhen cloning the sources using git and checking out origin/master, you often will retrieve a codebase that is somewhere between the latest and the next release or pre-release. This almost always is the code you want when giving mainline a shot: pre-releases like v6.1-rc5 are in no way special, as they do not get any significant extra testing before being published.}(hj|hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM_hjihhubh)}(hX~There is one exception: you might want to stick to the latest mainline release (say v6.1) before its successor's first pre-release (v6.2-rc1) is out. That is because compiler errors and other problems are more likely to occur during this time, as mainline then is in its 'merge window': a usually two week long phase, in which the bulk of the changes for the next release is merged.h]hXThere is one exception: you might want to stick to the latest mainline release (say v6.1) before its successor’s first pre-release (v6.2-rc1) is out. That is because compiler errors and other problems are more likely to occur during this time, as mainline then is in its ‘merge window’: a usually two week long phase, in which the bulk of the changes for the next release is merged.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMehjihhubh)}(hZ[:ref:`back to step-by-step guide `] [:ref:`back to section intro `]h](h[}(hjhjhhhNhNubh)}(h/:ref:`back to step-by-step guide `h]j)}(hjh]hback to step-by-step guide}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj sources_sbsuh1hhhhMkhjubh] [}(h] [hjhhhNhNubh)}(h&:ref:`back to section intro `h]j)}(hjh]hback to section intro}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsourcesuh1hhhhMkhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMkhjihhubj)}(h.. _sources_fresher:h]h}(h]h ]h"]h$]h&]jsources-fresheruh1jhMmhjihhhhubeh}(h](*proper-pre-releases-rcs-vs-latest-mainlinej]eh ]h"](-proper pre-releases (rcs) vs. latest mainlinesources_snapshoteh$]h&]uh1hhjRhhhhhM]j&}jjSsj(}j]jSsubh)}(hhh](h)}(hAvoiding the mainline lagh]hAvoiding the mainline lag}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMpubh)}(hX The explanations for both the shallow clone and the full clone both retrieve the code from the Linux stable git repository. That makes things simpler for this document's audience, as it allows easy access to both mainline and stable/longterm releases. This approach has just one downside:h]hX"The explanations for both the shallow clone and the full clone both retrieve the code from the Linux stable git repository. That makes things simpler for this document’s audience, as it allows easy access to both mainline and stable/longterm releases. This approach has just one downside:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMrhjhhubh)}(hX<Changes merged into the mainline repository are only synced to the master branch of the Linux stable repository every few hours. This lag most of the time is not something to worry about; but in case you really need the latest code, just add the mainline repo as additional remote and checkout the code from there::h]hX;Changes merged into the mainline repository are only synced to the master branch of the Linux stable repository every few hours. This lag most of the time is not something to worry about; but in case you really need the latest code, just add the mainline repo as additional remote and checkout the code from there:}(hX;Changes merged into the mainline repository are only synced to the master branch of the Linux stable repository every few hours. This lag most of the time is not something to worry about; but in case you really need the latest code, just add the mainline repo as additional remote and checkout the code from there:hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMwhjhhubj!)}(hgit remote add mainline \ https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch mainline git checkout --detach mainline/masterh]hgit remote add mainline \ https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch mainline git checkout --detach mainline/master}(hhhj1ubah}(h]h ]h"]h$]h&]hhuh1j hhhM|hjhhubh)}(hWhen doing this with a shallow clone, remember to call ``git fetch`` with one of the parameters described earlier to limit the depth.h](h7When doing this with a shallow clone, remember to call }(h7When doing this with a shallow clone, remember to call hj?hhhNhNubjI)}(h ``git fetch``h]h git fetch}(hhhjHhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj?ubhA with one of the parameters described earlier to limit the depth.}(hA with one of the parameters described earlier to limit the depth.hj?hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hZ[:ref:`back to step-by-step guide `] [:ref:`back to section intro `]h](h[}(hjhjahhhNhNubh)}(h/:ref:`back to step-by-step guide `h]j)}(hjkh]hback to step-by-step guide}(hhhjmhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjiubah}(h]h ]h"]h$]h&]refdocj refdomainjwreftyperef refexplicitrefwarnj sources_sbsuh1hhhhMhjaubh] [}(h] [hjahhhNhNubh)}(h&:ref:`back to section intro `h]j)}(hjh]hback to section intro}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjsourcesuh1hhhhMhjaubh]}(hj hjahhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h .. _patching:h]h}(h]h ]h"]h$]h&]jpatchinguh1jhMhjhhhhubeh}(h](avoiding-the-mainline-lagjeh ]h"](avoiding the mainline lagsources_freshereh$]h&]uh1hhjRhhhhhMpj&}jjsj(}jjsubeh}(h](download-the-sourcesjFeh ]h"](download the sourcessourceseh$]h&]uh1hhj3 hhhhhMj&}jj<sj(}jFj<subh)}(hhh](h)}(hPatch the sources (optional)h]hPatch the sources (optional)}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubj)}(hhh]h)}(hQ*In case you want to apply a kernel patch, do so now.* [:ref:`...`]h](h)}(h6*In case you want to apply a kernel patch, do so now.*h]h4In case you want to apply a kernel patch, do so now.}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh [}(h [hjhhhNhNubh)}(h:ref:`...`h]j)}(hjh]h...}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj patching_sbsuh1hhhhMhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubh)}(hThis is the point where you might want to patch your kernel -- for example when a developer proposed a fix and asked you to check if it helps. The step-by-step guide already explains everything crucial here.h]hThis is the point where you might want to patch your kernel -- for example when a developer proposed a fix and asked you to check if it helps. The step-by-step guide already explains everything crucial here.}(hj6hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h2[:ref:`back to step-by-step guide `]h](h[}(hjhjBhhhNhNubh)}(h0:ref:`back to step-by-step guide `h]j)}(hjLh]hback to step-by-step guide}(hhhjNhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjJubah}(h]h ]h"]h$]h&]refdocj refdomainjXreftyperef refexplicitrefwarnj patching_sbsuh1hhhhMhjBubh]}(hj hjBhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h .. _tagging:h]h}(h]h ]h"]h$]h&]jtagginguh1jhMhjhhhhubeh}(h](patch-the-sources-optionaljeh ]h"](patch the sources (optional)patchingeh$]h&]uh1hhj3 hhhhhMj&}jjsj(}jjsubh)}(hhh](h)}(h0Tagging this kernel build (optional, often wise)h]h0Tagging this kernel build (optional, often wise)}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubj)}(hhh]h)}(h*If you patched your kernel or already have that kernel version installed, better tag your kernel by extending its release name:* [:ref:`...`]h](h)}(h*If you patched your kernel or already have that kernel version installed, better tag your kernel by extending its release name:*h]hIf you patched your kernel or already have that kernel version installed, better tag your kernel by extending its release name:}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh [}(h [hjhhhNhNubh)}(h:ref:`...`h]j)}(hjh]h...}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj tagging_sbsuh1hhhhMhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubh)}(hTagging your kernel will help avoid confusion later, especially when you patched your kernel. Adding an individual tag will also ensure the kernel's image and its modules are installed in parallel to any existing kernels.h]hTagging your kernel will help avoid confusion later, especially when you patched your kernel. Adding an individual tag will also ensure the kernel’s image and its modules are installed in parallel to any existing kernels.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXFThere are various ways to add such a tag. The step-by-step guide realizes one by creating a 'localversion' file in your build directory from which the kernel build scripts will automatically pick up the tag. You can later change that file to use a different tag in subsequent builds or simply remove that file to dump the tag.h]hXJThere are various ways to add such a tag. The step-by-step guide realizes one by creating a ‘localversion’ file in your build directory from which the kernel build scripts will automatically pick up the tag. You can later change that file to use a different tag in subsequent builds or simply remove that file to dump the tag.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h1[:ref:`back to step-by-step guide `]h](h[}(hjhjhhhNhNubh)}(h/:ref:`back to step-by-step guide `h]j)}(hj h]hback to step-by-step guide}(hhhj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj tagging_sbsuh1hhhhMhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h.. _configuration:h]h}(h]h ]h"]h$]h&]j configurationuh1jhMhjhhhhubeh}(h](-tagging-this-kernel-build-optional-often-wisej~eh ]h"](0tagging this kernel build (optional, often wise)taggingeh$]h&]uh1hhj3 hhhhhMj&}jDjtsj(}j~jtsubh)}(hhh](h)}(h.Define the build configuration for your kernelh]h.Define the build configuration for your kernel}(hjNhjLhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjIhhhhhMubj)}(hhh]h)}(hu*Create the build configuration for your kernel based on an existing configuration.* [:ref:`... `]h](h)}(hT*Create the build configuration for your kernel based on an existing configuration.*h]hRCreate the build configuration for your kernel based on an existing configuration.}(hhhjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhj]ubh [}(h [hj]hhhNhNubh)}(h:ref:`... `h]j)}(hjvh]h...}(hhhjxhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjtubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjconfiguration_sbsuh1hhhhMhj]ubh]}(hj hj]hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjZubah}(h]h ]h"]h$]h&]uh1jhjIhhhhhNubh)}(hQThere are various aspects for this steps that require a more careful explanation:h]hQThere are various aspects for this steps that require a more careful explanation:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjIhhubh)}(hhh](h)}(h6Pitfalls when using another configuration file as baseh]h6Pitfalls when using another configuration file as base}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hdMake targets like localmodconfig and olddefconfig share a few common snares you want to be aware of:h]hdMake targets like localmodconfig and olddefconfig share a few common snares you want to be aware of:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(hhh]j)}(hhh](j)}(hThese targets will reuse a kernel build configuration in your build directory (e.g. '~/linux/.config'), if one exists. In case you want to start from scratch you thus need to delete it. h]h)}(hThese targets will reuse a kernel build configuration in your build directory (e.g. '~/linux/.config'), if one exists. In case you want to start from scratch you thus need to delete it.h]hThese targets will reuse a kernel build configuration in your build directory (e.g. ‘~/linux/.config’), if one exists. In case you want to start from scratch you thus need to delete it.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hXzThe make targets try to find the configuration for your running kernel automatically, but might choose poorly. A line like '# using defaults found in /boot/config-6.0.7-250.fc36.x86_64' or 'using config: '/boot/config-6.0.7-250.fc36.x86_64' tells you which file they picked. If that is not the intended one, simply store it as '~/linux/.config' before using these make targets. h]h)}(hXyThe make targets try to find the configuration for your running kernel automatically, but might choose poorly. A line like '# using defaults found in /boot/config-6.0.7-250.fc36.x86_64' or 'using config: '/boot/config-6.0.7-250.fc36.x86_64' tells you which file they picked. If that is not the intended one, simply store it as '~/linux/.config' before using these make targets.h]hXThe make targets try to find the configuration for your running kernel automatically, but might choose poorly. A line like ‘# using defaults found in /boot/config-6.0.7-250.fc36.x86_64’ or ‘using config: ‘/boot/config-6.0.7-250.fc36.x86_64’ tells you which file they picked. If that is not the intended one, simply store it as ‘~/linux/.config’ before using these make targets.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hXUnexpected things might happen if you try to use a config file prepared for one kernel (say v6.0) on an older generation (say v5.15). In that case you might want to use a configuration as base which your distribution utilized when they used that or an slightly older kernel version. h]h)}(hXUnexpected things might happen if you try to use a config file prepared for one kernel (say v6.0) on an older generation (say v5.15). In that case you might want to use a configuration as base which your distribution utilized when they used that or an slightly older kernel version.h]hXUnexpected things might happen if you try to use a config file prepared for one kernel (say v6.0) on an older generation (say v5.15). In that case you might want to use a configuration as base which your distribution utilized when they used that or an slightly older kernel version.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhNhNubeh}(h]6pitfalls-when-using-another-configuration-file-as-baseah ]h"]6pitfalls when using another configuration file as baseah$]h&]uh1hhjIhhhhhMubh)}(hhh](h)}(hInfluencing the configurationh]hInfluencing the configuration}(hj8hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj3hhhhhMubh)}(hThe make target olddefconfig and the ``yes "" |`` used when utilizing localmodconfig will set any undefined build options to their default value. This among others will disable many kernel features that were introduced after your base kernel was released.h](h%The make target olddefconfig and the }(h%The make target olddefconfig and the hjDhhhNhNubjI)}(h ``yes "" |``h]hyes "" |}(hhhjMhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjDubh used when utilizing localmodconfig will set any undefined build options to their default value. This among others will disable many kernel features that were introduced after your base kernel was released.}(h used when utilizing localmodconfig will set any undefined build options to their default value. This among others will disable many kernel features that were introduced after your base kernel was released.hjDhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj3hhubh)}(hXDIf you want to set these configurations options manually, use ``oldconfig`` instead of ``olddefconfig`` or omit the ``yes "" |`` when utilizing localmodconfig. Then for each undefined configuration option you will be asked how to proceed. In case you are unsure what to answer, simply hit 'enter' to apply the default value.h](h>If you want to set these configurations options manually, use }(h>If you want to set these configurations options manually, use hjfhhhNhNubjI)}(h ``oldconfig``h]h oldconfig}(hhhjohhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjfubh instead of }(h instead of hjfhhhNhNubjI)}(h``olddefconfig``h]h olddefconfig}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjfubh or omit the }(h or omit the hjfhhhNhNubjI)}(h ``yes "" |``h]hyes "" |}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjfubh when utilizing localmodconfig. Then for each undefined configuration option you will be asked how to proceed. In case you are unsure what to answer, simply hit ‘enter’ to apply the default value.}(h when utilizing localmodconfig. Then for each undefined configuration option you will be asked how to proceed. In case you are unsure what to answer, simply hit 'enter' to apply the default value.hjfhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj3hhubeh}(h]influencing-the-configurationah ]h"]influencing the configurationah$]h&]uh1hhjIhhhhhMubh)}(hhh](h)}(h%Big pitfall when using localmodconfigh]h%Big pitfall when using localmodconfig}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hXAs explained briefly in the step-by-step guide already: with localmodconfig it can easily happen that your self-built kernel will lack modules for tasks you did not perform before utilizing this make target. That's because those tasks require kernel modules that are normally autoloaded when you perform that task for the first time; if you didn't perform that task at least once before using localmodonfig, the latter will thus assume these modules are superfluous and disable them.h]hXAs explained briefly in the step-by-step guide already: with localmodconfig it can easily happen that your self-built kernel will lack modules for tasks you did not perform before utilizing this make target. That’s because those tasks require kernel modules that are normally autoloaded when you perform that task for the first time; if you didn’t perform that task at least once before using localmodonfig, the latter will thus assume these modules are superfluous and disable them.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXYou can try to avoid this by performing typical tasks that often will autoload additional kernel modules: start a VM, establish VPN connections, loop-mount a CD/DVD ISO, mount network shares (CIFS, NFS, ...), and connect all external devices (2FA keys, headsets, webcams, ...) as well as storage devices with file systems you otherwise do not utilize (btrfs, ext4, FAT, NTFS, XFS, ...). But it is hard to think of everything that might be needed -- even kernel developers often forget one thing or another at this point.h]hXYou can try to avoid this by performing typical tasks that often will autoload additional kernel modules: start a VM, establish VPN connections, loop-mount a CD/DVD ISO, mount network shares (CIFS, NFS, ...), and connect all external devices (2FA keys, headsets, webcams, ...) as well as storage devices with file systems you otherwise do not utilize (btrfs, ext4, FAT, NTFS, XFS, ...). But it is hard to think of everything that might be needed -- even kernel developers often forget one thing or another at this point.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXDo not let that risk bother you, especially when compiling a kernel only for testing purposes: everything typically crucial will be there. And if you forget something important you can turn on a missing feature later and quickly run the commands to compile and install a better kernel.h]hXDo not let that risk bother you, especially when compiling a kernel only for testing purposes: everything typically crucial will be there. And if you forget something important you can turn on a missing feature later and quickly run the commands to compile and install a better kernel.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hXuBut if you plan to build and use self-built kernels regularly, you might want to reduce the risk by recording which modules your system loads over the course of a few weeks. You can automate this with `modprobed-db `_. Afterwards use ``LSMOD=`` to point localmodconfig to the list of modules modprobed-db noticed being used::h](hBut if you plan to build and use self-built kernels regularly, you might want to reduce the risk by recording which modules your system loads over the course of a few weeks. You can automate this with }(hBut if you plan to build and use self-built kernels regularly, you might want to reduce the risk by recording which modules your system loads over the course of a few weeks. You can automate this with hjhhhNhNubj )}(h:`modprobed-db `_h]h modprobed-db}(h modprobed-dbhjhhhNhNubah}(h]h ]h"]h$]h&]namejrefuri(https://github.com/graysky2/modprobed-dbuh1j hjubj)}(h+ h]h}(h] modprobed-dbah ]h"] modprobed-dbah$]h&]refurij uh1j referencedKhjubh. Afterwards use }(h. Afterwards use hjhhhNhNubjI)}(h``LSMOD=``h]h LSMOD=}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubhP to point localmodconfig to the list of modules modprobed-db noticed being used:}(hP to point localmodconfig to the list of modules modprobed-db noticed being used:hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj!)}(hAyes "" | make LSMOD="${HOME}"/.config/modprobed.db localmodconfigh]hAyes "" | make LSMOD="${HOME}"/.config/modprobed.db localmodconfig}(hhhj8ubah}(h]h ]h"]h$]h&]hhuh1j hhhMhjhhubeh}(h]%big-pitfall-when-using-localmodconfigah ]h"]%big pitfall when using localmodconfigah$]h&]uh1hhjIhhhhhMubh)}(hhh](h)}(h#Remote building with localmodconfigh]h#Remote building with localmodconfig}(hjShjQhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjNhhhhhMubh)}(hXIf you want to use localmodconfig to build a kernel for another machine, run ``lsmod > lsmod_foo-machine`` on it and transfer that file to your build host. Now point the build scripts to the file like this: ``yes "" | make LSMOD=~/lsmod_foo-machine localmodconfig``. Note, in this case you likely want to copy a base kernel configuration from the other machine over as well and place it as .config in your build directory.h](hMIf you want to use localmodconfig to build a kernel for another machine, run }(hMIf you want to use localmodconfig to build a kernel for another machine, run hj_hhhNhNubjI)}(h``lsmod > lsmod_foo-machine``h]hlsmod > lsmod_foo-machine}(hhhjhhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj_ubhe on it and transfer that file to your build host. Now point the build scripts to the file like this: }(he on it and transfer that file to your build host. Now point the build scripts to the file like this: hj_hhhNhNubjI)}(h:``yes "" | make LSMOD=~/lsmod_foo-machine localmodconfig``h]h6yes "" | make LSMOD=~/lsmod_foo-machine localmodconfig}(hhhj{hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj_ubh. Note, in this case you likely want to copy a base kernel configuration from the other machine over as well and place it as .config in your build directory.}(h. Note, in this case you likely want to copy a base kernel configuration from the other machine over as well and place it as .config in your build directory.hj_hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjNhhubh)}(h7[:ref:`back to step-by-step guide `]h](h[}(hjhjhhhNhNubh)}(h5:ref:`back to step-by-step guide `h]j)}(hjh]hback to step-by-step guide}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjconfiguration_sbsuh1hhhhMhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjNhhubj)}(h.. _configmods:h]h}(h]h ]h"]h$]h&]j configmodsuh1jhMhjNhhhhubeh}(h]#remote-building-with-localmodconfigah ]h"]#remote building with localmodconfigah$]h&]uh1hhjIhhhhhMubeh}(h](.define-the-build-configuration-for-your-kernelj=eh ]h"](.define the build configuration for your kernel configurationeh$]h&]uh1hhj3 hhhhhMj&}jj3sj(}j=j3subh)}(hhh](h)}(hAdjust build configurationh]hAdjust build configuration}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubj)}(hhh]h)}(hQ*Check if you might want to or have to adjust some kernel configuration options:*h]h)}(hjh]hOCheck if you might want to or have to adjust some kernel configuration options:}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]uh1hhhhM hjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubh)}(hiDepending on your needs you at this point might want or have to adjust some kernel configuration options.h]hiDepending on your needs you at this point might want or have to adjust some kernel configuration options.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjhhubj)}(h.. _configmods_debugsymbols:h]h}(h]h ]h"]h$]h&]jconfigmods-debugsymbolsuh1jhMhjhhhhubh)}(hhh](h)}(h Debug symbolsh]h Debug symbols}(hj3hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj.hhhhhMubj)}(hhh]h)}(hM*Evaluate how you want to handle debug symbols.* [:ref:`...`]h](h)}(h0*Evaluate how you want to handle debug symbols.*h]h.Evaluate how you want to handle debug symbols.}(hhhjFhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjBubh [}(h [hjBhhhNhNubh)}(h:ref:`...`h]j)}(hj[h]h...}(hhhj]hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjYubah}(h]h ]h"]h$]h&]refdocj refdomainjgreftyperef refexplicitrefwarnjconfigmods_sbsuh1hhhhMhjBubh]}(hj hjBhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj?ubah}(h]h ]h"]h$]h&]uh1jhj.hhhhhNubh)}(hMost users do not need to care about this, it's often fine to leave everything as it is; but you should take a closer look at this, if you might need to decode a stack trace or want to reduce space consumption.h]hMost users do not need to care about this, it’s often fine to leave everything as it is; but you should take a closer look at this, if you might need to decode a stack trace or want to reduce space consumption.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj.hhubh)}(hXXHaving debug symbols available can be important when your kernel throws a 'panic', 'Oops', 'warning', or 'BUG' later when running, as then you will be able to find the exact place where the problem occurred in the code. But collecting and embedding the needed debug information takes time and consumes quite a bit of space: in late 2022 the build artifacts for a typical x86 kernel configured with localmodconfig consumed around 5 Gigabyte of space with debug symbols, but less than 1 when they were disabled. The resulting kernel image and the modules are bigger as well, which increases load times.h]hXhHaving debug symbols available can be important when your kernel throws a ‘panic’, ‘Oops’, ‘warning’, or ‘BUG’ later when running, as then you will be able to find the exact place where the problem occurred in the code. But collecting and embedding the needed debug information takes time and consumes quite a bit of space: in late 2022 the build artifacts for a typical x86 kernel configured with localmodconfig consumed around 5 Gigabyte of space with debug symbols, but less than 1 when they were disabled. The resulting kernel image and the modules are bigger as well, which increases load times.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj.hhubh)}(hHence, if you want a small kernel and are unlikely to decode a stack trace later, you might want to disable debug symbols to avoid above downsides::h]hHence, if you want a small kernel and are unlikely to decode a stack trace later, you might want to disable debug symbols to avoid above downsides:}(hHence, if you want a small kernel and are unlikely to decode a stack trace later, you might want to disable debug symbols to avoid above downsides:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM$hj.hhubj!)}(h./scripts/config --file .config -d DEBUG_INFO \ -d DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT -d DEBUG_INFO_DWARF4 \ -d DEBUG_INFO_DWARF5 -e CONFIG_DEBUG_INFO_NONE make olddefconfigh]h./scripts/config --file .config -d DEBUG_INFO \ -d DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT -d DEBUG_INFO_DWARF4 \ -d DEBUG_INFO_DWARF5 -e CONFIG_DEBUG_INFO_NONE make olddefconfig}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhM'hj.hhubh)}(hYou on the other hand definitely want to enable them, if there is a decent chance that you need to decode a stack trace later (as explained by 'Decode failure messages' in Documentation/admin-guide/tainted-kernels.rst in more detail)::h]hYou on the other hand definitely want to enable them, if there is a decent chance that you need to decode a stack trace later (as explained by ‘Decode failure messages’ in Documentation/admin-guide/tainted-kernels.rst in more detail):}(hYou on the other hand definitely want to enable them, if there is a decent chance that you need to decode a stack trace later (as explained by 'Decode failure messages' in Documentation/admin-guide/tainted-kernels.rst in more detail):hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM,hj.hhubj!)}(h./scripts/config --file .config -d DEBUG_INFO_NONE -e DEBUG_KERNEL -e DEBUG_INFO -e DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT -e KALLSYMS -e KALLSYMS_ALL make olddefconfigh]h./scripts/config --file .config -d DEBUG_INFO_NONE -e DEBUG_KERNEL -e DEBUG_INFO -e DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT -e KALLSYMS -e KALLSYMS_ALL make olddefconfig}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhM1hj.hhubh)}(hNote, many mainstream distributions enable debug symbols in their kernel configurations -- make targets like localmodconfig and olddefconfig thus will often pick that setting up.h]hNote, many mainstream distributions enable debug symbols in their kernel configurations -- make targets like localmodconfig and olddefconfig thus will often pick that setting up.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM5hj.hhubh)}(h4[:ref:`back to step-by-step guide `]h](h[}(hjhjhhhNhNubh)}(h2:ref:`back to step-by-step guide `h]j)}(hjh]hback to step-by-step guide}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjconfigmods_sbsuh1hhhhM9hjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM9hj.hhubj)}(h.. _configmods_distros:h]h}(h]h ]h"]h$]h&]jconfigmods-distrosuh1jhM;hj.hhhhubeh}(h]( debug-symbolsj-eh ]h"]( debug symbolsconfigmods_debugsymbolseh$]h&]uh1hhjhhhhhMj&}j0j#sj(}j-j#subh)}(hhh](h)}(hDistro specific adjustmentsh]hDistro specific adjustments}(hj:hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj5hhhhhM>ubj)}(hhh]h)}(h/*Are you running* [:ref:`... `]h](h)}(h*Are you running*h]hAre you running}(hhhjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjIubh [}(h [hjIhhhNhNubh)}(h:ref:`... `h]j)}(hjbh]h...}(hhhjdhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj`ubah}(h]h ]h"]h$]h&]refdocj refdomainjnreftyperef refexplicitrefwarnjconfigmods_sbsuh1hhhhM@hjIubh]}(hj hjIhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM@hjFubah}(h]h ]h"]h$]h&]uh1jhj5hhhhhNubh)}(hThe following sections help you to avoid build problems that are known to occur when following this guide on a few commodity distributions.h]hThe following sections help you to avoid build problems that are known to occur when following this guide on a few commodity distributions.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMBhj5hhubh)}(h **Debian:**h]hstrong)}(hjh]hDebian:}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhMEhj5hhubj)}(hhh]j)}(hhh]j)}(hXRemove a stale reference to a certificate file that would cause your build to fail:: ./scripts/config --file .config --set-str SYSTEM_TRUSTED_KEYS '' Alternatively, download the needed certificate and make that configuration option point to it, as `the Debian handbook explains in more detail `_ -- or generate your own, as explained in Documentation/admin-guide/module-signing.rst. h](h)}(hTRemove a stale reference to a certificate file that would cause your build to fail::h]hSRemove a stale reference to a certificate file that would cause your build to fail:}(hSRemove a stale reference to a certificate file that would cause your build to fail:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMGhjubj!)}(h@./scripts/config --file .config --set-str SYSTEM_TRUSTED_KEYS ''h]h@./scripts/config --file .config --set-str SYSTEM_TRUSTED_KEYS ''}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhMJhjubh)}(hX1Alternatively, download the needed certificate and make that configuration option point to it, as `the Debian handbook explains in more detail `_ -- or generate your own, as explained in Documentation/admin-guide/module-signing.rst.h](hbAlternatively, download the needed certificate and make that configuration option point to it, as }(hbAlternatively, download the needed certificate and make that configuration option point to it, as hjhhhNhNubj )}(hx`the Debian handbook explains in more detail `_h]h+the Debian handbook explains in more detail}(h+the Debian handbook explains in more detailhjhhhNhNubah}(h]h ]h"]h$]h&]name+the Debian handbook explains in more detailj Ghttps://debian-handbook.info/browse/stable/sect.kernel-compilation.htmluh1j hjubj)}(hJ h]h}(h]+the-debian-handbook-explains-in-more-detailah ]h"]+the debian handbook explains in more detailah$]h&]refurijuh1jjKhjubhW -- or generate your own, as explained in Documentation/admin-guide/module-signing.rst.}(hW -- or generate your own, as explained in Documentation/admin-guide/module-signing.rst.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMLhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]jjuh1jhhhMGhjubah}(h]h ]h"]h$]h&]uh1jhj5hhhNhNubh)}(h4[:ref:`back to step-by-step guide `]h](h[}(hjhj#hhhNhNubh)}(h2:ref:`back to step-by-step guide `h]j)}(hj-h]hback to step-by-step guide}(hhhj/hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj+ubah}(h]h ]h"]h$]h&]refdocj refdomainj9reftyperef refexplicitrefwarnjconfigmods_sbsuh1hhhhMRhj#ubh]}(hj hj#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMRhj5hhubj)}(h.. _configmods_individual:h]h}(h]h ]h"]h$]h&]jconfigmods-individualuh1jhMThj5hhhhubeh}(h](distro-specific-adjustmentsj)eh ]h"](distro specific adjustmentsconfigmods_distroseh$]h&]uh1hhjhhhhhM>j&}jfjsj(}j)jsubh)}(hhh](h)}(hIndividual adjustmentsh]hIndividual adjustments}(hjphjnhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjkhhhhhMWubj)}(hhh]h)}(hj*If you want to influence the other aspects of the configuration, do so now* [:ref:`... `]h](h)}(hL*If you want to influence the other aspects of the configuration, do so now*h]hJIf you want to influence the other aspects of the configuration, do so now}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubh [}(h [hjhhhNhNubh)}(h:ref:`... `h]j)}(hjh]h...}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnjconfigmods_sbsuh1hhhhMYhjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMYhj|ubah}(h]h ]h"]h$]h&]uh1jhjkhhhhhNubh)}(hXYou at this point can use a command like ``make menuconfig`` to enable or disable certain features using a text-based user interface; to use a graphical configuration utilize, use the make target ``xconfig`` or ``gconfig`` instead. All of them require development libraries from toolkits they are based on (ncurses, Qt5, Gtk2); an error message will tell you if something required is missing.h](h)You at this point can use a command like }(h)You at this point can use a command like hjhhhNhNubjI)}(h``make menuconfig``h]hmake menuconfig}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh to enable or disable certain features using a text-based user interface; to use a graphical configuration utilize, use the make target }(h to enable or disable certain features using a text-based user interface; to use a graphical configuration utilize, use the make target hjhhhNhNubjI)}(h ``xconfig``h]hxconfig}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh or }(h or hjhhhNhNubjI)}(h ``gconfig``h]hgconfig}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh instead. All of them require development libraries from toolkits they are based on (ncurses, Qt5, Gtk2); an error message will tell you if something required is missing.}(h instead. All of them require development libraries from toolkits they are based on (ncurses, Qt5, Gtk2); an error message will tell you if something required is missing.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM\hjkhhubh)}(h4[:ref:`back to step-by-step guide `]h](h[}(hjhjhhhNhNubh)}(h2:ref:`back to step-by-step guide `h]j)}(hjh]hback to step-by-step guide}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainj$reftyperef refexplicitrefwarnjconfigmods_sbsuh1hhhhMchjubh]}(hj hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMchjkhhubj)}(h .. _build:h]h}(h]h ]h"]h$]h&]jbuilduh1jhMehjkhhhhubeh}(h](individual-adjustmentsj_eh ]h"](individual adjustmentsconfigmods_individualeh$]h&]uh1hhjhhhhhMWj&}jQjUsj(}j_jUsubeh}(h](adjust-build-configurationjeh ]h"](adjust build configuration configmodseh$]h&]uh1hhj3 hhhhhMj&}j\jsj(}jjsubh)}(hhh](h)}(hBuild your kernelh]hBuild your kernel}(hjfhjdhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjahhhhhMhubj)}(hhh]h)}(hI*Build the image and the modules of your kernel* [:ref:`... `]h](h)}(h0*Build the image and the modules of your kernel*h]h.Build the image and the modules of your kernel}(hhhjyhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjuubh [}(h [hjuhhhNhNubh)}(h:ref:`... `h]j)}(hjh]h...}(hhhjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftyperef refexplicitrefwarnj build_sbsuh1hhhhMjhjuubh]}(hj hjuhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMjhjrubah}(h]h ]h"]h$]h&]uh1jhjahhhhhNubh)}(hA lot can go wrong at this stage, but the instructions below will help you help yourself. Another subsection explains how to directly package your kernel up as deb, rpm or tar file.h]hA lot can go wrong at this stage, but the instructions below will help you help yourself. Another subsection explains how to directly package your kernel up as deb, rpm or tar file.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMlhjahhubh)}(hhh](h)}(hDealing with build errorsh]hDealing with build errors}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMqubh)}(hXWhen a build error occurs, it might be caused by some aspect of your machine's setup that often can be fixed quickly; other times though the problem lies in the code and can only be fixed by a developer. A close examination of the failure messages coupled with some research on the internet will often tell you which of the two it is. To perform such a investigation, restart the build process like this::h]hXWhen a build error occurs, it might be caused by some aspect of your machine’s setup that often can be fixed quickly; other times though the problem lies in the code and can only be fixed by a developer. A close examination of the failure messages coupled with some research on the internet will often tell you which of the two it is. To perform such a investigation, restart the build process like this:}(hXWhen a build error occurs, it might be caused by some aspect of your machine's setup that often can be fixed quickly; other times though the problem lies in the code and can only be fixed by a developer. A close examination of the failure messages coupled with some research on the internet will often tell you which of the two it is. To perform such a investigation, restart the build process like this:hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMshjhhubj!)}(hmake V=1h]hmake V=1}(hhhjubah}(h]h ]h"]h$]h&]hhuh1j hhhMzhjhhubh)}(hX,The ``V=1`` activates verbose output, which might be needed to see the actual error. To make it easier to spot, this command also omits the ``-j $(nproc --all)`` used earlier to utilize every CPU core in the system for the job -- but this parallelism also results in some clutter when failures occur.h](hThe }(hThe hjhhhNhNubjI)}(h``V=1``h]hV=1}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh activates verbose output, which might be needed to see the actual error. To make it easier to spot, this command also omits the }(h activates verbose output, which might be needed to see the actual error. To make it easier to spot, this command also omits the hjhhhNhNubjI)}(h``-j $(nproc --all)``h]h-j $(nproc --all)}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh used earlier to utilize every CPU core in the system for the job -- but this parallelism also results in some clutter when failures occur.}(h used earlier to utilize every CPU core in the system for the job -- but this parallelism also results in some clutter when failures occur.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM|hjhhubh)}(hXAfter a few seconds the build process should run into the error again. Now try to find the most crucial line describing the problem. Then search the internet for the most important and non-generic section of that line (say 4 to 8 words); avoid or remove anything that looks remotely system-specific, like your username or local path names like ``/home/username/linux/``. First try your regular internet search engine with that string, afterwards search Linux kernel mailing lists via `lore.kernel.org/all/ `_.h](hXXAfter a few seconds the build process should run into the error again. Now try to find the most crucial line describing the problem. Then search the internet for the most important and non-generic section of that line (say 4 to 8 words); avoid or remove anything that looks remotely system-specific, like your username or local path names like }(hXXAfter a few seconds the build process should run into the error again. Now try to find the most crucial line describing the problem. Then search the internet for the most important and non-generic section of that line (say 4 to 8 words); avoid or remove anything that looks remotely system-specific, like your username or local path names like hj-hhhNhNubjI)}(h``/home/username/linux/``h]h/home/username/linux/}(hhhj6hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj-ubhs. First try your regular internet search engine with that string, afterwards search Linux kernel mailing lists via }(hs. First try your regular internet search engine with that string, afterwards search Linux kernel mailing lists via hj-hhhNhNubj )}(h6`lore.kernel.org/all/ `_h]hlore.kernel.org/all/}(hlore.kernel.org/all/hjIhhhNhNubah}(h]h ]h"]h$]h&]namejQj https://lore.kernel.org/all/uh1j hj-ubj)}(h h]h}(h]lore-kernel-org-allah ]h"]lore.kernel.org/all/ah$]h&]refurijYuh1jjKhj-ubh.}(hj\hj-hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hX;This most of the time will find something that will explain what is wrong; quite often one of the hits will provide a solution for your problem, too. If you do not find anything that matches your problem, try again from a different angle by modifying your search terms or using another line from the error messages.h]hX;This most of the time will find something that will explain what is wrong; quite often one of the hits will provide a solution for your problem, too. If you do not find anything that matches your problem, try again from a different angle by modifying your search terms or using another line from the error messages.}(hjshjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hX%In the end, most trouble you are to run into has likely been encountered and reported by others already. That includes issues where the cause is not your system, but lies the code. If you run into one of those, you might thus find a solution (e.g. a patch) or workaround for your problem, too.h]hX%In the end, most trouble you are to run into has likely been encountered and reported by others already. That includes issues where the cause is not your system, but lies the code. If you run into one of those, you might thus find a solution (e.g. a patch) or workaround for your problem, too.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]dealing-with-build-errorsah ]h"]dealing with build errorsah$]h&]uh1hhjahhhhhMqubh)}(hhh](h)}(hPackage your kernel uph]hPackage your kernel up}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hX+The step-by-step guide uses the default make targets (e.g. 'bzImage' and 'modules' on x86) to build the image and the modules of your kernel, which later steps of the guide then install. You instead can also directly build everything and directly package it up by using one of the following targets:h]hX3The step-by-step guide uses the default make targets (e.g. ‘bzImage’ and ‘modules’ on x86) to build the image and the modules of your kernel, which later steps of the guide then install. You instead can also directly build everything and directly package it up by using one of the following targets:}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(hhh]j)}(hhh](j)}(h@``make -j $(nproc --all) bindeb-pkg`` to generate a deb package h]h)}(h?``make -j $(nproc --all) bindeb-pkg`` to generate a deb packageh](jI)}(h%``make -j $(nproc --all) bindeb-pkg``h]h!make -j $(nproc --all) bindeb-pkg}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh to generate a deb package}(h to generate a deb packagehjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(h@``make -j $(nproc --all) binrpm-pkg`` to generate a rpm package h]h)}(h?``make -j $(nproc --all) binrpm-pkg`` to generate a rpm packageh](jI)}(h%``make -j $(nproc --all) binrpm-pkg``h]h!make -j $(nproc --all) binrpm-pkg}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jHhjubh to generate a rpm package}(h to generate a rpm packagehjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hK``make -j $(nproc --all) tarbz2-pkg`` to generate a bz2 compressed tarball h]h)}(hJ``make -j $(nproc --all) tarbz2-pkg`` to generate a bz2 compressed tarballh](jI)}(h%``make -j $(nproc --all) tarbz2-pkg``h]h!make -j $(nproc --all) tarbz2-pkg}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj ubh% to generate a bz2 compressed tarball}(h% to generate a bz2 compressed tarballhj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]jjuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1jhjhhhNhNubh)}(hThis is just a selection of available make targets for this purpose, see ``make help`` for others. You can also use these targets after running ``make -j $(nproc --all)``, as they will pick up everything already built.h](hIThis is just a selection of available make targets for this purpose, see }(hIThis is just a selection of available make targets for this purpose, see hj; hhhNhNubjI)}(h ``make help``h]h make help}(hhhjD hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj; ubh: for others. You can also use these targets after running }(h: for others. You can also use these targets after running hj; hhhNhNubjI)}(h``make -j $(nproc --all)``h]hmake -j $(nproc --all)}(hhhjW hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj; ubh0, as they will pick up everything already built.}(h0, as they will pick up everything already built.hj; hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(hX/If you employ the targets to generate deb or rpm packages, ignore the step-by-step guide's instructions on installing and removing your kernel; instead install and remove the packages using the package utility for the format (e.g. dpkg and rpm) or a package management utility build on top of them (apt, aptitude, dnf/yum, zypper, ...). Be aware that the packages generated using these two make targets are designed to work on various distributions utilizing those formats, they thus will sometimes behave differently than your distribution's kernel packages.h]hX3If you employ the targets to generate deb or rpm packages, ignore the step-by-step guide’s instructions on installing and removing your kernel; instead install and remove the packages using the package utility for the format (e.g. dpkg and rpm) or a package management utility build on top of them (apt, aptitude, dnf/yum, zypper, ...). Be aware that the packages generated using these two make targets are designed to work on various distributions utilizing those formats, they thus will sometimes behave differently than your distribution’s kernel packages.}(hjr hjp hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h/[:ref:`back to step-by-step guide `]h](h[}(hjhj~ hhhNhNubh)}(h-:ref:`back to step-by-step guide `h]j)}(hj h]hback to step-by-step guide}(hhhj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainj reftyperef refexplicitrefwarnj build_sbsuh1hhhhMhj~ ubh]}(hj hj~ hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(h .. _install:h]h}(h]h ]h"]h$]h&]jinstalluh1jhMhjhhhhubeh}(h]package-your-kernel-upah ]h"]package your kernel upah$]h&]uh1hhjahhhhhMubeh}(h](build-your-kerneljJeh ]h"](build your kernelbuildeh$]h&]uh1hhj3 hhhhhMhj&}j j@sj(}jJj@subh)}(hhh](h)}(hInstall your kernelh]hInstall your kernel}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubj)}(hhh]h)}(h4*Now install your kernel* [:ref:`... `]h](h)}(h*Now install your kernel*h]hNow install your kernel}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj ubh [}(h [hj hhhNhNubh)}(h:ref:`... `h]j)}(hj h]h...}(hhhj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]refdocj refdomainj!reftyperef refexplicitrefwarnj install_sbsuh1hhhhMhj ubh]}(hj hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj hhhhhNubh)}(hXWhat you need to do after executing the command in the step-by-step guide depends on the existence and the implementation of an ``installkernel`` executable. Many commodity Linux distributions ship such a kernel installer in ``/sbin/`` that does everything needed, hence there is nothing left for you except rebooting. But some distributions contain an installkernel that does only part of the job -- and a few lack it completely and leave all the work to you.h](hWhat you need to do after executing the command in the step-by-step guide depends on the existence and the implementation of an }(hWhat you need to do after executing the command in the step-by-step guide depends on the existence and the implementation of an hj)!hhhNhNubjI)}(h``installkernel``h]h installkernel}(hhhj2!hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj)!ubhP executable. Many commodity Linux distributions ship such a kernel installer in }(hP executable. Many commodity Linux distributions ship such a kernel installer in hj)!hhhNhNubjI)}(h ``/sbin/``h]h/sbin/}(hhhjE!hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj)!ubh that does everything needed, hence there is nothing left for you except rebooting. But some distributions contain an installkernel that does only part of the job -- and a few lack it completely and leave all the work to you.}(h that does everything needed, hence there is nothing left for you except rebooting. But some distributions contain an installkernel that does only part of the job -- and a few lack it completely and leave all the work to you.hj)!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hXIf ``installkernel`` is found, the kernel's build system will delegate the actual installation of your kernel's image and related files to this executable. On almost all Linux distributions it will store the image as '/boot/vmlinuz- ' and put a 'System.map-' alongside it. Your kernel will thus be installed in parallel to any existing ones, unless you already have one with exactly the same release name.h](hIf }(hIf hj^!hhhNhNubjI)}(h``installkernel``h]h installkernel}(hhhjg!hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj^!ubhX is found, the kernel’s build system will delegate the actual installation of your kernel’s image and related files to this executable. On almost all Linux distributions it will store the image as ‘/boot/vmlinuz- ’ and put a ‘System.map-’ alongside it. Your kernel will thus be installed in parallel to any existing ones, unless you already have one with exactly the same release name.}(hX is found, the kernel's build system will delegate the actual installation of your kernel's image and related files to this executable. On almost all Linux distributions it will store the image as '/boot/vmlinuz- ' and put a 'System.map-' alongside it. Your kernel will thus be installed in parallel to any existing ones, unless you already have one with exactly the same release name.hj^!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hXInstallkernel on many distributions will afterwards generate an 'initramfs' (often also called 'initrd'), which commodity distributions rely on for booting; hence be sure to keep the order of the two make targets used in the step-by-step guide, as things will go sideways if you install your kernel's image before its modules. Often installkernel will then add your kernel to the bootloader configuration, too. You have to take care of one or both of these tasks yourself, if your distributions installkernel doesn't handle them.h]hXInstallkernel on many distributions will afterwards generate an ‘initramfs’ (often also called ‘initrd’), which commodity distributions rely on for booting; hence be sure to keep the order of the two make targets used in the step-by-step guide, as things will go sideways if you install your kernel’s image before its modules. Often installkernel will then add your kernel to the bootloader configuration, too. You have to take care of one or both of these tasks yourself, if your distributions installkernel doesn’t handle them.}(hj!hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hA few distributions like Arch Linux and its derivatives totally lack an installkernel executable. On those just install the modules using the kernel's build system and then install the image and the System.map file manually::h]hA few distributions like Arch Linux and its derivatives totally lack an installkernel executable. On those just install the modules using the kernel’s build system and then install the image and the System.map file manually:}(hA few distributions like Arch Linux and its derivatives totally lack an installkernel executable. On those just install the modules using the kernel's build system and then install the image and the System.map file manually:hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj!)}(hsudo make modules_install sudo install -m 0600 $(make -s image_name) /boot/vmlinuz-$(make -s kernelrelease) sudo install -m 0600 System.map /boot/System.map-$(make -s kernelrelease)h]hsudo make modules_install sudo install -m 0600 $(make -s image_name) /boot/vmlinuz-$(make -s kernelrelease) sudo install -m 0600 System.map /boot/System.map-$(make -s kernelrelease)}(hhhj!ubah}(h]h ]h"]h$]h&]hhuh1j hhhMhj hhubh)}(hIf your distribution boots with the help of an initramfs, now generate one for your kernel using the tools your distribution provides for this process. Afterwards add your kernel to your bootloader configuration and reboot.h]hIf your distribution boots with the help of an initramfs, now generate one for your kernel using the tools your distribution provides for this process. Afterwards add your kernel to your bootloader configuration and reboot.}(hj!hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(h1[:ref:`back to step-by-step guide `]h](h[}(hjhj!hhhNhNubh)}(h/:ref:`back to step-by-step guide `h]j)}(hj!h]hback to step-by-step guide}(hhhj!hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj!ubah}(h]h ]h"]h$]h&]refdocj refdomainj!reftyperef refexplicitrefwarnj install_sbsuh1hhhhMhj!ubh]}(hj hj!hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj)}(h .. _another:h]h}(h]h ]h"]h$]h&]janotheruh1jhMhj hhhhubeh}(h](install-your-kernelj eh ]h"](install your kernelinstalleh$]h&]uh1hhj3 hhhhhMj&}j!j sj(}j j subh)}(hhh](h)}(hAnother round laterh]hAnother round later}(hj"hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj"hhhhhMubj)}(hhh]h)}(hv*To later build another kernel you need similar, but sometimes slightly different commands* [:ref:`... `]h](h)}(h[*To later build another kernel you need similar, but sometimes slightly different commands*h]hYTo later build another kernel you need similar, but sometimes slightly different commands}(hhhj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj"ubh [}(h [hj"hhhNhNubh)}(h:ref:`... `h]j)}(hj."h]h...}(hhhj0"hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj,"ubah}(h]h ]h"]h$]h&]refdocj refdomainj:"reftyperef refexplicitrefwarnj another_sbsuh1hhhhMhj"ubh]}(hj hj"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"ubah}(h]h ]h"]h$]h&]uh1jhj"hhhhhNubh)}(hXThe process to build later kernels is similar, but at some points slightly different. You for example do not want to use 'localmodconfig' for succeeding kernel builds, as you already created a trimmed down configuration you want to use from now on. Hence instead just use ``oldconfig`` or ``olddefconfig`` to adjust your build configurations to the needs of the kernel version you are about to build.h](hXThe process to build later kernels is similar, but at some points slightly different. You for example do not want to use ‘localmodconfig’ for succeeding kernel builds, as you already created a trimmed down configuration you want to use from now on. Hence instead just use }(hXThe process to build later kernels is similar, but at some points slightly different. You for example do not want to use 'localmodconfig' for succeeding kernel builds, as you already created a trimmed down configuration you want to use from now on. Hence instead just use hj\"hhhNhNubjI)}(h ``oldconfig``h]h oldconfig}(hhhje"hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj\"ubh or }(h or hj\"hhhNhNubjI)}(h``olddefconfig``h]h olddefconfig}(hhhjx"hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj\"ubh_ to adjust your build configurations to the needs of the kernel version you are about to build.}(h_ to adjust your build configurations to the needs of the kernel version you are about to build.hj\"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"hhubh)}(hXIf you created a shallow-clone with git, remember what the :ref:`section that explained the setup described in more detail `: you need to use a slightly different ``git fetch`` command and when switching to another series need to add an additional remote branch.h](h;If you created a shallow-clone with git, remember what the }(h;If you created a shallow-clone with git, remember what the hj"hhhNhNubh)}(hJ:ref:`section that explained the setup described in more detail `h]j)}(hj"h]h9section that explained the setup described in more detail}(hhhj"hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj"ubah}(h]h ]h"]h$]h&]refdocj refdomainj"reftyperef refexplicitrefwarnjsourcesuh1hhhhMhj"ubh': you need to use a slightly different }(h': you need to use a slightly different hj"hhhNhNubjI)}(h ``git fetch``h]h git fetch}(hhhj"hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj"ubhV command and when switching to another series need to add an additional remote branch.}(hV command and when switching to another series need to add an additional remote branch.hj"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"hhubh)}(h1[:ref:`back to step-by-step guide `]h](h[}(hjhj"hhhNhNubh)}(h/:ref:`back to step-by-step guide `h]j)}(hj"h]hback to step-by-step guide}(hhhj"hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj"ubah}(h]h ]h"]h$]h&]refdocj refdomainj"reftyperef refexplicitrefwarnj another_sbsuh1hhhhMhj"ubh]}(hj hj"hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj"hhubj)}(h.. _uninstall:h]h}(h]h ]h"]h$]h&]j uninstalluh1jhMhj"hhhhubeh}(h](another-round-laterj!eh ]h"](another round lateranothereh$]h&]uh1hhj3 hhhhhMj&}j#j!sj(}j!j!subh)}(hhh](h)}(hUninstall the kernel laterh]hUninstall the kernel later}(hj%#hj##hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj #hhhhhMubj)}(hhh]h)}(h*All parts of your installed kernel are identifiable by its release name and thus easy to remove later.* [:ref:`... `]h](h)}(hh*All parts of your installed kernel are identifiable by its release name and thus easy to remove later.*h]hfAll parts of your installed kernel are identifiable by its release name and thus easy to remove later.}(hhhj8#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj4#ubh [}(h [hj4#hhhNhNubh)}(h:ref:`... `h]j)}(hjM#h]h...}(hhhjO#hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhjK#ubah}(h]h ]h"]h$]h&]refdocj refdomainjY#reftyperef refexplicitrefwarnj uninstall_sbsuh1hhhhMhj4#ubh]}(hj hj4#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj1#ubah}(h]h ]h"]h$]h&]uh1jhj #hhhhhNubh)}(hXDo not worry installing your kernel manually and thus bypassing your distribution's packaging system will totally mess up your machine: all parts of your kernel are easy to remove later, as files are stored in two places only and normally identifiable by the kernel's release name.h]hXDo not worry installing your kernel manually and thus bypassing your distribution’s packaging system will totally mess up your machine: all parts of your kernel are easy to remove later, as files are stored in two places only and normally identifiable by the kernel’s release name.}(hj}#hj{#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj #hhubh)}(hXOne of the two places is a directory in /lib/modules/, which holds the modules for each installed kernel. This directory is named after the kernel's release name; hence, to remove all modules for one of your kernels, simply remove its modules directory in /lib/modules/.h]hXOne of the two places is a directory in /lib/modules/, which holds the modules for each installed kernel. This directory is named after the kernel’s release name; hence, to remove all modules for one of your kernels, simply remove its modules directory in /lib/modules/.}(hj#hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj #hhubh)}(hXThe other place is /boot/, where typically one to five files will be placed during installation of a kernel. All of them usually contain the release name in their file name, but how many files and their name depends somewhat on your distribution's installkernel executable (:ref:`see above `) and its initramfs generator. On some distributions the ``kernel-install`` command mentioned in the step-by-step guide will remove all of these files for you -- and the entry for your kernel in the bootloader configuration at the same time, too. On others you have to take care of these steps yourself. The following command should interactively remove the two main files of a kernel with the release name '6.0.1-foobar'::h](hXThe other place is /boot/, where typically one to five files will be placed during installation of a kernel. All of them usually contain the release name in their file name, but how many files and their name depends somewhat on your distribution’s installkernel executable (}(hXThe other place is /boot/, where typically one to five files will be placed during installation of a kernel. All of them usually contain the release name in their file name, but how many files and their name depends somewhat on your distribution's installkernel executable (hj#hhhNhNubh)}(h:ref:`see above `h]j)}(hj#h]h see above}(hhhj#hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj#ubah}(h]h ]h"]h$]h&]refdocj refdomainj#reftyperef refexplicitrefwarnjinstalluh1hhhhMhj#ubh9) and its initramfs generator. On some distributions the }(h9) and its initramfs generator. On some distributions the hj#hhhNhNubjI)}(h``kernel-install``h]hkernel-install}(hhhj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj#ubhX_ command mentioned in the step-by-step guide will remove all of these files for you -- and the entry for your kernel in the bootloader configuration at the same time, too. On others you have to take care of these steps yourself. The following command should interactively remove the two main files of a kernel with the release name ‘6.0.1-foobar’:}(hX[ command mentioned in the step-by-step guide will remove all of these files for you -- and the entry for your kernel in the bootloader configuration at the same time, too. On others you have to take care of these steps yourself. The following command should interactively remove the two main files of a kernel with the release name '6.0.1-foobar':hj#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj #hhubj!)}(h-rm -i /boot/{System.map,vmlinuz}-6.0.1-foobarh]h-rm -i /boot/{System.map,vmlinuz}-6.0.1-foobar}(hhhj#ubah}(h]h ]h"]h$]h&]hhuh1j hhhMhj #hhubh)}(hX?Now remove the belonging initramfs, which often will be called something like ``/boot/initramfs-6.0.1-foobar.img`` or ``/boot/initrd.img-6.0.1-foobar``. Afterwards check for other files in /boot/ that have '6.0.1-foobar' in their name and delete them as well. Now remove the kernel from your bootloader's configuration.h](hNNow remove the belonging initramfs, which often will be called something like }(hNNow remove the belonging initramfs, which often will be called something like hj#hhhNhNubjI)}(h$``/boot/initramfs-6.0.1-foobar.img``h]h /boot/initramfs-6.0.1-foobar.img}(hhhj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj#ubh or }(h or hj#hhhNhNubjI)}(h!``/boot/initrd.img-6.0.1-foobar``h]h/boot/initrd.img-6.0.1-foobar}(hhhj$hhhNhNubah}(h]h ]h"]h$]h&]uh1jHhj#ubh. Afterwards check for other files in /boot/ that have ‘6.0.1-foobar’ in their name and delete them as well. Now remove the kernel from your bootloader’s configuration.}(h. Afterwards check for other files in /boot/ that have '6.0.1-foobar' in their name and delete them as well. Now remove the kernel from your bootloader's configuration.hj#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj #hhubh)}(hNote, be very careful with wildcards like '*' when deleting files or directories for kernels manually: you might accidentally remove files of a 6.0.11 kernel when all you want is to remove 6.0 or 6.0.1.h]hNote, be very careful with wildcards like ‘*’ when deleting files or directories for kernels manually: you might accidentally remove files of a 6.0.11 kernel when all you want is to remove 6.0 or 6.0.1.}(hNote, be very careful with wildcards like '*' when deleting files or directories for kernels manually: you might accidentally remove files of a 6.0.11 kernel when all you want is to remove 6.0 or 6.0.1.hj!$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj #hhubh)}(h3[:ref:`back to step-by-step guide `]h](h[}(hjhj0$hhhNhNubh)}(h1:ref:`back to step-by-step guide `h]j)}(hj:$h]hback to step-by-step guide}(hhhj<$hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj8$ubah}(h]h ]h"]h$]h&]refdocj refdomainjF$reftyperef refexplicitrefwarnj uninstall_sbsuh1hhhhMhj0$ubh]}(hj hj0$hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj #hhubJj)}(h.. _faq:h]h}(h]h ]h"]h$]h&]jfaquh1jhMhj #hhhhubeh}(h](uninstall-the-kernel-laterj#eh ]h"](uninstall the kernel later uninstalleh$]h&]uh1hhj3 hhhhhMj&}js$j #sj(}j#j #subeh}(h],reference-section-for-the-step-by-step-guideah ]h"],reference section for the step-by-step guideah$]h&]uh1hhhhhhhhMiubh)}(hhh](h)}(hFAQh]hFAQ}(hj$hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj$hhhhhM ubh)}(hhh](h)}(h-Why does this 'how-to' not work on my system?h]h1Why does this ‘how-to’ not work on my system?}(hj$hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj$hhhhhM#ubh)}(hX{As initially stated, this guide is 'designed to cover everything typically needed [to build a kernel] on mainstream Linux distributions running on commodity PC or server hardware'. The outlined approach despite this should work on many other setups as well. But trying to cover every possible use-case in one guide would defeat its purpose, as without such a focus you would need dozens or hundreds of constructs along the lines of 'in case you are having , you at this point have to do '. Each of which would make the text longer, more complicated, and harder to follow.h]hXAs initially stated, this guide is ‘designed to cover everything typically needed [to build a kernel] on mainstream Linux distributions running on commodity PC or server hardware’. The outlined approach despite this should work on many other setups as well. But trying to cover every possible use-case in one guide would defeat its purpose, as without such a focus you would need dozens or hundreds of constructs along the lines of ‘in case you are having , you at this point have to do ’. Each of which would make the text longer, more complicated, and harder to follow.}(hj$hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM%hj$hhubh)}(hThat being said: this of course is a balancing act. Hence, if you think an additional use-case is worth describing, suggest it to the maintainers of this document, as :ref:`described above `.h](hThat being said: this of course is a balancing act. Hence, if you think an additional use-case is worth describing, suggest it to the maintainers of this document, as }(hThat being said: this of course is a balancing act. Hence, if you think an additional use-case is worth describing, suggest it to the maintainers of this document, as hj$hhhNhNubh)}(h,:ref:`described above `h]j)}(hj$h]hdescribed above}(hhhj$hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1jhj$ubah}(h]h ]h"]h$]h&]refdocj refdomainj$reftyperef refexplicitrefwarnjsubmit_improvementsuh1hhhhM/hj$ubh.}(hj\hj$hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM/hj$hhubh)}(hend-of-contenth]hend-of-content}(hhhj$ubah}(h]h ]h"]h$]h&]hhuh1hhj$hhhhhM5ubh)}(hXThis document is maintained by Thorsten Leemhuis . If you spot a typo or small mistake, feel free to let him know directly and he'll fix it. You are free to do the same in a mostly informal way if you want to contribute changes to the text -- but for copyright reasons please CC linux-doc@vger.kernel.org and 'sign-off' your contribution as Documentation/process/submitting-patches.rst explains in the section 'Sign your work - the Developer's Certificate of Origin'.h]hXThis document is maintained by Thorsten Leemhuis . If you spot a typo or small mistake, feel free to let him know directly and he'll fix it. You are free to do the same in a mostly informal way if you want to contribute changes to the text -- but for copyright reasons please CC linux-doc@vger.kernel.org and 'sign-off' your contribution as Documentation/process/submitting-patches.rst explains in the section 'Sign your work - the Developer's Certificate of Origin'.}(hhhj$ubah}(h]h ]h"]h$]h&]hhuh1hhj$hhhhhM=ubh)}(hXvThis text is available under GPL-2.0+ or CC-BY-4.0, as stated at the top of the file. If you want to distribute this text under CC-BY-4.0 only, please use 'The Linux kernel development community' for author attribution and link this as source: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/admin-guide/quickly-build-trimmed-linux.rsth]hXvThis text is available under GPL-2.0+ or CC-BY-4.0, as stated at the top of the file. If you want to distribute this text under CC-BY-4.0 only, please use 'The Linux kernel development community' for author attribution and link this as source: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/Documentation/admin-guide/quickly-build-trimmed-linux.rst}(hhhj$ubah}(h]h ]h"]h$]h&]hhuh1hhj$hhhhhMCubh)}(hXNote: Only the content of this RST file as found in the Linux kernel sources is available under CC-BY-4.0, as versions of this text that were processed (for example by the kernel's build system) might contain content taken from files which use a more restrictive license.h]hXNote: Only the content of this RST file as found in the Linux kernel sources is available under CC-BY-4.0, as versions of this text that were processed (for example by the kernel's build system) might contain content taken from files which use a more restrictive license.}(hhhj %ubah}(h]h ]h"]h$]h&]hhuh1hhj$hhhhhMIubeh}(h]*why-does-this-how-to-not-work-on-my-systemah ]h"]-why does this 'how-to' not work on my system?ah$]h&]uh1hhj$hhhhhM#ubeh}(h](jl$id1eh ]h"]faqah$]faqah&]uh1hhhhhhhhM jKj&}j(%jb$sj(}jl$jb$subeh}(h]+how-to-quickly-build-a-trimmed-linux-kernelah ]h"]+how to quickly build a trimmed linux kernelah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjY%error_encodingUTF-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confapep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacefile_insertion_enabled raw_enabledKline_length_limitM'syntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_link embed_imagesenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}(j]jaj4]j*aj]jaj]jaj]j~aj]jajL]jBaj]jaj]jaj]jaj: ]j0 aj ]j aj& ]j aj ]j aj\ ]jR aj ]j aj ]j aja]jWajF]j<aj]jaj]jaj]jaj]]jSaj]jaj]jaj~]jtaj=]j3aj]jaj-]j#aj)]jaj_]jUajJ]j@aj ]j aj!]j!aj#]j #ajl$]jb$aunameids}(j3%j0%jRjOj0 j- j#jjj4jjjyjjjj=jjjLjjjjj+ jj j: j j j j& j& j j}$jz$j j\ j j j j j j jhj jgjdjMjajLjIjjFjjjjjjjjjjjdjjcj`jj]jjjjjjjjjjjDj~jCj@jj=jjj0j-jjjKjHjjjjj\jj[jXj0j-j/j,jfj)jejbjjjQj_jPjMj jJj j jjjcj`j j j!j j!j!j#j!j#j#js$j#jr$jo$j(%jl$j %j%u nametypes}(j3%NjRNj0 Nj#jjjyjj=jjjj+ j j j j& j}$Nj j Nj j NjhjgNjMjLNjjNjjNjjNjdjcNjjNjjNjjNjDjCNjjNj0NjNjKNjjNj\j[Nj0j/NjfjeNjjQjPNj j NjNjcj Nj!j!Nj#j#Njs$jr$Nj(%j %Nuh}(j0%hjOhj- jUjjj4j5jjjjjjjjjLjMjjjjjjj: j; j j j& j' j j jz$j3 j\ j] j j] j j j j j j jdj jajmjIjmjFjRjjRjjjjjjjjjjj`jj]jijjijjjjjjjjj~jj@jj=jIjjIj-jjj3jHjjj jjNjjjXjj-j.j,j.j)j5jbj5jjj_jkjMjkjJjaj jajjj`jZj jj j j!j j!j"j#j"j#j #jo$j #jl$j$j%%j$j%j$u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}jg%KsRparse_messages]hsystem_message)}(hhh]h)}(h&Duplicate implicit target name: "faq".h]h*Duplicate implicit target name: “faq”.}(hhhj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj%ubah}(h]h ]h"]h$]h&]j%%alevelKtypeINFOsourcehlineM uh1j%hj$hhhhhM ubatransform_messages](j%)}(hhh]h)}(hhh]h0Hyperlink target "backup-sbs" is not referenced.}(hhhj&ubah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineKSuh1j%ubj%)}(hhh]h)}(hhh]h4Hyperlink target "secureboot-sbs" is not referenced.}(hhhj&ubah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineKZuh1j%ubj%)}(hhh]h)}(hhh]h7Hyperlink target "buildrequires-sbs" is not referenced.}(hhhj7&ubah}(h]h ]h"]h$]h&]uh1hhj4&ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineKeuh1j%ubj%)}(hhh]h)}(hhh]h3Hyperlink target "diskspace-sbs" is not referenced.}(hhhjQ&ubah}(h]h ]h"]h$]h&]uh1hhjN&ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineKouh1j%ubj%)}(hhh]h)}(hhh]h1Hyperlink target "sources-sbs" is not referenced.}(hhhjk&ubah}(h]h ]h"]h$]h&]uh1hhjh&ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineK{uh1j%ubj%)}(hhh]h)}(hhh]h2Hyperlink target "patching-sbs" is not referenced.}(hhhj&ubah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineKuh1j%ubj%)}(hhh]h)}(hhh]h1Hyperlink target "tagging-sbs" is not referenced.}(hhhj&ubah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineKuh1j%ubj%)}(hhh]h)}(hhh]h7Hyperlink target "configuration-sbs" is not referenced.}(hhhj&ubah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej%lineKČsourcehuh1j%ubj%)}(hhh]h)}(hhh]h4Hyperlink target "configmods-sbs" is not referenced.}(hhhj&ubah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineKuh1j%ubj%)}(hhh]h)}(hhh]h/Hyperlink target "build-sbs" is not referenced.}(hhhj&ubah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineKuh1j%ubj%)}(hhh]h)}(hhh]h1Hyperlink target "install-sbs" is not referenced.}(hhhj'ubah}(h]h ]h"]h$]h&]uh1hhj'ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h1Hyperlink target "another-sbs" is not referenced.}(hhhj!'ubah}(h]h ]h"]h$]h&]uh1hhj'ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h3Hyperlink target "uninstall-sbs" is not referenced.}(hhhj;'ubah}(h]h ]h"]h$]h&]uh1hhj8'ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMGuh1j%ubj%)}(hhh]h)}(hhh]h9Hyperlink target "submit-improvements" is not referenced.}(hhhjU'ubah}(h]h ]h"]h$]h&]uh1hhjR'ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineM^uh1j%ubj%)}(hhh]h)}(hhh]h,Hyperlink target "backup" is not referenced.}(hhhjo'ubah}(h]h ]h"]h$]h&]uh1hhjl'ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMnuh1j%ubj%)}(hhh]h)}(hhh]h0Hyperlink target "secureboot" is not referenced.}(hhhj'ubah}(h]h ]h"]h$]h&]uh1hhj'ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineM}uh1j%ubj%)}(hhh]h)}(hhh]h3Hyperlink target "buildrequires" is not referenced.}(hhhj'ubah}(h]h ]h"]h$]h&]uh1hhj'ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h/Hyperlink target "diskspace" is not referenced.}(hhhj'ubah}(h]h ]h"]h$]h&]uh1hhj'ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h-Hyperlink target "sources" is not referenced.}(hhhj'ubah}(h]h ]h"]h$]h&]uh1hhj'ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h5Hyperlink target "sources-shallow" is not referenced.}(hhhj'ubah}(h]h ]h"]h$]h&]uh1hhj'ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h5Hyperlink target "sources-archive" is not referenced.}(hhhj (ubah}(h]h ]h"]h$]h&]uh1hhj(ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineM$uh1j%ubj%)}(hhh]h)}(hhh]h2Hyperlink target "sources-full" is not referenced.}(hhhj%(ubah}(h]h ]h"]h$]h&]uh1hhj"(ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMCuh1j%ubj%)}(hhh]h)}(hhh]h6Hyperlink target "sources-snapshot" is not referenced.}(hhhj?(ubah}(h]h ]h"]h$]h&]uh1hhj<(ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMZuh1j%ubj%)}(hhh]h)}(hhh]h5Hyperlink target "sources-fresher" is not referenced.}(hhhjY(ubah}(h]h ]h"]h$]h&]uh1hhjV(ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMmuh1j%ubj%)}(hhh]h)}(hhh]h.Hyperlink target "patching" is not referenced.}(hhhjs(ubah}(h]h ]h"]h$]h&]uh1hhjp(ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h-Hyperlink target "tagging" is not referenced.}(hhhj(ubah}(h]h ]h"]h$]h&]uh1hhj(ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h3Hyperlink target "configuration" is not referenced.}(hhhj(ubah}(h]h ]h"]h$]h&]uh1hhj(ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h0Hyperlink target "configmods" is not referenced.}(hhhj(ubah}(h]h ]h"]h$]h&]uh1hhj(ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h=Hyperlink target "configmods-debugsymbols" is not referenced.}(hhhj(ubah}(h]h ]h"]h$]h&]uh1hhj(ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h8Hyperlink target "configmods-distros" is not referenced.}(hhhj(ubah}(h]h ]h"]h$]h&]uh1hhj(ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineM;uh1j%ubj%)}(hhh]h)}(hhh]h;Hyperlink target "configmods-individual" is not referenced.}(hhhj)ubah}(h]h ]h"]h$]h&]uh1hhj )ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMTuh1j%ubj%)}(hhh]h)}(hhh]h+Hyperlink target "build" is not referenced.}(hhhj))ubah}(h]h ]h"]h$]h&]uh1hhj&)ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMeuh1j%ubj%)}(hhh]h)}(hhh]h-Hyperlink target "install" is not referenced.}(hhhjC)ubah}(h]h ]h"]h$]h&]uh1hhj@)ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h-Hyperlink target "another" is not referenced.}(hhhj])ubah}(h]h ]h"]h$]h&]uh1hhjZ)ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h/Hyperlink target "uninstall" is not referenced.}(hhhjw)ubah}(h]h ]h"]h$]h&]uh1hhjt)ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ubj%)}(hhh]h)}(hhh]h)Hyperlink target "faq" is not referenced.}(hhhj)ubah}(h]h ]h"]h$]h&]uh1hhj)ubah}(h]h ]h"]h$]h&]levelKtypej%sourcehlineMuh1j%ube transformerN include_log] decorationNhhub.