This short note covers the installation of kernel modules in Fedora distributions. This procedure can be used to add kernel modules that are not included in the Fedora stock kernel, as well as to build modules in the kernel tree during the development process for this distribution.
The installation procedure is described on the example of CAN bus modules and the Fedora 22 distribution.
Before starting the installation, it is recommended to update the system:
sudo dnf update reboot
RPM Development Tools are used to build the kernel. The RPM package build tree (~ / rpmbuild /) is created by the command:
rpmdev-setuptree
Further kernel sources are downloaded:
dnf download --source kernel
Installs dependencies to build the kernel package:
sudo dnf builddep kernel-4.1.6-200.fc22.src.rpm
The kernel package is installed in the RPM tree:
rpm -Uvh kernel-4.1.6-200.fc20.src.rpm
The actual kernel is created (patches are rolled in, etc.):
cd ~/rpmbuild/SPECS rpmbuild -bp --target=$(uname -m) kernel.spec
In the actual kernel, you must specify EXTRAVERSION by uname -r of the current kernel:
cd ~/rpmbuild/BUILD/kernel-4.1.fc22/linux-4.1.6-200.fc22.i686 gedit Makefile .. EXTRAVERSION = -200.fc22.i686 ..
Now you can copy the configuration of the current kernel and include the required modules:
cp /boot/config-4.1.6-200.fc22.i686 .config make menuconfig
Assembly of CAN bus modules:
make modules_prepare make M=net/can modules make M=drivers/net/can modules
Installation:
sudo make M=net/can modules_install sudo make M=drivers/net/can modules_install sudo depmod -a sudo modprobe can