Labeling a Linux Kernel RPM

You can use the Kernel build system to make your own RPMs using the the target:

make rpm-pkg

Before we build ours, we use a cached copy of our config which we copy to .config and run

make -j$(nproc) oldconfig

as that builds only the modules we want (avoiding some that tend to break) and picks up any code we are doing in house.

I tend to run it with all the cpus on my system:

time make -j$(nproc)  rpm-pkg

Last week, I was working with another developer to build some customer Kernels that were testing different options. One thing his team wanted to test was what would happen if we switched the HZ (scheduler) value from 100 to 1000. Building a Kernel with this option is fairly trivial: we use make menuconfig to set the value we wanted and rebuilt. However, since the testing was going to need to compare to a baseline, we wanted to clearly label our Kernels. To do so, we modified the top level Makefile.

[ayoung@eng14sys-r111 linux]$ git diff Makefile
diff --git a/Makefile b/Makefile
index 7d5b0bfe7960..9e2d339f97d2 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 5
 PATCHLEVEL = 18
 SUBLEVEL = 0
-EXTRAVERSION =
+EXTRAVERSION =-1000-hz
 NAME = Superb Owl

With this change, we ended up with RPM files like this one:

kernel-5.18.0_1000_hz+-1.aarch64.rpm

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.