Linux Kernel 4.19


For those individuals using Linux distributions that ship with older kernels, they may find themselves needing a newer kernel for hardware support, and not having a package available. Never fear. In this document, I will be using 4.19.21, but you will want to use the latest available 4.19 series kernel. I am also assuming that you are doing this as root, or at least within a sudo -s session. If you choose to use Linux 4.20.x I do have a config for that as well. Grab the latest from the 4.20 branch and my Linux 4.20.x configuration.

First, let's get the source:

cd /usr/src/
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.21.tar.xz
wget https://absurd.wtf/files/firmware-4.19.tar.xz
wget https://absurd.wtf/files/config-4.19.xz

Next we need to unpack it all:

tar xf linux-4.19.21.tar.xz
tar xf firmware-4.19.tar.xz
xz -d < config-4.19.xz > config-4.19

After that point, you should see two new directories in /usr/src. One should be named linux-4.19.21 and the other should be named firmware. Let's go ahead and do the following:

rm -f /usr/src/linux && ln -s /usr/src/linux-4.19.21 /usr/src/linux
mv /lib/firmware /lib/firmware.old && mv /usr/src/firmware/lib/firmware /lib/
cd /usr/src/linux
make mrproper
cp ../config-4.19 .config
make oldconfig

At this point, the next command changes based upon the number of CPU threads you have. I have 16 cores and 32 threads, so I use 32 in the command. You need to adjust that to what you have available.

make -j32 && make -j32 modules_install && make headers_install

Assuming that nothing went wrong, you will end up back at the prompt. We now need to move things into place.

cp -v arch/x86_64/boot/bzImage /boot/vmlinuz-4.19.21
cp -v System.map /boot/System.map-4.19.21
cp -v .config /boot/config-4.19.21
rm -v /usr/src/linux && ln -sv /usr/src/linux-4.19.21 /usr/src/linux
rm -v /boot/vmlinuz && ln -sv /boot/vmlinuz-4.19.21 /boot/vmlinuz
rm -v /boot/System.map && ln -sv /boot/System.map-4.19.21 /boot/System.map
rm -v /boot/config && ln -sv /boot/config-4.19.21 /boot/config

If you are not using EFI, you would know perform either a lilo or grub update. If you are using EFI, you can do the following. It should be noted that these are options that I use. You need to replace nvme1n1 with your block device for boot. You EFI disk should remain -p 1 for most configurations. The nvme1n1p2 should also be changed to reflect wherever your root fs is. I use a ThreadRipper so I enable amd_iommu. The nomodeset is present for my NVIDIA card, since I use the proprietary driver. If you are using a modesetting driver or the AMD Mesa drivers, remove that option.

cp -v /boot/vmlinuz-4.19.21 /boot/efi/linux-4.19.21
efibootmgr -c -d /dev/nvme1n1 -p 1 -L "Linux 4.19.21" -l '\linux-4.19.21' -u "root=/dev/nvme1n1p2 amd_iommu=on nomodeset"

Now, cross your fingers and reboot!