The Linux Kernel

This is just a tutorial on building the Linux kernel manually, and I provide a config for it. The config has drivers for a very broad range of systems, and it also includes VFIO, IOMMU, and EFI. It works wonderfully on Ryzen, and I saw a performance boost on an older i3 system as well. It works for me on a core2 duo machine, but ymmv.

First, grab my config and the Linux source

sudo -s;
cd /usr/src;
wget https://absurd.wtf/config.xz;
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.12.11.tar.xz

Next, you will need to decompress both. You can, of course, use the Linux Libre kernel sources. During the compile, you will notice quite a number of deblobbing messages.

xz -d < linux-4.12.11.tar.xz | tar xv;
xz -d < config.xz > linux-4.12.11/.config

With both the kernel source and the config decompressed, we are ready to start the build process. Replace "16" with the total thread count of your CPU.

cd linux-4.12.11;
make oldconfig;
make -j16;
make headers_install && make -j16 modules_install;
cp -v arch/x86_64/boot/bzImage /boot/vmlinuz-4.12.11;
cp -v System.map /boot/System.map-4.12.11;
cp -v .config /boot/config-4.12.11;
install -d /usr/share/doc/linux-4.12.11;
rm /usr/src/linux && ln -s /usr/src/linux-4.12.11 /usr/src/linux;
rm /boot/vmlinuz && ln -s /boot/vmlinuz-4.12.11 /boot/vmlinuz;
rm /boot/System.map && ln -s /boot/System.map-4.12.11 /boot/System.map;
rm /boot/config && ln -s /boot/config-4.12.11 /boot/config;

At this point, you need to go ahead and run whatever bootloader installation you use. I use efibootmgr. If you are using an Intel CPU, replace amd_iommu with intel_iommu. If your system is a very early USB3 system, you will probably want to use iommu=soft. If you are pre-USB3, you will probably want to drop the option entirely. If you use opensource video drivers, drop the nomodeset.

cp /boot/vmlinuz-4.12.11 /boot/efi/EFI/linux-4.12.11;
efibootmgr -c -L "Linux 4.12.11" -d /dev/nvme0n1 -p 1 -l '\linux-4.12.11' -u "root=/dev/nvme0n1p2 nomodeset amd_iommu=on";

At this point, cross your fingers, reboot, and pray :)


© MMIX - MMXVII absurd.wtf
Licentiam Absurdum