<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://cache.forums.debian.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Morgwai</id>
	<title>Debian Forums Cache - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://cache.forums.debian.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Morgwai"/>
	<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=Special:Contributions/Morgwai"/>
	<updated>2026-10-27T14:33:37Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=335</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=335"/>
		<updated>2026-10-22T13:56:25Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: minor wording update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable Sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes Sid or experimental packages just a few days after a tag is created in kernel.org&#039;s stable repo and propagates them to &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; on a semi-regular basis. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last but not least, if it ain&#039;t broken, don&#039;t mess with it, especially in case of your main computer or production systems: the default kernel provided by Trixie works very well in most configurations and receives timely upgrades from the Security Team. You shouldn&#039;t change it unless you have a very clear reason (support for a very recent hardware is the most common example of a good reason: this is usually covered by kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Having mentioned the above disclaimers, building and replacing a kernel is also a very good exercise for users interested in learning the internals of a Debian OS. However like all exercises, it should be performed in a controlled, isolated environment: a [https://wiki.debian.org/libvirt virtual machine] or a spare computer behind a firewall or completely disconnected from the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.3~rcX and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Note: it is generally possible to instead also checkout from the kernel Salsa the tag corresponding to the desired &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release and then proceed almost identically as for building the latest mainline, but it&#039;s way less convenient.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version 7.0~rc7:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
  * Disable unused flavors and feature-sets.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version strings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; while it is technically possible to instead download a prepackaged tarball from kernel.org, using the above command is preferred as it automatically verifies signatures found in the git repo, decreasing the risk of supply-chain attacks. If you decide to download a prepackaged tarball, you should [https://www.kernel.org/category/signatures.html verify it manually] using the detached signature available on kernel.org at the corresponding &amp;lt;code&amp;gt;[pgp]&amp;lt;/code&amp;gt; link. Bear in mind also that the contents of a prepackaged tarball will be slightly different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Starting with 7.2, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;, so [https://backports.debian.org/Instructions/ add it to your apt sources] if you haven&#039;t done so before and then install the newer version:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install -t trixie-backports linux-base&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;br /&gt;
&lt;br /&gt;
This article was imported from [https://forums.debian.net/viewtopic.php?p=841583#p841583 the forum] using some [https://forums.debian.net/viewtopic.php?p=845208#p845208 lazy sed magic].&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=334</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=334"/>
		<updated>2026-10-17T23:01:20Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: improve the note on Sid/experimental vs backports packages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable Sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes Sid or experimental packages just a few days after a tag is created in kernel.org&#039;s stable repo and propagates them to &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; on a semi-regular basis. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last but not least, if it ain&#039;t broken, don&#039;t mess with it, especially in case of your main computer or production systems: the default kernel provided by Trixie works very well in most configurations and receives timely upgrades from the Security Team. You shouldn&#039;t change it unless you have a very clear reason (support for a very recent hardware is the most common example of a good reason: this is usually covered by kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Having mentioned the above disclaimers, building and replacing a kernel is also a very good exercise for users interested in learning the internals of a Debian OS. However like all exercises, it should be performed in a controlled, isolated environment: a [https://wiki.debian.org/libvirt virtual machine] or a spare computer behind a firewall or completely disconnected from the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.3~rcX and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Note: it is generally possible to instead also checkout from the kernel Salsa the tag corresponding to the desired &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release and then proceed almost identically as for building the latest mainline, but it&#039;s way less convenient.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version 7.0~rc7:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
  * Disable unused flavors and feature-sets.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version strings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; while it is technically possible to instead download a prepackaged tarball from kernel.org, using the above command is preferred as it automatically verifies signatures found in the git repo, decreasing the risk of supply-chain attacks. If you decide to download a prepackaged tarball, you should [https://www.kernel.org/category/signatures.html verify it manually] using the detached signature available on kernel.org at the corresponding &amp;lt;code&amp;gt;[pgp]&amp;lt;/code&amp;gt; link. Bear in mind also that the contents of a prepackaged tarball will be slightly different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Starting with 7.2, built packages pre-depend (!) on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;, so [https://backports.debian.org/Instructions/ add it to your apt sources] if you haven&#039;t done so before and then install the newer version:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install -t trixie-backports linux-base&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;br /&gt;
&lt;br /&gt;
This article was imported from [https://forums.debian.net/viewtopic.php?p=841583#p841583 the forum] using some [https://forums.debian.net/viewtopic.php?p=845208#p845208 lazy sed magic].&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=333</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=333"/>
		<updated>2026-10-12T18:00:44Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable Sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last but not least, if it ain&#039;t broken, don&#039;t mess with it, especially in case of your main computer or production systems: the default kernel provided by Trixie works very well in most configurations and receives timely upgrades from the Security Team. You shouldn&#039;t change it unless you have a very clear reason (support for a very recent hardware is the most common example of a good reason: this is usually covered by kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Having mentioned the above disclaimers, building and replacing a kernel is also a very good exercise for users interested in learning the internals of a Debian OS. However like all exercises, it should be performed in a controlled, isolated environment: a [https://wiki.debian.org/libvirt virtual machine] or a spare computer behind a firewall or completely disconnected from the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.3~rcX and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Note: it is generally possible to instead also checkout from the kernel Salsa the tag corresponding to the desired &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release and then proceed almost identically as for building the latest mainline, but it&#039;s way less convenient.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version 7.0~rc7:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
  * Disable unused flavors and feature-sets.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version strings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; while it is technically possible to instead download a prepackaged tarball from kernel.org, using the above command is preferred as it automatically verifies signatures found in the git repo, decreasing the risk of supply-chain attacks. If you decide to download a prepackaged tarball, you should [https://www.kernel.org/category/signatures.html verify it manually] using the detached signature available on kernel.org at the corresponding &amp;lt;code&amp;gt;[pgp]&amp;lt;/code&amp;gt; link. Bear in mind also that the contents of a prepackaged tarball will be slightly different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Starting with 7.2, built packages pre-depend (!) on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;, so [https://backports.debian.org/Instructions/ add it to your apt sources] if you haven&#039;t done so before and then install the newer version:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install -t trixie-backports linux-base&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;br /&gt;
&lt;br /&gt;
This article was imported from [https://forums.debian.net/viewtopic.php?p=841583#p841583 the forum] using some [https://forums.debian.net/viewtopic.php?p=845208#p845208 lazy sed magic].&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=332</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=332"/>
		<updated>2026-10-08T21:10:04Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: use linux-base from trxie-backports&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable Sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last but not least, if it ain&#039;t broken, don&#039;t mess with it, especially in case of your main computer or production systems: the default kernel provided by Trixie works very well in most configurations and receives timely upgrades from the Security Team. You shouldn&#039;t change it unless you have a very clear reason (support for a very recent hardware is the most common example of a good reason: this is usually covered by kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Having mentioned the above disclaimers, building and replacing a kernel is also a very good exercise for users interested in learning the internals of a Debian OS. However like all exercises, it should be performed in a controlled, isolated environment: a [https://wiki.debian.org/libvirt virtual machine] or a spare computer behind a firewall or completely disconnected from the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.3~rcX and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Note: it is generally possible to instead also checkout from the kernel Salsa the tag corresponding to the desired &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release and then proceed almost identically as for building the latest mainline, but it&#039;s way less convenient.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version 7.0~rc7:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
  * Disable unused flavors and feature-sets.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version strings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; while it is technically possible to instead download a prepackaged tarball from kernel.org, using the above command is preferred as it automatically verifies signatures found in the git repo, decreasing the risk of supply-chain attacks. If you decide to download a prepackaged tarball, you should [https://www.kernel.org/category/signatures.html verify it manually] using the detached signature available on kernel.org at the corresponding &amp;lt;code&amp;gt;[pgp]&amp;lt;/code&amp;gt; link. Bear in mind also that the contents of a prepackaged tarball will be slightly different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Starting with 7.2, built packages pre-depend (!) on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;, so [https://backports.debian.org/Instructions/ add it to your apt sources] if you haven&#039;t done so before and then install the newer version:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install -t trixie-backports linux-base&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;br /&gt;
&lt;br /&gt;
This article was imported from [https://forums.debian.net/viewtopic.php?p=841583#p841583 the forum] using [https://forums.debian.net/viewtopic.php?p=845208#p845208 lazy sed magic].&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=Chroot_utility&amp;diff=331</id>
		<title>Chroot utility</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=Chroot_utility&amp;diff=331"/>
		<updated>2026-10-04T20:40:59Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;[https://manpages.debian.org/man/chroot chroot] is an utility that changes which folder is considered the root of the filesystem hierarchy by its child processes, so that it is impossible for them to access the parent folder of the new root, even though it physically exists on the disk.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Common use-cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Fast switching to another environment (distro, version, flavor, package mix etc) for the purposes of testing, building, debugging etc.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Repairing a broken Linux installation by connecting its primary drive as an external device (for example using an USB enclosure) to some other working system and performing operations from within the system being repaired.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Historically &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; was also used to increase the security of network services running on a given machine: if an attacker managed to trick a service to an [https://en.wikipedia.org/wiki/Arbitrary_code_execution arbitrary code execution], he would still not have access to the whole filesystem of the machine (he would remain in a so called &#039;&#039;chroot jail&#039;&#039;). This however does not prevent the attacker from using the machine&#039;s network interfaces to further penetrate the internal network, moreover on Linux and some other UNIXes, escaping a &amp;quot;chroot jail&amp;quot; is relatively easy. As a result, for security-related purposes &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; was replaced by virtual machines and containers.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note: &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; utility is intended mostly for an occasional, ad-hoc usage.&#039;&#039;&#039; If you regularly need to switch to different environments, then consider more robust systems that automate setting up and offer greater flexibility, such as [https://wiki.debian.org/Schroot schroot] or [https://wiki.debian.org/Podman Podman].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic setup and usage =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Unless explicitly stated otherwise, all commands in the below subsections require `root` privileges.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Create or provide a file hierarchy of a Linux system ==&lt;br /&gt;
&lt;br /&gt;
In the subsequent sections, &#039;&#039;&#039;&amp;lt;code&amp;gt;${chrootFolder}&amp;lt;/code&amp;gt;&#039;&#039;&#039; will refer to the root folder of a file hierarchy created or provided as described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;In case of switching to existing installations, it boils down to mounting their root filesystem at a target folder of your choice.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;In case you want to create a fresh Debian image, you can use utilities such as &amp;lt;code&amp;gt;mmdebstrap&amp;lt;/code&amp;gt;, for example to create a clean environment to build deb packages: &amp;lt;pre&amp;gt;&lt;br /&gt;
mmdebstrap --skip=output/dev,output/mknod --variant=buildd \&lt;br /&gt;
    trixie &amp;quot;${chrootFolder}&amp;quot; http://deb.debian.org/debian&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mount virtual filesystems ==&lt;br /&gt;
&lt;br /&gt;
As of 2026 these are &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;sysfs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;udev&amp;lt;/code&amp;gt; and &amp;quot;children&amp;quot; of the latter 2 of which there are too many and which also tend to die off or spawn way too often. Fortunately, &amp;lt;code&amp;gt;mount&amp;lt;/code&amp;gt; has &amp;lt;code&amp;gt;--rbind&amp;lt;/code&amp;gt; option that allows to bind an already mounted filesystem together with all its children to an additional target folder. Of course [https://wiki.debian.org/systemd#Known_Issues_and_Workarounds systemd decided to break some basic functionality], so you additionally need to use either &amp;lt;code&amp;gt;--make-rslave&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--make-rprivate&amp;lt;/code&amp;gt; flag to enforce the proper behavior (see [https://manpages.debian.org/man/mount_namespaces man mount_namespaces] for details).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mount -t proc proc &amp;quot;${chrootFolder}/proc&amp;quot;&lt;br /&gt;
mount --rbind --make-rslave /sys &amp;quot;${chrootFolder}/sys&amp;quot;&lt;br /&gt;
mount --rbind --make-rslave /dev &amp;quot;${chrootFolder}/dev&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case you are wondering: &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; has 1 child also: &amp;lt;code&amp;gt;binfmt_misc&amp;lt;/code&amp;gt;, which is used for registering binary executable handlers/interpreters, which does not make sense in a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; (the absolute path of a given interpreter needs to be provided, which is inaccessible from a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed context), therefore no point in binding it.&lt;br /&gt;
&lt;br /&gt;
== Copy the DNS resolver config ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /etc/resolv.conf &amp;quot;${chrootFolder}/etc/&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Perform a chroot switch ==&lt;br /&gt;
&lt;br /&gt;
This usually boils down to &amp;lt;pre&amp;gt;&lt;br /&gt;
chroot &amp;quot;${chrootFolder}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...which will start an interactive login shell of &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; user inside the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed environment, so that you can interactively perform whatever tasks you need.&lt;br /&gt;
&lt;br /&gt;
For non-interactive tasks, you can instead provide an alternative command and its args: &amp;lt;pre&amp;gt;&lt;br /&gt;
chroot &amp;quot;${chrootFolder}&amp;quot; /root/myScriptToBeExecutedInChroot.sh myArg1 myArg2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/root/myScriptToBeExecutedInChroot.sh&amp;lt;/code&amp;gt; is a path inside the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed hierarchy.&lt;br /&gt;
&lt;br /&gt;
== Cleanup ==&lt;br /&gt;
&lt;br /&gt;
After the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; process exits, you need to unbind / &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt; all the virtual filesystems bound / mounted previously. Fortunately &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt; also has &amp;lt;code&amp;gt;--recursive&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;-R&amp;lt;/code&amp;gt; flag to help with this: &amp;lt;pre&amp;gt;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}/dev&amp;quot;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}/sys&amp;quot;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}/proc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If &amp;lt;code&amp;gt;${chrootFolder}&amp;lt;/code&amp;gt; is a mount point of an external drive and you want to &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt; it also, you can replace all the above commands with the below single one: &amp;lt;pre&amp;gt;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional notes and scenarios =&lt;br /&gt;
&lt;br /&gt;
== Running X11 GUI apps ==&lt;br /&gt;
&lt;br /&gt;
Running X11 GUI apps from within a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed environment and displaying them on host&#039;s X11 server works using standard mechanisms: just export the value of &amp;lt;code&amp;gt;DISPLAY&amp;lt;/code&amp;gt; env var from the host in the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; and make sure the host X server will allow connections (for example using &amp;lt;code&amp;gt;xhost&amp;lt;/code&amp;gt; utility).&lt;br /&gt;
&lt;br /&gt;
== Running Systemd services ==&lt;br /&gt;
&lt;br /&gt;
Systemd services will generally refuse to run in a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed environment. Use [https://wiki.debian.org/nspawn systemd-nspawn] instead of &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; if you need to run Systemd services.&lt;br /&gt;
&lt;br /&gt;
== Foreign architectures ==&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;qemu-user-binfmt&amp;lt;/code&amp;gt; is installed, it is possible to &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; to a filesystem for any foreign arch it supports.&lt;br /&gt;
&lt;br /&gt;
== Modifying boot data ==&lt;br /&gt;
&lt;br /&gt;
If you want to modify the boot data of another system whose drive you &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed into (this includes for example running &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;update-initramfs&amp;lt;/code&amp;gt;, installing a new kernel or firmware + kernel modules for boot-critical devices etc), you need to mount its &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; hierarchy. This may include the following:&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; itself is sometimes a separate partition, most commonly on systems using some disk encryption scheme.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;On UEFI systems (which includes most of modern x86 and ARM hardware), their ESP partitions are mounted at &amp;lt;code&amp;gt;/boot/efi&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is usually most convenient to mount these filesystems right after performing a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; switch.&lt;br /&gt;
&lt;br /&gt;
After performing a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; switch, check which filesystem are present by running &amp;lt;code&amp;gt;grep /boot /etc/fstab&amp;lt;/code&amp;gt;. Below is an example output from a system with both &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/boot/efi&amp;lt;/code&amp;gt; entries: &amp;lt;pre&amp;gt;&lt;br /&gt;
UUID=7a307683-255a-4bac-937f-95aa2af2ca17  /boot      ext4  defaults    0  2&lt;br /&gt;
UUID=4D18-6163                             /boot/efi  vfat  umask=0077  0  1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt; entries use UUIDs as in the example above (which is the default on most modern distros) or unique &amp;lt;code&amp;gt;PARTLABEL&amp;lt;/code&amp;gt;s or &amp;lt;code&amp;gt;LABEL&amp;lt;/code&amp;gt;s, then all you need to do is to point &amp;lt;code&amp;gt;mount&amp;lt;/code&amp;gt; to their corresponding mount-points: &amp;lt;pre&amp;gt;&lt;br /&gt;
mount /boot&lt;br /&gt;
mount /boot/efi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On some older systems, instead of UUIDs or labels, device nodes may be used in &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;, like for example &amp;lt;code&amp;gt;/dev/sdaX&amp;lt;/code&amp;gt; etc. In such case you need to figure out what device node currently corresponds to a given filesystem. Most commonly, it will be another partition on the same physical drive as the root filesystem of that external system.&lt;br /&gt;
&lt;br /&gt;
After you are done with your &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; work, these filesystems may be &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt;-ed either from within the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; or after exiting.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=Chroot_utility&amp;diff=330</id>
		<title>Chroot utility</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=Chroot_utility&amp;diff=330"/>
		<updated>2026-10-04T20:39:13Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;[https://manpages.debian.org/man/chroot chroot] is an utility that changes which folder is considered the root of the filesystem hierarchy by its child processes, so that it is impossible for them to access the parent folder of the new root, even though it physically exists on the disk.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Common use-cases =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Fast switching to another environment (distro, version, flavor, package mix etc) for the purposes of testing, building, debugging etc.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Repairing a broken Linux installation by connecting its primary drive as an external device (for example using an USB enclosure) to some other working system and performing operations from within the system being repaired.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Historically &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; was also used to increase the security of network services running on a given machine: if an attacker managed to trick a service to an [https://en.wikipedia.org/wiki/Arbitrary_code_execution arbitrary code execution], he would still not have access to the whole filesystem of the machine (he would remain in a so called &#039;&#039;chroot jail&#039;&#039;). This however does not prevent the attacker from using the machine&#039;s network interfaces to further penetrate the internal network, moreover on Linux and some other UNIXes, escaping a &amp;quot;chroot jail&amp;quot; is relatively easy. As a result, for security-related purposes &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; was replaced by virtual machines and containers.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note: &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; utility is intended mostly for an occasional, ad-hoc usage.&#039;&#039;&#039; If you regularly need to switch to different environments, then consider more robust systems that automate setting up and offer greater flexibility, such as [https://wiki.debian.org/Schroot schroot] or [https://wiki.debian.org/Podman Podman].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic setup and usage =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Unless explicitly stated otherwise, all commands in the below subsections require `root` privileges.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Create or provide a file hierarchy of a Linux system ==&lt;br /&gt;
&lt;br /&gt;
In the subsequent sections, &#039;&#039;&#039;&amp;lt;code&amp;gt;${chrootFolder}&amp;lt;/code&amp;gt;&#039;&#039;&#039; will refer to the root folder of a file hierarchy created or provided as described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;In case of switching to existing installations, it boils down to mounting their root filesystem at a target folder of your choice.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;In case you want to create a fresh Debian image, you can use utilities such as &amp;lt;code&amp;gt;mmdebstrap&amp;lt;/code&amp;gt;, for example to create a clean environment to build deb packages: &amp;lt;pre&amp;gt;&lt;br /&gt;
mmdebstrap --skip=output/dev,output/mknod --variant=buildd \&lt;br /&gt;
    trixie &amp;quot;${chrootFolder}&amp;quot; http://deb.debian.org/debian&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mount virtual filesystems ==&lt;br /&gt;
&lt;br /&gt;
As of 2026 these are &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;sysfs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;udev&amp;lt;/code&amp;gt; and &amp;quot;children&amp;quot; of the latter 2 of which there are too many and which also tend to die off or spawn way too often. Fortunately, &amp;lt;code&amp;gt;mount&amp;lt;/code&amp;gt; has &amp;lt;code&amp;gt;--rbind&amp;lt;/code&amp;gt; option that allows to bind an already mounted filesystem together with all its children to an additional target folder. Of course [https://wiki.debian.org/systemd#Known_Issues_and_Workarounds systemd decided to break some basic functionality], so you additionally need to use either &amp;lt;code&amp;gt;--make-rslave&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--make-rprivate&amp;lt;/code&amp;gt; flag to enforce the proper behavior (see [https://manpages.debian.org/man/mount_namespaces man mount_namespaces] for details).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mount -t proc proc &amp;quot;${chrootFolder}/proc&amp;quot;&lt;br /&gt;
mount --rbind --make-rslave /sys &amp;quot;${chrootFolder}/sys&amp;quot;&lt;br /&gt;
mount --rbind --make-rslave /dev &amp;quot;${chrootFolder}/dev&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case you are wondering: &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; has 1 child also: &amp;lt;code&amp;gt;binfmt_misc&amp;lt;/code&amp;gt;, which is used for registering binary executable handlers/interpreters, which does not make sense in a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; (the absolute path of a given interpreter needs to be provided, which is inaccessible from a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed context), therefore no point in binding it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Copy the DNS resolver config ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /etc/resolv.conf &amp;quot;${chrootFolder}/etc/&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Perform a chroot switch ==&lt;br /&gt;
&lt;br /&gt;
This usually boils down to &amp;lt;pre&amp;gt;&lt;br /&gt;
chroot &amp;quot;${chrootFolder}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...which will start an interactive login shell of &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; user inside the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed environment, so that you can interactively perform whatever tasks you need.&lt;br /&gt;
&lt;br /&gt;
For non-interactive tasks, you can instead provide an alternative command and its args: &amp;lt;pre&amp;gt;&lt;br /&gt;
chroot &amp;quot;${chrootFolder}&amp;quot; /root/myScriptToBeExecutedInChroot.sh myArg1 myArg2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/root/myScriptToBeExecutedInChroot.sh&amp;lt;/code&amp;gt; is a path inside the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed hierarchy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cleanup ==&lt;br /&gt;
&lt;br /&gt;
After the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; process exits, you need to unbind / &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt; all the virtual filesystems bound / mounted previously. Fortunately &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt; also has &amp;lt;code&amp;gt;--recursive&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;-R&amp;lt;/code&amp;gt; flag to help with this: &amp;lt;pre&amp;gt;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}/dev&amp;quot;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}/sys&amp;quot;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}/proc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If &amp;lt;code&amp;gt;${chrootFolder}&amp;lt;/code&amp;gt; is a mount point of an external drive and you want to &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt; it also, you can replace all the above commands with the below single one: &amp;lt;pre&amp;gt;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
------&lt;br /&gt;
------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional notes and scenarios =&lt;br /&gt;
&lt;br /&gt;
== Running X11 GUI apps ==&lt;br /&gt;
&lt;br /&gt;
Running X11 GUI apps from within a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed environment and displaying them on host&#039;s X11 server works using standard mechanisms: just export the value of &amp;lt;code&amp;gt;DISPLAY&amp;lt;/code&amp;gt; env var from the host in the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; and make sure the host X server will allow connections (for example using &amp;lt;code&amp;gt;xhost&amp;lt;/code&amp;gt; utility).&lt;br /&gt;
&lt;br /&gt;
== Running Systemd services ==&lt;br /&gt;
&lt;br /&gt;
Systemd services will generally refuse to run in a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed environment. Use [https://wiki.debian.org/nspawn systemd-nspawn] instead of &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; if you need to run Systemd services.&lt;br /&gt;
&lt;br /&gt;
== Foreign architectures ==&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;qemu-user-binfmt&amp;lt;/code&amp;gt; is installed, it is possible to &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; to a filesystem for any foreign arch it supports.&lt;br /&gt;
&lt;br /&gt;
== Modifying boot data ==&lt;br /&gt;
&lt;br /&gt;
If you want to modify the boot data of another system whose drive you &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed into (this includes for example running &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;update-initramfs&amp;lt;/code&amp;gt;, installing a new kernel or firmware + kernel modules for boot-critical devices etc), you need to mount its &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; hierarchy. This may include the following:&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; itself is sometimes a separate partition, most commonly on systems using some disk encryption scheme.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;On UEFI systems (which includes most of modern x86 and ARM hardware), their ESP partitions are mounted at &amp;lt;code&amp;gt;/boot/efi&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is usually most convenient to mount these filesystems right after performing a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; switch.&lt;br /&gt;
&lt;br /&gt;
After performing a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; switch, check which filesystem are present by running &amp;lt;code&amp;gt;grep /boot /etc/fstab&amp;lt;/code&amp;gt;. Below is an example output from a system with both &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/boot/efi&amp;lt;/code&amp;gt; entries: &amp;lt;pre&amp;gt;&lt;br /&gt;
UUID=7a307683-255a-4bac-937f-95aa2af2ca17  /boot      ext4  defaults    0  2&lt;br /&gt;
UUID=4D18-6163                             /boot/efi  vfat  umask=0077  0  1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt; entries use UUIDs as in the example above (which is the default on most modern distros) or unique &amp;lt;code&amp;gt;PARTLABEL&amp;lt;/code&amp;gt;s or &amp;lt;code&amp;gt;LABEL&amp;lt;/code&amp;gt;s, then all you need to do is to point &amp;lt;code&amp;gt;mount&amp;lt;/code&amp;gt; to their corresponding mount-points: &amp;lt;pre&amp;gt;&lt;br /&gt;
mount /boot&lt;br /&gt;
mount /boot/efi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On some older systems, instead of UUIDs or labels, device nodes may be used in &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;, like for example &amp;lt;code&amp;gt;/dev/sdaX&amp;lt;/code&amp;gt; etc. In such case you need to figure out what device node currently corresponds to a given filesystem. Most commonly, it will be another partition on the same physical drive as the root filesystem of that external system.&lt;br /&gt;
&lt;br /&gt;
After you are done with your &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; work, these filesystems may be &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt;-ed either from within the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; or after exiting.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=Chroot_utility&amp;diff=329</id>
		<title>Chroot utility</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=Chroot_utility&amp;diff=329"/>
		<updated>2026-10-04T20:14:10Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: copy my last version from debian wiki&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;[https://manpages.debian.org/man/chroot chroot] is an utility that changes which folder is considered the root of the filesystem hierarchy by its child processes, so that it is impossible for them to access the parent folder of the new root, even though it physically exists on the disk.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Common use-cases =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; utility is intended mostly for an occasional, ad-hoc usage.&#039;&#039;&#039; If you regularly need to switch to different environments, then consider more robust systems that automate setting up and offer greater flexibility, such as [https://wiki.debian.org/Schroot schroot] or [https://wiki.debian.org/Podman Podman].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Fast switching to another environment (distro, version, flavor, package mix etc) for the purposes of testing, building, debugging etc.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Repairing a broken Linux installation by connecting its primary drive as an external device (for example using an USB enclosure) to some other working system and performing operations from within the system being repaired.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;Historically &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; was also used to increase the security of network services running on a given machine: if an attacker managed to trick a service to an [https://en.wikipedia.org/wiki/Arbitrary_code_execution arbitrary code execution], he would still not have access to the whole filesystem of the machine (he would remain in a so called &#039;&#039;chroot jail&#039;&#039;). This however does not prevent the attacker from using the machine&#039;s network interfaces to further penetrate the internal network, moreover on Linux and some other UNIXes, escaping a &amp;quot;chroot jail&amp;quot; is relatively easy. As a result, for security-related purposes &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; was replaced by virtual machines and containers.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Basic setup and usage =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Unless explicitly stated otherwise, all commands in the below subsections require `root` privileges.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Create or provide a file hierarchy of a Linux system ==&lt;br /&gt;
&lt;br /&gt;
In the subsequent sections, &#039;&#039;&#039;&amp;lt;code&amp;gt;${chrootFolder}&amp;lt;/code&amp;gt;&#039;&#039;&#039; will refer to the root folder of a file hierarchy created or provided as described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;In case of switching to existing installations, it boils down to mounting their root filesystem at a target folder of your choice.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;In case you want to create a fresh Debian image, you can use utilities such as &amp;lt;code&amp;gt;mmdebstrap&amp;lt;/code&amp;gt;, for example to create a clean environment to build deb packages: &amp;lt;pre&amp;gt;&lt;br /&gt;
mmdebstrap --skip=output/dev,output/mknod --variant=buildd \&lt;br /&gt;
    trixie &amp;quot;${chrootFolder}&amp;quot; http://deb.debian.org/debian&amp;lt;/pre&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Mount virtual filesystems ==&lt;br /&gt;
&lt;br /&gt;
As of 2026 these are &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;sysfs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;udev&amp;lt;/code&amp;gt; and &amp;quot;children&amp;quot; of the latter 2 of which there are too many and which also tend to die off or spawn way too often. Fortunately, &amp;lt;code&amp;gt;mount&amp;lt;/code&amp;gt; has &amp;lt;code&amp;gt;--rbind&amp;lt;/code&amp;gt; option that allows to bind an already mounted filesystem together with all its children to an additional target folder. Of course [https://wiki.debian.org/systemd#Known_Issues_and_Workarounds systemd decided to break some basic functionality], so you additionally need to use either &amp;lt;code&amp;gt;--make-rslave&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--make-rprivate&amp;lt;/code&amp;gt; flag to enforce the proper behavior (see [https://manpages.debian.org/man/mount_namespaces man mount_namespaces] for details).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mount -t proc proc &amp;quot;${chrootFolder}/proc&amp;quot;&lt;br /&gt;
mount --rbind --make-rslave /sys &amp;quot;${chrootFolder}/sys&amp;quot;&lt;br /&gt;
mount --rbind --make-rslave /dev &amp;quot;${chrootFolder}/dev&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case you are wondering: &amp;lt;code&amp;gt;proc&amp;lt;/code&amp;gt; has 1 child also: &amp;lt;code&amp;gt;binfmt_misc&amp;lt;/code&amp;gt;, which is used for registering binary executable handlers/interpreters, which does not make sense in a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; (the absolute path of a given interpreter needs to be provided, which is inaccessible from a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed context), therefore no point in binding it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Copy the DNS resolver config ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp /etc/resolv.conf &amp;quot;${chrootFolder}/etc/&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Perform a chroot switch ==&lt;br /&gt;
&lt;br /&gt;
This usually boils down to &amp;lt;pre&amp;gt;&lt;br /&gt;
chroot &amp;quot;${chrootFolder}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...which will start an interactive login shell of &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; user inside the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed environment, so that you can interactively perform whatever tasks you need.&lt;br /&gt;
&lt;br /&gt;
For non-interactive tasks, you can instead provide an alternative command and its args: &amp;lt;pre&amp;gt;&lt;br /&gt;
chroot &amp;quot;${chrootFolder}&amp;quot; /root/myScriptToBeExecutedInChroot.sh myArg1 myArg2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;/root/myScriptToBeExecutedInChroot.sh&amp;lt;/code&amp;gt; is a path inside the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed hierarchy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Cleanup ==&lt;br /&gt;
&lt;br /&gt;
After the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; process exits, you need to unbind / &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt; all the virtual filesystems bound / mounted previously. Fortunately &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt; also has &amp;lt;code&amp;gt;--recursive&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;-R&amp;lt;/code&amp;gt; flag to help with this: &amp;lt;pre&amp;gt;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}/dev&amp;quot;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}/sys&amp;quot;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}/proc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If &amp;lt;code&amp;gt;${chrootFolder}&amp;lt;/code&amp;gt; is a mount point of an external drive and you want to &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt; it also, you can replace all the above commands with the below single one: &amp;lt;pre&amp;gt;&lt;br /&gt;
umount -R &amp;quot;${chrootFolder}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Additional notes and scenarios =&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running X11 GUI apps ==&lt;br /&gt;
&lt;br /&gt;
Running X11 GUI apps from within a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed environment and displaying them on host&#039;s X11 server works using standard mechanisms: just export the value of &amp;lt;code&amp;gt;DISPLAY&amp;lt;/code&amp;gt; env var from the host in the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; and make sure the host X server will allow connections (for example using &amp;lt;code&amp;gt;xhost&amp;lt;/code&amp;gt; utility).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running Systemd services ==&lt;br /&gt;
&lt;br /&gt;
Systemd services will generally refuse to run in a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed environment. Use [https://wiki.debian.org/nspawn systemd-nspawn] instead of &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; if you need to run Systemd services.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Foreign architectures ==&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;qemu-user-binfmt&amp;lt;/code&amp;gt; is installed, it is possible to &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; to a filesystem for any foreign arch it supports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Modifying boot data ==&lt;br /&gt;
&lt;br /&gt;
If you want to modify the boot data of another system whose drive you &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt;-ed into (this includes for example running &amp;lt;code&amp;gt;update-grub&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;update-initramfs&amp;lt;/code&amp;gt;, installing a new kernel or firmware + kernel modules for boot-critical devices etc), you need to mount its &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; hierarchy. This may include the following:&amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; itself is sometimes a separate partition, most commonly on systems using some disk encryption scheme.&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;On UEFI systems (which includes most of modern x86 and ARM hardware), their ESP partitions are mounted at &amp;lt;code&amp;gt;/boot/efi&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is usually most convenient to mount these filesystems right after performing a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; switch.&lt;br /&gt;
&lt;br /&gt;
After performing a &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; switch, check which filesystem are present by running &amp;lt;code&amp;gt;grep /boot /etc/fstab&amp;lt;/code&amp;gt;. Below is an example output from a system with both &amp;lt;code&amp;gt;/boot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/boot/efi&amp;lt;/code&amp;gt; entries: &amp;lt;pre&amp;gt;&lt;br /&gt;
UUID=7a307683-255a-4bac-937f-95aa2af2ca17  /boot      ext4  defaults    0  2&lt;br /&gt;
UUID=4D18-6163                             /boot/efi  vfat  umask=0077  0  1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt; entries use UUIDs as in the example above (which is the default on most modern distros) or unique &amp;lt;code&amp;gt;PARTLABEL&amp;lt;/code&amp;gt;s or &amp;lt;code&amp;gt;LABEL&amp;lt;/code&amp;gt;s, then all you need to do is to point &amp;lt;code&amp;gt;mount&amp;lt;/code&amp;gt; to their corresponding mount-points: &amp;lt;pre&amp;gt;&lt;br /&gt;
mount /boot&lt;br /&gt;
mount /boot/efi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
On some older systems, instead of UUIDs or labels, device nodes may be used in &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;, like for example &amp;lt;code&amp;gt;/dev/sdaX&amp;lt;/code&amp;gt; etc. In such case you need to figure out what device node currently corresponds to a given filesystem. Most commonly, it will be another partition on the same physical drive as the root filesystem of that external system.&lt;br /&gt;
&lt;br /&gt;
After you are done with your &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; work, these filesystems may be &amp;lt;code&amp;gt;umount&amp;lt;/code&amp;gt;-ed either from within the &amp;lt;code&amp;gt;chroot&amp;lt;/code&amp;gt; or after exiting.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=Main_Page&amp;diff=328</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=Main_Page&amp;diff=328"/>
		<updated>2026-10-04T19:28:57Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: add link to chroot page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Welcome to the Debian Users Forum Cache. =&lt;br /&gt;
&lt;br /&gt;
This wiki is dedicated specific member solutions from the [https://forums.debian.net Debian User Forums] and not to be confused with the larger man style documentation driven official [https://wiki.debian.org Debian Project Wiki].&lt;br /&gt;
&lt;br /&gt;
Our works here are citable formats of some of our best threads, member contributions, guides, and information that can provide assistance on or offline. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== About ==&lt;br /&gt;
About:&lt;br /&gt;
* [[Debian Forums Cache:About|Debian Forums Cache]]&lt;br /&gt;
* [[Debian User Forums]]&lt;br /&gt;
* [[The Debian Project]]&lt;br /&gt;
* [[Forum jokes, lingo, and memorable quotes]]&lt;br /&gt;
&lt;br /&gt;
== Guides (reference) ==&lt;br /&gt;
&lt;br /&gt;
* [[Root, Sudo, and SU|Root, sudo, su, and su -]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Debian First Aid Kit]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Fonts and Themes in Cinnamon Desktop]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[To install Firefox from Mozilla repo|Installing Firefox from the Mozilla repository]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Security Hardening for Debian Users: Protecting Against Targeted Attacks]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[chroot utility]]&lt;br /&gt;
&lt;br /&gt;
== HowTo (guides) == &lt;br /&gt;
* [[MTR Network Diagnostics]]  &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[WiFi Signal Strength and Sharing]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[REFInd USB Drive (for emergency boot)]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Trixie iwd]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Debian Live USB with Persistence]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[HowTo build the latest mainline or rebuild Sid kernel packages for Trixie]]&lt;br /&gt;
&lt;br /&gt;
== Licensing and Use ==&lt;br /&gt;
Licensing:&lt;br /&gt;
* [[Publish using CC International licencing and your Forum name]].&lt;br /&gt;
* [[Cache AI Use]]&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=327</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=327"/>
		<updated>2026-09-29T09:43:35Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: minor version and formatting updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable Sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last but not least, if it ain&#039;t broken, don&#039;t mess with it, especially in case of your main computer or production systems: the default kernel provided by Trixie works very well in most configurations and receives timely upgrades from the Security Team. You shouldn&#039;t change it unless you have a very clear reason (support for a very recent hardware is the most common example of a good reason: this is usually covered by kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Having mentioned the above disclaimers, building and replacing a kernel is also a very good exercise for users interested in learning the internals of a Debian OS. However like all exercises, it should be performed in a controlled, isolated environment: a [https://wiki.debian.org/libvirt virtual machine] or a spare computer behind a firewall or completely disconnected from the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.3~rcX and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Note: it is generally possible to instead also checkout from the kernel Salsa the tag corresponding to the desired &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release and then proceed almost identically as for building the latest mainline, but it&#039;s way less convenient.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version 7.0~rc7:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
  * Disable unused flavors and feature-sets.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version strings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; while it is technically possible to instead download a prepackaged tarball from kernel.org, using the above command is preferred as it automatically verifies signatures found in the git repo, decreasing the risk of supply-chain attacks. If you decide to download a prepackaged tarball, you should [https://www.kernel.org/category/signatures.html verify it manually] using the detached signature available on kernel.org at the corresponding &amp;lt;code&amp;gt;[pgp]&amp;lt;/code&amp;gt; link. Bear in mind also that the contents of a prepackaged tarball will be slightly different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release 7.2-1~exp1, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;br /&gt;
&lt;br /&gt;
This article was imported from [https://forums.debian.net/viewtopic.php?p=841583#p841583 the forum] using [https://forums.debian.net/viewtopic.php?p=845208#p845208 lazy sed magic].&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=326</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=326"/>
		<updated>2026-09-18T02:08:10Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: link to kernel.org verification procedure&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last but not least, if it ain&#039;t broken, don&#039;t mess with it, especially in case of your main computer or production systems: the default kernel provided by Trixie works very well in most configurations and receives timely upgrades from the Security Team. You shouldn&#039;t change it unless you have a very clear reason (support for a very recent hardware is the most common example of a good reason: this is usually covered by kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Having mentioned the above disclaimers, building and replacing a kernel is also a very good exercise for users interested in learning the internals of a Debian OS. However like all exercises, it should be performed in a controlled, isolated environment: a [https://wiki.debian.org/libvirt virtual machine] or a spare computer behind a firewall or completely disconnected from the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Note: it is generally possible to instead also checkout from the kernel Salsa the tag corresponding to the desired &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release and then proceed almost identically as for building the latest mainline, but it&#039;s way less convenient.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; while it is technically possible to instead download a prepackaged tarball from kernel.org, using the above command is preferred as it automatically verifies signatures found in the git repo, decreasing the risk of supply-chain attacks. If you decide to download a prepackaged tarball, you should [https://www.kernel.org/category/signatures.html verify it manually] using the detached signature available on kernel.org at the corresponding &amp;lt;code&amp;gt;[pgp]&amp;lt;/code&amp;gt; link. Bear in mind also that the contents of a prepackaged tarball will be slightly different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;br /&gt;
&lt;br /&gt;
This article was imported from [https://forums.debian.net/viewtopic.php?p=841583#p841583 the forum] using [https://forums.debian.net/viewtopic.php?p=845208#p845208 lazy sed magic].&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=325</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=325"/>
		<updated>2026-09-16T15:46:05Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: add a warning regarding kernel.org prepackaged tarballs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last but not least, if it ain&#039;t broken, don&#039;t mess with it, especially in case of your main computer or production systems: the default kernel provided by Trixie works very well in most configurations and receives timely upgrades from the Security Team. You shouldn&#039;t change it unless you have a very clear reason (support for a very recent hardware is the most common example of a good reason: this is usually covered by kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Having mentioned the above disclaimers, building and replacing a kernel is also a very good exercise for users interested in learning the internals of a Debian OS. However like all exercises, it should be performed in a controlled, isolated environment: a [https://wiki.debian.org/libvirt virtual machine] or a spare computer behind a firewall or completely disconnected from the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Note: it is generally possible to instead also checkout from the kernel Salsa the tag corresponding to the desired &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release and then proceed almost identically as for building the latest mainline, but it&#039;s way less convenient.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; while it is technically possible to instead download a prepackaged tarball from kernel.org, using the above command is preferred as it automatically verifies signatures found in the git repo, decreasing the risk of supply-chain attacks. If you decide to download a prepackaged tarball, you should verify it manually using the corresponding detached signature available on kernel.org under &amp;lt;code&amp;gt;[pgp]&amp;lt;/code&amp;gt; link. Bear in mind also that the contents of a prepackaged tarball will be slightly different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;br /&gt;
&lt;br /&gt;
This article was imported from [https://forums.debian.net/viewtopic.php?p=841583#p841583 the forum] using [https://forums.debian.net/viewtopic.php?p=845208#p845208 lazy sed magic].&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=324</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=324"/>
		<updated>2026-09-13T16:09:38Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: link to the original&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last but not least, if it ain&#039;t broken, don&#039;t mess with it, especially in case of your main computer or production systems: the default kernel provided by Trixie works very well in most configurations and receives timely upgrades from the Security Team. You shouldn&#039;t change it unless you have a very clear reason (support for a very recent hardware is the most common example of a good reason: this is usually covered by kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Having mentioned the above disclaimers, building and replacing a kernel is a very good exercise for users interested in learning the internals of a Debian OS. However like all exercises, it should be performed in a controlled, isolated environment: a [https://wiki.debian.org/libvirt virtual machine] or a spare computer behind a firewall or completely disconnected from the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Note: it is generally possible to instead also checkout from the kernel Salsa the tag corresponding to the desired &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release and then proceed almost identically as for building the latest mainline, but it&#039;s way less convenient.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can instead download a prepackaged tarball from kernel.org, but bear in mind that its contents will be somewhat different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;br /&gt;
&lt;br /&gt;
This article was imported from [https://forums.debian.net/viewtopic.php?p=841583#p841583 the forum] using [https://forums.debian.net/viewtopic.php?p=845208#p845208 lazy sed magic].&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=323</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=323"/>
		<updated>2026-09-13T15:31:11Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: some more disclaimers in the intro&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Last but not least, if it ain&#039;t broken, don&#039;t mess with it, especially in case of your main computer or production systems: the default kernel provided by Trixie works very well in most configurations and receives timely upgrades from the Security Team. You shouldn&#039;t change it unless you have a very clear reason (support for a very recent hardware is the most common example for a good reason: this is usually covered by kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Having mentioned the above disclaimers, building and replacing a kernel is a very good exercise for users interested in learning the internals of a Debian OS. However like all exercises, it should be performed in a controlled, isolated environment: a [https://wiki.debian.org/libvirt virtual machine] or a spare computer behind a firewall or completely disconnected from the internet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Note: it is generally possible to instead also checkout from the kernel Salsa the tag corresponding to the desired &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release and then proceed almost identically as for building the latest mainline, but it&#039;s way less convenient.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can instead download a prepackaged tarball from kernel.org, but bear in mind that its contents will be somewhat different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=322</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=322"/>
		<updated>2026-09-11T17:44:31Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: note on using the kernel Salsa for rebuilding Sid/experimental&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Note: it is generally possible to instead also checkout from the kernel Salsa the tag corresponding to the desired &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release and then proceed almost identically as for building the latest mainline, but it&#039;s way less convenient.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can instead download a prepackaged tarball from kernel.org, but bear in mind that its contents will be somewhat different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=321</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=321"/>
		<updated>2026-09-11T14:38:54Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: note on kernel.org source tarballs, better space estimates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can instead download a prepackaged tarball from kernel.org, but bear in mind that its contents will be somewhat different than what the above command would produce as it skips a few files not meeting Debian&#039;s free software guidelines (DFSG, mainly some Nvidia related stuff).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 50GB of temporary space and produces a bit less than 4GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=320</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=320"/>
		<updated>2026-09-08T12:18:50Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~3MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository], then extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix together with the local release number as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer and use n times more temporary space. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;EITHER&#039;&#039; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OR&#039;&#039; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 60GB of temporary space and produces a bit less than 6GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=319</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=319"/>
		<updated>2026-09-08T11:46:07Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: disk space considerations&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version / base release. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS, uses a bit less than 60GB of temporary space and produces a bit less than 6GB of ccache.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=318</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=318"/>
		<updated>2026-09-07T09:12:38Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: note on updating ABI name after dch -i&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number (remember to update your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; var accordingly and the ABI name: see the next point).&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=317</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=317"/>
		<updated>2026-09-06T13:31:27Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: dch -i explanation fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent local release of the same &amp;quot;base&amp;quot; &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; release, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase just your local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=316</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=316"/>
		<updated>2026-09-05T12:45:42Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: add a security notice&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;NONE OF THE ABOVE SUITES IS FORMALLY COVERED BY THE DEBIAN SECURITY TEAM&#039;&#039;&#039;, so you should watch [https://tracker.debian.org/pkg/linux kernel security announcements] yourself.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract and merge it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=315</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=315"/>
		<updated>2026-09-05T10:11:01Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: new linux-base version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;lt;code&amp;gt;.dsc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.debian.tar.xz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;.orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; versions not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the latest version say from [https://snapshot.debian.org/package/linux-base/ Snapshot repo] and install the &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file directly, for example currently version 4.17:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260902T143423Z/pool/main/l/linux-base/linux-base_4.17_all.deb&lt;br /&gt;
sudo apt install ./linux-base_*_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=314</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=314"/>
		<updated>2026-09-02T18:08:24Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: minor changelog entry command update for convenient copy-paste&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;quot;dsc&amp;quot;, &amp;quot;debian.tar.xz&amp;quot; and &amp;quot;orig.tar.xz&amp;quot;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export UPSTREAM_VERSION=&amp;quot;7.0~rc7&amp;quot;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (${UPSTREAM_VERSION}-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; version &amp;gt;= 4.16 that is not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download it and install from a &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260816T142939Z/pool/main/l/linux-base/linux-base_4.16_all.deb&lt;br /&gt;
sudo apt install ./linux-base_4.16_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=313</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=313"/>
		<updated>2026-09-01T05:26:12Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: minor upstream reporting note and formatting updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on &#039;&#039;several kernel series&#039;&#039; (at least the latest mainline and the latest stable and preferably also some LTS) across &#039;&#039;several distros&#039;&#039; and mention this fact in your report.&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;quot;dsc&amp;quot;, &amp;quot;debian.tar.xz&amp;quot; and &amp;quot;orig.tar.xz&amp;quot;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; version &amp;gt;= 4.16 that is not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download it and install from a &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260816T142939Z/pool/main/l/linux-base/linux-base_4.16_all.deb&lt;br /&gt;
sudo apt install ./linux-base_4.16_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=312</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=312"/>
		<updated>2026-08-31T10:21:26Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: improve some commands&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on several kernel series (at least the latest mainline and the latest stable) across several distros (and mention this fact in your report).&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;quot;dsc&amp;quot;, &amp;quot;debian.tar.xz&amp;quot; and &amp;quot;orig.tar.xz&amp;quot;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x linux*.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; version &amp;gt;= 4.16 that is not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base/unstable&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download it and install from a &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260816T142939Z/pool/main/l/linux-base/linux-base_4.16_all.deb&lt;br /&gt;
sudo apt install ./linux-base_4.16_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=311</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=311"/>
		<updated>2026-08-31T10:16:02Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: example coning command&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on several kernel series (at least the latest mainline and the latest stable) across several distros (and mention this fact in your report).&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa]. Consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone --branch=debian/latest --depth=1 https://salsa.debian.org/kernel-team/linux&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;quot;dsc&amp;quot;, &amp;quot;debian.tar.xz&amp;quot; and &amp;quot;orig.tar.xz&amp;quot;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x *.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point and repeat the above command.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; version &amp;gt;= 4.16 that is not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base=4.16&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download it and install from a &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260816T142939Z/pool/main/l/linux-base/linux-base_4.16_all.deb&lt;br /&gt;
sudo apt install ./linux-base_4.16_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=310</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=310"/>
		<updated>2026-08-31T09:59:54Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: minor wording and structure update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on several kernel series (at least the latest mainline and the latest stable) across several distros (and mention this fact in your report).&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTRUCTIONS META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;quot;dsc&amp;quot;, &amp;quot;debian.tar.xz&amp;quot; and &amp;quot;orig.tar.xz&amp;quot;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x *.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;noudeb&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nodoc&amp;lt;/code&amp;gt; and if you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;noudeb nodoc pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; version &amp;gt;= 4.16 that is not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base=4.16&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download it and install from a &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260816T142939Z/pool/main/l/linux-base/linux-base_4.16_all.deb&lt;br /&gt;
sudo apt install ./linux-base_4.16_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=309</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=309"/>
		<updated>2026-08-31T07:35:02Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: minor grammar and editorial fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on several kernel series (at least the latest mainline and the latest stable) across several distros (and mention this fact in your report).&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GENERAL META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download the source package files (&amp;quot;dsc&amp;quot;, &amp;quot;debian.tar.xz&amp;quot; and &amp;quot;orig.tar.xz&amp;quot;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x *.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from Trixie&#039;s branch:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.1/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;EITHER&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; version &amp;gt;= 4.16 that is not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base=4.16&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;OTHERWISE&#039;&#039; download it and install from a &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260816T142939Z/pool/main/l/linux-base/linux-base_4.16_all.deb&lt;br /&gt;
sudo apt install ./linux-base_4.16_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=308</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=308"/>
		<updated>2026-08-31T06:29:06Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: minor grammar and editorial fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on several kernel series (at least the latest mainline and the latest stable) across several distros (and mention this fact in your report).&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GENERAL META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, download and extract the source package using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt;, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;...Otherwise:&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Download the source package files (&amp;quot;dsc&amp;quot;, &amp;quot;debian.tar.xz&amp;quot; and &amp;quot;orig.tar.xz&amp;quot;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x *.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of the upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example in my case:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from 7.0.x:&lt;br /&gt;
&amp;lt;pre&amp;gt;git checkout debian/7.0/trixie-backports -- debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you cloned the repo with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt;, then get it using &amp;lt;code&amp;gt;curl&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.0/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;Either&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; version &amp;gt;= 4.16 that is not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base=4.16&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;...Otherwise:&#039;&#039;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Download it and install from a &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260816T142939Z/pool/main/l/linux-base/linux-base_4.16_all.deb&lt;br /&gt;
sudo apt install ./linux-base_4.16_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable your secure-boot or sign the image manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=Main_Page&amp;diff=307</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=Main_Page&amp;diff=307"/>
		<updated>2026-08-31T05:44:33Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: /* HowTo (guides) */ update kernel building title&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Welcome to the Debian Users Forum Cache. =&lt;br /&gt;
&lt;br /&gt;
This wiki is dedicated specific member solutions from the [https://forums.debian.net Debian User Forums] and not to be confused with the larger man style documentation driven official [https://wiki.debian.org Debian Project Wiki].&lt;br /&gt;
&lt;br /&gt;
Our works here are citable formats of some of our best threads, member contributions, guides, and information that can provide assistance on or offline. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== About ==&lt;br /&gt;
About:&lt;br /&gt;
* [[Debian Forums Cache:About|Debian Forums Cache]]&lt;br /&gt;
* [[Debian User Forums]]&lt;br /&gt;
* [[The Debian Project]]&lt;br /&gt;
* [[Forum jokes, lingo, and memorable quotes]]&lt;br /&gt;
&lt;br /&gt;
== Guides (reference) ==&lt;br /&gt;
&lt;br /&gt;
* [[Root, Sudo, and SU|Root, sudo, su, and su -]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Debian First Aid Kit]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Fonts and Themes in Cinnamon Desktop]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[To install Firefox from Mozilla repo|Installing Firefox from the Mozilla repository]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Security Hardening for Debian Users: Protecting Against Targeted Attacks]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== HowTo (guides) == &lt;br /&gt;
* [[MTR Network Diagnostics]]  &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[WiFi Signal Strength and Sharing]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[REFInd USB Drive (for emergency boot)]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Trixie iwd]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Debian Live USB with Persistence]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[HowTo build the latest mainline or rebuild Sid kernel packages for Trixie]]&lt;br /&gt;
&lt;br /&gt;
== Licensing and Use ==&lt;br /&gt;
Licensing:&lt;br /&gt;
* [[Publish using CC International licencing and your Forum name]].&lt;br /&gt;
* [[Cache AI Use]]&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_latest_mainline_kernel_packages_for_Trixie&amp;diff=306</id>
		<title>HowTo build latest mainline kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_latest_mainline_kernel_packages_for_Trixie&amp;diff=306"/>
		<updated>2026-08-31T05:42:58Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Morgwai moved page HowTo build latest mainline kernel packages for Trixie to HowTo build the latest mainline or rebuild Sid kernel packages for Trixie: reflect expansion of scope in the title&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[HowTo build the latest mainline or rebuild Sid kernel packages for Trixie]]&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=305</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=305"/>
		<updated>2026-08-31T05:42:58Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Morgwai moved page HowTo build latest mainline kernel packages for Trixie to HowTo build the latest mainline or rebuild Sid kernel packages for Trixie: reflect expansion of scope in the title&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on several kernel series (at least the latest mainline and the latest stable) across several distros (and mention this fact in your report).&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GENERAL META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, you can download and extract using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt; instead, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;...Otherwise:&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Download the source package files (&amp;quot;dsc&amp;quot;, &amp;quot;debian.tar.xz&amp;quot; and &amp;quot;orig.tar.xz&amp;quot;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x *.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from 7.0.x:&lt;br /&gt;
&amp;lt;pre&amp;gt;git checkout debian/7.0/trixie-backports -- debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you cloned the repo with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt;, then get it using &amp;lt;code&amp;gt;curl&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.0/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;Either&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; version &amp;gt;= 4.16 that is not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base=4.16&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;...Otherwise:&#039;&#039;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Download it and install from a &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260816T142939Z/pool/main/l/linux-base/linux-base_4.16_all.deb&lt;br /&gt;
sudo apt install ./linux-base_4.16_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable secure-boot or sign it manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=304</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=304"/>
		<updated>2026-08-31T05:38:05Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: include instructions for rebuilding&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WHICH KERNEL VERSION TO USE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). A notable scenario that does require the latest mainline is if you need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored. Note however that before posting a new issue there, you should test if the problem is present on several kernel series (at least the latest mainline and the latest stable) across several distros (and mention this fact in your report).&lt;br /&gt;
&lt;br /&gt;
In most other cases, you should generally stick with the latest stable release at most: check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. Mind the following in such case:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;trixie-backports&amp;lt;/code&amp;gt; can be installed right-away in most cases, however currently the notable exception is if you use [https://wiki.debian.org/NvidiaGraphicsDrivers#trixie-550bpo Debian-packaged Nvidia drivers]. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; In case of packages from &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suites, it&#039;s usually more recommended to first rebuild them for Trixie (as described below) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Kernels from &amp;lt;code&amp;gt;experimental&amp;lt;/code&amp;gt; suite may sometimes have integration issues with the rest of the OS, even if based on stable upstream releases. &lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you use any &amp;lt;code&amp;gt;firmware-*&amp;lt;/code&amp;gt; packages, it is usually recommended to upgrade them to the versions from the same suite as the original kernel.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;GENERAL META&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; The examples below are based mostly on 7.0~rcX versions, the instructions were also tested on 7.2 and should be mostly applicable to later versions as well, at least in the near future.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you plan to publish your packages somewhere, you can export &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; to contain your public email.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;(RE)-BUILDING PROCEDURE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Obtain the closest possible debianization:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have the given suite configured, you can download and extract using &amp;lt;code&amp;gt;apt source&amp;lt;/code&amp;gt; instead, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;apt source linux=7.2.2-1~exp1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;...Otherwise:&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Download the source package files (&amp;quot;dsc&amp;quot;, &amp;quot;debian.tar.xz&amp;quot; and &amp;quot;orig.tar.xz&amp;quot;) for example from [https://snapshot.debian.org/package/linux/ Snapshot repository] and extract it with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source -x *.dsc&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the resulting &amp;lt;code&amp;gt;linux*/&amp;lt;/code&amp;gt; folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Forky&#039;s / Sid&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;gcc-16&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your local suffix of &amp;quot;Debian release&amp;quot; part of the package version. The suffix must consist of lowercase letters only, followed by a sequential local release number that must be increased each time you modify your debianization for a given upstream version. For example, I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix (together with the local release number) as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;: it will be useful later.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&amp;quot;future&amp;quot; Debian release (the number after a dash) set to &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &amp;quot;local pre-release&amp;quot; (the part after a tilde) set to your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
So for example in case of upstream version &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${DEBEMAIL:-${USER}@$(hostname)}&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Mind dashes (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) vs tildes (&amp;lt;code&amp;gt;~&amp;lt;/code&amp;gt;) in the version string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of rebuilding from unstable/experimental:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Use &amp;lt;code&amp;gt;dch --local&amp;lt;/code&amp;gt; followed by your local release suffix &#039;&#039;&#039;without&#039;&#039;&#039; the local release number (&amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; will be appended automatically), for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;dch --local morgwai&amp;lt;/pre&amp;gt;&lt;br /&gt;
If later you want to build a subsequent release of the same upstream version, use&lt;br /&gt;
&amp;lt;pre&amp;gt;dch -i&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will increase the local release number.&lt;br /&gt;
&lt;br /&gt;
In both cases, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; will create a template entry in &amp;lt;code&amp;gt;debain/changelog&amp;lt;/code&amp;gt; and open your &amp;lt;code&amp;gt;EDITOR&amp;lt;/code&amp;gt; to fill just a description of changes: you can enter for example something like &amp;quot;&#039;&#039;Packaging changes and rebuild for Trixie&#039;&#039;&amp;quot;.&lt;br /&gt;
&amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; may complain about missing &amp;lt;code&amp;gt;DEBEMAIL&amp;lt;/code&amp;gt; var: in case of a local build, just ignore it.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; By default, neither upstream&#039;s minor version nor &amp;quot;rcX&amp;quot; part is included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite, which may cause conflicts with other kernel packages for the same major upstream version. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several releases of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you increase the local release number in your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from 7.0.x:&lt;br /&gt;
&amp;lt;pre&amp;gt;git checkout debian/7.0/trixie-backports -- debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you cloned the repo with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt;, then get it using &amp;lt;code&amp;gt;curl&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.0/trixie-backports/debian/watch&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;In case of building the latest mainline only:&#039;&#039;&#039; fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder with the below command:&lt;br /&gt;
&amp;lt;pre&amp;gt;uscan --download-current-version --vcs-export-uncompressed&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Run&lt;br /&gt;
&amp;lt;pre&amp;gt;debian/rules orig&amp;lt;/pre&amp;gt;&lt;br /&gt;
In case of rebuilding, the above is necessary to regenerate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; as some package names contain the ABI name.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;In case of building the latest mainline, this may be the most tricky part:&#039;&#039;&#039; it will extract the kernel source from the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt;, &amp;quot;merge&amp;quot; it into the debianization, generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; folder. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches/&amp;lt;/code&amp;gt; and its mention from &amp;lt;code&amp;gt;debian/patches/series&amp;lt;/code&amp;gt; file. Otherwise you need decide whether to rework such patch or, if it concerns features you don&#039;t use, just remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you also want to skip &amp;quot;binary&amp;quot; packages with kernel sources, then add &amp;lt;code&amp;gt;pkg.linux.nosource&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb pkg.linux.nosource&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that applying some of the other profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;Either&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;dpkg-source --build .&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;INSTALLING THE BUILT PACKAGES&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Since the release &amp;lt;code&amp;gt;7.2-1~exp1&amp;lt;/code&amp;gt;, built packages depend on &amp;lt;code&amp;gt;linux-base&amp;lt;/code&amp;gt; version &amp;gt;= 4.16 that is not available in Trixie. This package contains scripts called by kernel&#039;s &amp;lt;code&amp;gt;postinst&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;prerm&amp;lt;/code&amp;gt; scripts and fortunately does not depend on any other stuff not available in Trixie, so the easiest way is to just install this single one from Sid:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;IF&#039;&#039; you have &amp;lt;code&amp;gt;unstable&amp;lt;/code&amp;gt; suite configured, then simply&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo apt install linux-base=4.16&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;...Otherwise:&#039;&#039;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Download it and install from a &amp;lt;code&amp;gt;.deb&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget https://snapshot.debian.org/archive/debian/20260816T142939Z/pool/main/l/linux-base/linux-base_4.16_all.deb&lt;br /&gt;
sudo apt install ./linux-base_4.16_all.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder (in case of using &amp;lt;code&amp;gt;dpkg-buildpackage&amp;lt;/code&amp;gt;), usually at least the below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; &#039;&#039;&#039;Remember that the kernel is unsigned&#039;&#039;&#039;, so you need to either disable secure-boot or sign it manually, for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=288</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=288"/>
		<updated>2026-07-02T08:42:40Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: tiny grammar improvement&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). This HowTo is intended mostly for folks that need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored.&lt;br /&gt;
If you want to try the very latest stable release, check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. In case of Sid and Experimental packages, it&#039;s usually more recommended to rebuild them with Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt; (see point 2) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&lt;br /&gt;
The examples below are based on 7.0~rcX versions, the instructions were also tested on 7.1 and should be mostly applicable to later mainline versions as well, at least in the near future.&lt;br /&gt;
The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;). Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the cloned repo&#039;s folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Sid&#039;s and Forky&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your suffix of Debian-release part of the package version. The suffix must be of the form &amp;lt;code&amp;gt;[a-z]+${SEQUENTIAL_NUMBER}&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;SEQUENTIAL_NUMBER&amp;lt;/code&amp;gt; must be increased each time you build the packages for a given upstream version. For example I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix for example as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; and then create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with the target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;. For example in case of &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${USER}@$(hostname)&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;(at this stage, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; usually cannot be used as &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; has not been generated yet)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; For new features testing purposes, it is often useful to be able to install several &amp;quot;rcX&amp;quot; kernel packages along each other, but by default, &amp;lt;code&amp;gt;~rcX&amp;lt;/code&amp;gt; part is not included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several builds of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you change your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with 7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from 7.0.x:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout debian/7.0/trixie-backports -- debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you cloned the repo with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt;, then get it using &amp;lt;code&amp;gt;curl&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.0/trixie-backports/debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Next, fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
uscan --download-current-version --vcs-export-uncompressed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally, extract the kernel source form the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; and &amp;quot;merge&amp;quot; it into the debianization:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
debian/rules orig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches&amp;lt;/code&amp;gt;. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be already applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches&amp;lt;/code&amp;gt;. Otherwise you need decide whether to rework such patch or if it concerns features you don&#039;t use, in which case you can remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb&amp;quot;&amp;lt;/code&amp;gt;. Note that applying some of the profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;Either&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
...&#039;&#039;OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-source --build .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder, usually at least the below:&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remember that the kernel is unsigned so you need to either disable secure-boot or sign it for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=287</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=287"/>
		<updated>2026-06-30T11:57:27Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: note on applying and reworking patches&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). This HowTo is intended mostly for folks that need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored.&lt;br /&gt;
If you want to try the very latest stable release, check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. In case of Sid and Experimental packages, it&#039;s usually more recommended to rebuild them with Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt; (see point 2) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&lt;br /&gt;
The examples below are based on 7.0~rcX versions, the instructions were also tested on 7.1 and should be mostly applicable to later mainline versions as well, at least in the near future.&lt;br /&gt;
The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;). Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the cloned repo&#039;s folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Sid&#039;s and Forky&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your suffix of Debian-release part of the package version. The suffix must be of the form &amp;lt;code&amp;gt;[a-z]+${SEQUENTIAL_NUMBER}&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;SEQUENTIAL_NUMBER&amp;lt;/code&amp;gt; must be increased each time you build the packages for a given upstream version. For example I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix for example as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; and then create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with the target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;. For example in case of &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${USER}@$(hostname)&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;(at this stage, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; usually cannot be used as &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; has not been generated yet)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; For new features testing purposes, it is often useful to be able to install several &amp;quot;rcX&amp;quot; kernel packages along each other, but by default, &amp;lt;code&amp;gt;~rcX&amp;lt;/code&amp;gt; part is not included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several builds of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you change your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with 7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from 7.0.x:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout debian/7.0/trixie-backports -- debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you cloned the repo with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt;, then get it using &amp;lt;code&amp;gt;curl&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.0/trixie-backports/debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Next, fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
uscan --download-current-version --vcs-export-uncompressed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally, extract the kernel source form the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; and &amp;quot;merge&amp;quot; it into the debianization:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
debian/rules orig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; and apply all the patches from &amp;lt;code&amp;gt;debian/patches&amp;lt;/code&amp;gt;. It may happen that some of the patches cannot be applied cleanly due to changes in the involved parts of the source code. Sometimes a patch may be applied in the latest upstream version (this is common situation for security patches), in which case you can simply remove it from &amp;lt;code&amp;gt;debian/patches&amp;lt;/code&amp;gt;. Otherwise you need decide whether to rework such patch or if it concerns features you don&#039;t use, in which case you can remove it also.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb&amp;quot;&amp;lt;/code&amp;gt;. Note that applying some of the profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;Either&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
...&#039;&#039;OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-source --build .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder, usually at least the below:&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remember that the kernel is unsigned so you need to either disable secure-boot or sign it for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=286</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=286"/>
		<updated>2026-06-29T11:07:40Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from the forum: note on debian/control generation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). This HowTo is intended mostly for folks that need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored.&lt;br /&gt;
If you want to try the very latest stable release, check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. In case of Sid and Experimental packages, it&#039;s usually more recommended to rebuild them with Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt; (see point 2) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&lt;br /&gt;
The examples below are based on 7.0~rcX versions, the instructions were also tested on 7.1 and should be mostly applicable to later mainline versions as well, at least in the near future.&lt;br /&gt;
The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;). Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the cloned repo&#039;s folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Sid&#039;s and Forky&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your suffix of Debian-release part of the package version. The suffix must be of the form &amp;lt;code&amp;gt;[a-z]+${SEQUENTIAL_NUMBER}&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;SEQUENTIAL_NUMBER&amp;lt;/code&amp;gt; must be increased each time you build the packages for a given upstream version. For example I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix for example as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; and then create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with the target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;. For example in case of &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${USER}@$(hostname)&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;(at this stage, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; usually cannot be used as &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; has not been generated yet)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; For new features testing purposes, it is often useful to be able to install several &amp;quot;rcX&amp;quot; kernel packages along each other, but by default, &amp;lt;code&amp;gt;~rcX&amp;lt;/code&amp;gt; part is not included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several builds of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you change your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with 7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from 7.0.x:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout debian/7.0/trixie-backports -- debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you cloned the repo with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt;, then get it using &amp;lt;code&amp;gt;curl&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.0/trixie-backports/debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Next, fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
uscan --download-current-version --vcs-export-uncompressed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally, extract the kernel source form the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; and &amp;quot;merge&amp;quot; it into the debianization:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
debian/rules orig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will also generate &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb&amp;quot;&amp;lt;/code&amp;gt;. Note that applying some of the profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;Either&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
...&#039;&#039;OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-source --build .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder, usually at least the below:&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remember that the kernel is unsigned so you need to either disable secure-boot or sign it for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=284</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=284"/>
		<updated>2026-06-24T08:58:24Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from forum after minor wording changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). This HowTo is intended mostly for folks that need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored.&lt;br /&gt;
