<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tuzu</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tuzu"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Tuzu"/>
	<updated>2026-05-01T23:36:22Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How_to_build_the_Alpine_Linux_kernel&amp;diff=29781</id>
		<title>How to build the Alpine Linux kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How_to_build_the_Alpine_Linux_kernel&amp;diff=29781"/>
		<updated>2025-05-05T07:02:11Z</updated>

		<summary type="html">&lt;p&gt;Tuzu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== How to build the Alpine Linux kernel ==&lt;br /&gt;
&lt;br /&gt;
This [[Tutorials and Howtos|Howto]] quickly demonstrates building/compiling the default Alpine Linux [[Kernels|kernels]] &amp;quot;LTS&amp;quot; and &amp;quot;virt&amp;quot;. Alpine kernels extend the standard [https://www.kernel.org/linux.html Linux kernel] and build within a few minutes to a few hours (depending on the speed of your system) using &amp;lt;code&amp;gt;[[abuild]]&amp;lt;/code&amp;gt;, [https://gitlab.alpinelinux.org/alpine/aports aports], and [https://pkgs.alpinelinux.org/package/edge/main/x86_64/alpine-sdk alpine-sdk].&lt;br /&gt;
&lt;br /&gt;
Kernel customizations (not covered here) allow you to experiment by adding/removing kernel modules/features. Alpine releases multiple [https://alpinelinux.org/downloads/ downloads] which contain kernels that vary in features and file sizes.&lt;br /&gt;
&lt;br /&gt;
== Before you start ==&lt;br /&gt;
A running instance of Alpine Linux and a non-root user with [https://pkgs.alpinelinux.org/package/edge/main/x86_64/doas doas] privileges (i.e. sudo, wheel group) are required to use &amp;lt;code&amp;gt;[[abuild]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Build &amp;amp; install the kernel ==&lt;br /&gt;
&lt;br /&gt;
=== Build ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
doas apk add alpine-sdk&lt;br /&gt;
doas addgroup USERNAME abuild         # your non-root user&lt;br /&gt;
&lt;br /&gt;
git clone --depth 1 https://gitlab.alpinelinux.org/alpine/aports.git&lt;br /&gt;
abuild-keygen --append --install&lt;br /&gt;
doas chmod a+r /etc/apk/keys/*        # ensure new keys are readable&lt;br /&gt;
&lt;br /&gt;
cd aports/main/linux-lts/&lt;br /&gt;
time abuild -crK&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Identify backup ===&lt;br /&gt;
&lt;br /&gt;
Identify the package name of your current kernel (e.g. linux-lts, linux-virt). This example shows that &#039;&#039;&#039;linux-lts&#039;&#039;&#039; is the current package that we would revert to as a backup.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;kernel: $(uname -r)&amp;quot;&lt;br /&gt;
apk list --installed &amp;quot;linux-*&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Alpine-kernel-package2.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Install ===&lt;br /&gt;
Find the newly-built kernel file to install. This example shows how to install a newly-built x86_64 LTS kernel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ls -r ~/packages/main/*&lt;br /&gt;
doas apk add FILENAME&lt;br /&gt;
doas reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Alpine-kernel-install.png|600px]]&lt;br /&gt;
&lt;br /&gt;
After rebooting, verify the newly-installed kernel version:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;kernel: $(uname -r)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Alpine-kernel-new.png|320px]]&lt;br /&gt;
&lt;br /&gt;
=== Revert ===&lt;br /&gt;
If needed, revert to the previous backup kernel package we identified earlier. This example shows how to revert to the previous &amp;quot;alpine-lts&amp;quot; package after removing the newly-installed &amp;quot;alpine-lts&amp;quot; (both are named &amp;quot;alpine-lts&amp;quot; yet refer to different versions/locations):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apk list linux-lts            # newly-compiled kernel installed&lt;br /&gt;
doas apk del linux-lts        # newly-compiled kernel from file&lt;br /&gt;
doas apk add linux-lts        # previous kernel from Alpine repo&lt;br /&gt;
apk list linux-lts            # previous kernel installed&lt;br /&gt;
doas reboot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Alpine-kernel-revert.png|465px]]&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* [[Kernels]]&lt;br /&gt;
* [[Custom Kernel|Custom Kernel (2018-present)]]&lt;/div&gt;</summary>
		<author><name>Tuzu</name></author>
	</entry>
</feed>