Download the Fedora kernel package and the linux sources, configure them and create the RPM package.
$ fedpkg clone kernel
$ dnf download --source kernel
Switch to your desired branch
$ fedpkg switch-branch f31
Get the stable version of the kernel:
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
~$ cp kernel/kernel-x86_64-fedora.config linux-stable/.config
Menuconfig is a nice way to configure the kernel.
$ cd linux-stable
linux-stable $ make menuconfig
linux-stable $ make -j 4 bzImage && make -j 4 modules && mane modules_install
linux-stable $ cp .config ../kernel/kernel-x86_64-fedora.config
linux-stable $ git archive --format=tar.gz --prefix=linux-5.7.001 -o ../linux-5.7.001.tar.gz v5.7.001
linux-stable $ cp ../linux-5.7.001.tar.gz ~/rpmbuild/SOURCES/
Edit the kernel.spec
file:
...
%global baserelease rc7
...
%define base_sublevel 7
...
%define stable_update 0
...
%define rpmversion 5.%{upstream_sublevel}.0.imcsk8
...
%define buildid .local
...
kernel $ sudo dnf install -y audit-libs-devel binutils-devel java-devel libcap-devel libcap-ng-devel llvm-toolset net-too
ls newt-devel numactl-devel pciutils-devel perl perl-devel python3-devel python3-docutils xmlto xz-devel elfutils-devel
kernel $ cp -rp * ~/rpmbuild/SOURCES/
kernel $ rpmbuild --define='fedora 31' --define='dist .fc31' --without debug --target x86_64 -ba kernel.spec 2>&1 | tee
build.log
There might be some patches that don't apply, just comment them in the kernel.spec file
In this example, we will create a wl-kmod package for a broadcom wireless card.
~# dnf install -y akmod-wl broadcom-wl
~$ dnf download --source kmod-wl
~$ rpm -Uvh kmod-wl