If you want to try the very latest stable release, check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. In case of Sid and Experimental packages, it&#039;s usually more recommended to rebuild them with Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt; (see point 2) rather than pulling half of a system of dependencies from Sid.&lt;br /&gt;
&lt;br /&gt;
The examples below are based on 7.0~rcX versions, the instructions were also tested on 7.1 and should be mostly applicable to later mainline versions as well, at least in the near future.&lt;br /&gt;
The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;). Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the cloned repo&#039;s folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Sid&#039;s and Forky&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your suffix of Debian-release part of the package version. The suffix must be of the form &amp;lt;code&amp;gt;[a-z]+${SEQUENTIAL_NUMBER}&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;SEQUENTIAL_NUMBER&amp;lt;/code&amp;gt; must be increased each time you build the packages for a given upstream version. For example I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix for example as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; and then create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with the target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;. For example in case of &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${USER}@$(hostname)&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;(at this stage, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; usually cannot be used as &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; has not been generated yet)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; For new features testing purposes, it is often useful to be able to install several &amp;quot;rcX&amp;quot; kernel packages along each other, but by default, &amp;lt;code&amp;gt;~rcX&amp;lt;/code&amp;gt; part is not included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several builds of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you change your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with 7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from 7.0.x:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout debian/7.0/trixie-backports -- debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you cloned the repo with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt;, then get it using &amp;lt;code&amp;gt;curl&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.0/trixie-backports/debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Next, fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
uscan --download-current-version --vcs-export-uncompressed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally, extract the kernel source form the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; and &amp;quot;merge&amp;quot; it into the debianization:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
debian/rules orig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb&amp;quot;&amp;lt;/code&amp;gt;. Note that applying some of the profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;Either&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
...&#039;&#039;OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-source --build .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder, usually at least the below:&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remember that the kernel is unsigned so you need to either disable secure-boot or sign it for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=283</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=283"/>
		<updated>2026-06-24T05:07:33Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Re-import from forum after minor formatting changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). This HowTo is intended mostly for folks that need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored.&lt;br /&gt;
