Thursday, September 18, 2025

Slackware Kernel Compilation for Dummies

Slackware 15 is getting a little long in the tooth, so I decided to upgrade to the latest kernel in the Slackware-current branch. This makes it easier because I can avoid many of the kernel compilation pain points. Here's what I did:

  1. Download the latest Slackware-current kernel source. I did it this way:
    lftp -c "open https://slackware.osuosl.org/slackware64-current/source ; mirror k"

  2. Go into the "k" directory it created and untar the kernel source

  3. Copy the config you need from ../kernel-configs to the "k" directory and rename it .config

  4. Run "make olddefconfig"

  5. Run "make -j 12" Change the 12 to whatever cores you have available on your CPU. The command nproc will tell you.

  6. Go watch the baseball game while it compiles.

  7. Run "make modules_install"

  8. Copy the new kernel to the Slackware efi directory (replace the x.x.x with the kernel revision numbers):

    cp arch/x86/boot/bzImage /boot/efi/EFI/Slackware/vmlinuz-x.x.x

  9. Back up the existing initrd,gz in the /boot directory

  10. Make a new initrd this way (replace the /dev/nvme0n1p2 with whatever your root partition is):

    mkinitrd -c -k x.x.x -m ext4 -f ext4 -r /dev/nvme0n1p2

  11. I change the name of the new initrd,gz to initrd-x.x.x.gz to tell them apart.

  12. Copy the new initrd to the /boot/efi/EFI/Slackware directory

  13. Edit the elilo.conf file with the new kernel info

  14. Profit!