<?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-09-10T14:51:53Z</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=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>