If you want to try the very latest stable release, check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. In case of Sid and Experimental, it&#039;s probably better to rebuild the packages with Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt; (see point 2) to avoid pulling half of a system of dependencies from Sid.&lt;br /&gt;
&lt;br /&gt;
The examples below are based on 7.0~rcX versions, the instructions were also tested on 7.1 and should be mostly applicable to later mainline versions as well, at least in the near future.&lt;br /&gt;
The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;). Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the cloned repo&#039;s folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Sid&#039;s and Forky&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your suffix of Debian-release part of the package version. The suffix must be of the form &amp;lt;code&amp;gt;[a-z]+${SEQUENTIAL_NUMBER}&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;SEQUENTIAL_NUMBER&amp;lt;/code&amp;gt; must be increased each time you build the packages for a given upstream version. For example I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix for example as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; and then create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with the target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;. For example in case of &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${USER}@$(hostname)&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;(at this stage, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; usually cannot be used as &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; has not been generated yet)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; For new features testing purposes, it is often useful to be able to install several &amp;quot;rcX&amp;quot; kernel packages along each other, but by default, &amp;lt;code&amp;gt;~rcX&amp;lt;/code&amp;gt; part is not included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several builds of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you change your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with 7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from 7.0.x:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout debian/7.0/trixie-backports -- debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you cloned the repo with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt;, then get it using &amp;lt;code&amp;gt;curl&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.0/trixie-backports/debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Next, fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
uscan --download-current-version --vcs-export-uncompressed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally, extract the kernel source form the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; and &amp;quot;merge&amp;quot; it into the debianization:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
debian/rules orig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb&amp;quot;&amp;lt;/code&amp;gt;. Note that applying some of the profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;Either&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
...&#039;&#039;OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-source --build .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
&lt;br /&gt;
Note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder, usually at least the below:&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remember that the kernel is unsigned so you need to either disable secure-boot or sign it for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=282</id>
		<title>HowTo build the latest mainline or rebuild Sid kernel packages for Trixie</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=HowTo_build_the_latest_mainline_or_rebuild_Sid_kernel_packages_for_Trixie&amp;diff=282"/>
		<updated>2026-06-24T03:13:08Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: Initial import&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In essence, this HowTo summarizes the invaluable insights from @Aki (from [https://forums.debian.net/viewtopic.php?p=841404#p841404 this thread]) and  @stevepusser (from [https://forums.debian.net/viewtopic.php?p=838594#p838594 this thread]) and the general info from [https://kernel-team.pages.debian.net/kernel-handbook the kernel handbook] (mainly chapter 4).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; A given moment&#039;s latest mainline kernel is usually not ready for a general use, especially during &amp;quot;rcX&amp;quot; versions as their names clearly suggest (&amp;quot;release candidate&amp;quot;). This HowTo is intended mostly for folks that need to post logs to LKML or bugzilla.kernel.org where discussions/questions/bug-reports regarding anything older than the latest mainline will almost always be ignored.&lt;br /&gt;
If you want to try the very latest stable release, check Debian&#039;s official [https://wiki.debian.org/Backports trixie-backports], [https://wiki.debian.org/DebianUnstable sid] and [https://wiki.debian.org/DebianExperimental experimental] suites (in that order) : the Kernel Team usually publishes packages just a few days after a tag is created in kernel.org&#039;s stable repo. In case of Sid and Experimental, it&#039;s probably better to rebuild the packages with Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt; (see point 2) to avoid pulling half of a system of dependencies from Sid.&lt;br /&gt;
&lt;br /&gt;
The examples below are based on 7.0~rcX versions, the instructions were also tested on 7.1 and should be mostly applicable to later mainline versions as well, at least in the near future.&lt;br /&gt;
The env var &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; used in some commands below refers to the primary architecture of your system (like &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt;), it can be exported for convenience with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export ARCH=&amp;quot;$(dpkg --print-architecture)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&amp;lt;li&amp;gt; Clone &amp;lt;code&amp;gt;debian/latest&amp;lt;/code&amp;gt; branch of the Linux kernel debianization from [https://salsa.debian.org/kernel-team/linux the Kernel Team&#039;s Salsa] (consider limiting history depth with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt; to reduce the transfer size from hundreds of MB even down to ~2MB in case of &amp;lt;code&amp;gt;--depth=1&amp;lt;/code&amp;gt;). Next, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the cloned repo&#039;s folder: all commands from the remaining points are supposed to be issued in that folder.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Replace &amp;lt;code&amp;gt;c_compiler&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; from Sid&#039;s and Forky&#039;s &amp;lt;code&amp;gt;gcc-15&amp;lt;/code&amp;gt; to Trixie&#039;s &amp;lt;code&amp;gt;gcc-14&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with v6.19, the build process by default does not produce &amp;lt;code&amp;gt;linux-image-${ABI}-*&amp;lt;/code&amp;gt;, which is generated by Debusine when signing a given kernel. The easiest way to produce all the usual packages, is to turn off &amp;lt;code&amp;gt;enable_signed&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; file (keeping it enabled won&#039;t sign your kernel automagically anyway: it only causes templates for Debusine to be produced).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Decide for your suffix of Debian-release part of the package version. The suffix must be of the form &amp;lt;code&amp;gt;[a-z]+${SEQUENTIAL_NUMBER}&amp;lt;/code&amp;gt; and the &amp;lt;code&amp;gt;SEQUENTIAL_NUMBER&amp;lt;/code&amp;gt; must be increased each time you build the packages for a given upstream version. For example I use &amp;lt;code&amp;gt;morgwai1&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;morgwai2&amp;lt;/code&amp;gt; and so on.&lt;br /&gt;
Export your suffix for example as &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; and then create a new entry in &amp;lt;code&amp;gt;debian/changelog&amp;lt;/code&amp;gt; for the desired upstream kernel version with the target suite set to &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt;. For example in case of &amp;lt;code&amp;gt;7.0~rc7&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat - debian/changelog &amp;gt;changelog-new &amp;lt;&amp;lt;EOF&lt;br /&gt;
linux (7.0~rc7-1~${VERSION_SUFFIX}) UNRELEASED; urgency=medium&lt;br /&gt;
&lt;br /&gt;
  * New upstream release candidate.&lt;br /&gt;
  * Packaging changes for Trixie.&lt;br /&gt;
&lt;br /&gt;
 -- $(getent passwd ${USER} |cut -d : -f 5 |cut -d , -f 1) &amp;lt;${USER}@$(hostname)&amp;gt;  $(date -R)&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
mv changelog-new debian/changelog&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&#039;&#039;(at this stage, &amp;lt;code&amp;gt;dch&amp;lt;/code&amp;gt; usually cannot be used as &amp;lt;code&amp;gt;debian/control&amp;lt;/code&amp;gt; has not been generated yet)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; ABI name management:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; For new features testing purposes, it is often useful to be able to install several &amp;quot;rcX&amp;quot; kernel packages along each other, but by default, &amp;lt;code&amp;gt;~rcX&amp;lt;/code&amp;gt; part is not included in the ABI name (and as a consequence neither in package names) of packages built for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite. To include it, remove &amp;lt;code&amp;gt;abi_version_full = false&amp;lt;/code&amp;gt; line from the &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[debianrelease]]&amp;lt;/code&amp;gt; section for &amp;lt;code&amp;gt;UNRELEASED&amp;lt;/code&amp;gt; suite in &amp;lt;code&amp;gt;debian/config/defines.toml&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; If you also want to be able to install along each other packages for several builds of the same upstream version, include your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;abi_suffix&amp;lt;/code&amp;gt; in the same section, for example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sed -e &amp;quot;s#abi_suffix = &#039;+unreleased&#039;#abi_suffix = &#039;+${VERSION_SUFFIX}&#039;#&amp;quot; debian/config/defines.toml &amp;gt;defines-new.toml&lt;br /&gt;
mv defines-new.toml debian/config/defines.toml&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unfortunately, you need to update it each time you change your &amp;lt;code&amp;gt;VERSION_SUFFIX&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; By default, packages for all feature-sets (the default and &amp;lt;code&amp;gt;rt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;cloud&amp;lt;/code&amp;gt;) and flavors (like &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;) are built, which is rarely needed, probably only by the maintainers when publishing the official packages. Of course it also causes the build to take n times longer. To disable unneeded feature-sets / flavors, edit &amp;lt;code&amp;gt;debian/config/${ARCH}/defines.toml&amp;lt;/code&amp;gt; and remove their corresponding &amp;lt;code&amp;gt;[&amp;lt;nowiki/&amp;gt;[flavour]]&amp;lt;/code&amp;gt; sections (usually at the top of a given file).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Starting with 7.1, &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt; uses a new format not supported by tools in Trixie, so replace it with the version from 7.0.x:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git checkout debian/7.0/trixie-backports -- debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you cloned the repo with &amp;lt;code&amp;gt;--depth&amp;lt;/code&amp;gt;, then get it using &amp;lt;code&amp;gt;curl&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;wget&amp;lt;/code&amp;gt; instead:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
wget -O debian/watch https://salsa.debian.org/kernel-team/linux/-/raw/debian/7.0/trixie-backports/debian/watch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Next, fetch the kernel sources from the kernel.org repo and create a corresponding &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; file in the parent folder:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
uscan --download-current-version --vcs-export-uncompressed&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note that the stable kernel tree sometimes lags with syncing &amp;quot;-rcX&amp;quot; tags from Linus, so soon after a creation of a such, you may need to use [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git his tree] instead in &amp;lt;code&amp;gt;debian/watch&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Finally, extract the kernel source form the &amp;lt;code&amp;gt;orig.tar.xz&amp;lt;/code&amp;gt; and &amp;quot;merge&amp;quot; it into the debianization:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
debian/rules orig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Several build profiles are defined, described in &amp;lt;code&amp;gt;debian/README.source&amp;lt;/code&amp;gt;. You almost certainly don&#039;t need &amp;quot;udeb&amp;quot; packages and most probably don&#039;t need packages with documentation, so consider at least &amp;lt;code&amp;gt;export DEB_BUILD_PROFILES=&amp;quot;nodoc noudeb&amp;quot;&amp;lt;/code&amp;gt;. Note that applying some of the profiles may modify your kernel config (for example &amp;lt;code&amp;gt;pkg.linux.nokerneldbg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pkg.linux.nokerneldbginfo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; At this point you are ready to start the build process using 1 of the standard Debian ways. &#039;&#039;Either&#039;&#039;:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt; install all the build deps and build binary packages directly on your system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get build-dep .&lt;br /&gt;
MAKEFLAGS=&amp;quot;-j$(nproc)&amp;quot; dpkg-buildpackage -b -nc -uc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Also check [https://forums.debian.net/viewtopic.php?t=165708 Aki&#039;s ccache guide])&lt;br /&gt;
&lt;br /&gt;
...&#039;&#039;OR&#039;&#039;:&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; build a source package first with&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-source --build .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...and then use for example [https://wiki.debian.org/sbuild sbuild] to build binary packages in a clean chroot-ed environment or build and publish them on [https://wiki.debian.org/OpenSuseBuildService OBS].&lt;br /&gt;
(note: if &amp;lt;code&amp;gt;dpkg-source&amp;lt;/code&amp;gt;  complains about leftover Python caches, just remove the &amp;lt;code&amp;gt; __pycache__&amp;lt;/code&amp;gt; folder it will point)&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
The build process may take from 10 minutes to several hours depending on your hardware. A fresh build (empty ccache) of the default amd64 feature-set of 7.1 takes about 1.5h on OBS.&lt;br /&gt;
&lt;br /&gt;
If for whatever reason you want to restart the build/configuration process from scratch, the command &amp;lt;code&amp;gt;debian/rules maintainerclean&amp;lt;/code&amp;gt; will delete all generated files and the kernel sources, leaving only the Salsa debianization (so you will need to re-run &amp;lt;code&amp;gt;debian/rules orig&amp;lt;/code&amp;gt;: useful when you want to build a new upstream version).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt; Install the packages built in the parent folder, usually at least the below:&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-base-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-binary-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-image-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-modules-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you intend to build any modules with &amp;lt;code&amp;gt;dkms&amp;lt;/code&amp;gt; (for example Nvidia drivers), then also these:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt install \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-${FLAVOR}&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-headers-7.*+&amp;quot;${VERSION_SUFFIX}-common&amp;quot;_*.deb \&lt;br /&gt;
  ../linux-kbuild-7.*+&amp;quot;${VERSION_SUFFIX}&amp;quot;_*.deb&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;FLAVOR&amp;lt;/code&amp;gt; on x86_64 machines is the same as &amp;lt;code&amp;gt;ARCH&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;), in case of ARM  it may be either &amp;lt;code&amp;gt;arm64&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;arm64-16k&amp;lt;/code&amp;gt;, depending on what was left in &amp;lt;code&amp;gt;debian/config/arm64/defines.toml&amp;lt;/code&amp;gt; in point 6.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Remember that the kernel is unsigned so you need to either disable secure-boot or sign it for example using &amp;lt;code&amp;gt;sbsign&amp;lt;/code&amp;gt;.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At this point your system should be ready to reboot to the new kernel.&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=File:HowTo-build-latest-mainline-kernel-packages-for-Trixie_v2.odt&amp;diff=281</id>
		<title>File:HowTo-build-latest-mainline-kernel-packages-for-Trixie v2.odt</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=File:HowTo-build-latest-mainline-kernel-packages-for-Trixie_v2.odt&amp;diff=281"/>
		<updated>2026-06-23T06:47:55Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
	<entry>
		<id>https://cache.forums.debian.net/index.php?title=Main_Page&amp;diff=280</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://cache.forums.debian.net/index.php?title=Main_Page&amp;diff=280"/>
		<updated>2026-06-23T06:23:16Z</updated>

		<summary type="html">&lt;p&gt;Morgwai: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Welcome to the Debian User Forum Cache. =&lt;br /&gt;
&lt;br /&gt;
This wiki is dedicated specific member solutions from the [https://forums.debian.net Debian User Forums] and not to be confused with the larger man style documentation driven official [https://wiki.debian.org Debian Project Wiki].&lt;br /&gt;
&lt;br /&gt;
Our works here are citable formats of some of our best threads, member contributions, guides, and information that can provide assistance on or offline. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== About ==&lt;br /&gt;
About:&lt;br /&gt;
* [[Debian Forums Cache:About|Debian Forums Cache]]&lt;br /&gt;
* [[Debian User Forums]]&lt;br /&gt;
* [[The Debian Project]]&lt;br /&gt;
* [[Forum jokes, lingo, and memorable quotes]]&lt;br /&gt;
&lt;br /&gt;
== Guides (reference) ==&lt;br /&gt;
&lt;br /&gt;
* [[Root, Sudo, and SU|Root, sudo, su, and su -]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Debian First Aid Kit]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Fonts and Themes in Cinnamon Desktop]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[To install Firefox from Mozilla repo|Installing Firefox from the Mozilla repository]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Security Hardening for Debian Users: Protecting Against Targeted Attacks]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== HowTo (guides) == &lt;br /&gt;
* [[MTR Network Diagnostics]]  &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[WiFi Signal Strength and Sharing]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[REFInd USB Drive (for emergency boot)]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Trixie iwd]] &amp;lt;small&amp;gt;(forum archive)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[Debian Live USB with Persistence]] &amp;lt;small&amp;gt;(full paper)&amp;lt;/small&amp;gt;&lt;br /&gt;
* [[HowTo build latest mainline kernel packages for Trixie]]&lt;br /&gt;
&lt;br /&gt;
== Licensing and Use ==&lt;br /&gt;
Licensing:&lt;br /&gt;
* [[Publish using CC International licencing and your Forum name]].&lt;br /&gt;
* [[Cache AI Use]]&lt;/div&gt;</summary>
		<author><name>Morgwai</name></author>
	</entry>
</feed>