Skip to content

Instantly share code, notes, and snippets.

@dword4
Created April 1, 2026 09:56
Show Gist options
  • Select an option

  • Save dword4/5ac4b625531241290d87201c232aebf4 to your computer and use it in GitHub Desktop.

Select an option

Save dword4/5ac4b625531241290d87201c232aebf4 to your computer and use it in GitHub Desktop.

Compiling Linux Kernel 6.18 on Slackware Linux 15 (x86_64)

Prerequisites

Before starting, ensure you have the necessary build tools installed. Slackware 15 includes most of these by default if you did a full installation. Verify the following are present:

  • gcc and g++
  • make
  • bc
  • flex
  • bison
  • libelf (part of the elfutils package)
  • openssl and openssl-devel headers
  • perl
  • ncurses-devel (only needed if you plan to run menuconfig later)

Check for a package with pkgtool or simply try the build — missing tools will cause the build to fail with clear error messages.


Step 1: Download the Kernel Source

Go to https://www.kernel.org and find the latest 6.18.x stable release. Download both the tarball and its PGP signature:

cd /usr/src
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.18.tar.xz
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.18.tar.sign

Note: Replace 6.18 with the latest point release (e.g., 6.18.3) as shown on kernel.org.


Step 2: Verify the Signature (Recommended)

The tarball on kernel.org is compressed; the .sign file covers the uncompressed tarball. Decompress first, then verify:

unxz linux-6.18.tar.xz
gpg --verify linux-6.18.tar.sign linux-6.18.tar

If GPG reports a missing key, fetch it:

gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys <KEY_ID>

The key ID will be shown in the GPG output. Trusted kernel signing keys belong to Linus Torvalds and Greg Kroah-Hartman.


Step 3: Extract the Source

tar xf linux-6.18.tar
cd linux-6.18

Step 4: Copy Your Current Kernel Configuration

Using your running kernel's config as the starting point is the safest approach. Slackware stores the config in /boot:

cp /boot/config-$(uname -r) .config

If that file does not exist, try extracting it from the running kernel (requires CONFIG_IKCONFIG_PROC=y in the old kernel):

zcat /proc/config.gz > .config

Step 5: Update the Config Without Interactive Prompts

Rather than make oldconfig (which asks about every new option), use olddefconfig. This silently sets all new configuration options to their upstream default values — no prompting required:

make olddefconfig

This will update .config to account for any new options introduced since your previous kernel version while keeping all your existing settings intact.


Step 6: Compile the Kernel

Use all available CPU cores to speed up the build. The -j flag sets the number of parallel jobs:

make -j$(nproc)

This step takes the most time. On a modern multi-core machine expect anywhere from a few minutes to half an hour depending on hardware.


Step 7: Install the Kernel Modules

make modules_install

This installs the compiled modules into /lib/modules/6.18.0/ (or whichever version string the kernel reports).


Step 8: Copy the Kernel Image and System Map

Copy the kernel image and the symbol map to /boot regardless of which bootloader you are using:

cp arch/x86/boot/bzImage /boot/vmlinuz-6.18
cp System.map /boot/System.map-6.18

Optionally update the convenience symlinks that bootloader scripts expect:

ln -sf /boot/vmlinuz-6.18 /boot/vmlinuz
ln -sf /boot/System.map-6.18 /boot/System.map

Step 9: Copy the Kernel Config (Optional but Recommended)

Saving the config to /boot makes it easy to use as a base for future builds:

cp .config /boot/config-6.18

Step 10: Install the Kernel — LILO or ELILO

Follow the section that matches your system. If you are unsure which bootloader you have, check whether your system booted in EFI mode:

ls /sys/firmware/efi

If that directory exists, your system is using EFI and you should follow the ELILO section. If the directory is absent, follow LILO.


Step 10a: Update LILO (BIOS/legacy boot)

Edit /etc/lilo.conf to add an entry for the new kernel. Add it alongside (not replacing) your existing entry so you can fall back if needed:

image = /boot/vmlinuz-6.18
  root = /dev/sda1
  label = Linux-6.18
  read-only

Important: Adjust root = /dev/sda1 to match your actual root partition. Check your existing entries in lilo.conf for reference.

After editing, run LILO to write the new bootloader configuration:

lilo

LILO should print the names of each configured boot entry. If it exits cleanly, the bootloader has been updated. Continue to Step 11.


Step 10b: Update ELILO (EFI/VM with EFI firmware)

ELILO is the EFI counterpart to LILO and is what Slackware uses on EFI systems, including virtual machines configured with EFI firmware (e.g., VMware, VirtualBox, or QEMU/KVM with OVMF).

Confirm the EFI System Partition is mounted

The EFI System Partition (ESP) is typically mounted at /boot/efi. Verify it is mounted:

mount | grep efi

If it is not mounted, mount it manually (adjust the device as needed — check lsblk or /etc/fstab for your ESP device):

mount /dev/sda1 /boot/efi

Locate the ELILO directory

Slackware's ELILO files live under the ESP at:

/boot/efi/EFI/Slackware/

Confirm this path exists:

ls /boot/efi/EFI/Slackware/

You should see at minimum elilo.efi and elilo.conf.

Copy the kernel to the ESP

ELILO needs the kernel image directly on the EFI partition:

cp /boot/vmlinuz-6.18 /boot/efi/EFI/Slackware/vmlinuz-6.18

Edit elilo.conf

Open /boot/efi/EFI/Slackware/elilo.conf in a text editor and add a new entry for the 6.18 kernel. Add it alongside the existing entry, not replacing it:

image=vmlinuz-6.18
  label=Linux-6.18
  root=/dev/sda2
  read-only
  append="quiet"

A minimal elilo.conf with both the old and new entries might look like this:

prompt
timeout=50
default=Linux-6.18

image=vmlinuz-6.18
  label=Linux-6.18
  root=/dev/sda2
  read-only

image=vmlinuz
  label=Linux-previous
  root=/dev/sda2
  read-only

Important: Adjust root=/dev/sda2 to match your actual root partition. The image= path is relative to the directory containing elilo.conf on the ESP — do not use a full filesystem path here.

Run elilo to register the bootloader

elilo

This writes the updated configuration. If elilo is not in your PATH, it may be at /usr/sbin/elilo.


Step 11: Reboot

reboot
  • LILO systems: At the LILO prompt, select the Linux-6.18 entry (or wait for the default).
  • ELILO/EFI systems: The EFI firmware boot menu should present the Linux-6.18 label, or ELILO will boot the default entry after the timeout.

Once booted, verify the running kernel version:

uname -r

This should report 6.18.0 (or the point release you compiled).


Troubleshooting Tips

  • Missing kernel modules at boot: Check that make modules_install completed without errors and that /lib/modules/6.18.0/ exists with content.
  • LILO reports errors: Double-check partition names and file paths in /etc/lilo.conf. Remember to re-run lilo after any edit.
  • ELILO: kernel not found: Ensure the kernel image was copied to the ESP (/boot/efi/EFI/Slackware/) and that the image= name in elilo.conf matches the copied filename exactly.
  • ELILO: ESP not mounted at boot: Add the ESP to /etc/fstab so it mounts automatically. A typical fstab entry looks like: UUID=<esp-uuid> /boot/efi vfat defaults 0 2. Find the UUID with blkid.
  • Build fails on a header: Install the missing -devel package via Slackware's package tools or from the original installation media (slackpkg if configured, or manual installpkg).
  • Kernel panics at boot: Reboot and select your previous kernel entry from the LILO or ELILO menu to recover.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment