Kernel Modules (kmod)

I am familiar with the process to build a kernel module on x86 UNIX/Linux platforms and have questions regarding how to begin with Rocky 9.2 on AltArch (Raspberry Pi 4)

Codeready rpms are not available nor is there a CRB enabled repository.

The build process crashes out with stdarg.h not found.

[root@highroller aarch64-rl9-raspi]# make
make: [Makefile:7: all] Error 1 (ignored)
make[1]: Entering directory ‘/usr/src/kernels/6.1.31-v8.1.el9.altarch’
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
You are using: gcc (GCC) 11.3.1 20221121 (Red Hat 11.3.1-4)
CC [M] /home/jo…/…Kernel/aarch64-rl9-raspi/thor.o
In file included from /home/jo…/…/Kernel/aarch64-rl9-raspi/controller.h:4,
from /home/jo…/…/Kernel/aarch64-rl9-raspi/thor.c:11:
/home/jo…/…/Kernel/aarch64-rl9-raspi/logger.h:5:10: fatal error: stdarg.h: No such file or directory
5 | #include <stdarg.h>
| ^~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/ /home/jo…/…/Kernel/aarch64-rl9-raspi/thor.o] Error 1
make[1]: *** [Makefile:2012: /home/jo…/…/Kernel/aarch64-rl9-raspi] Error 2
make[1]: Leaving directory ‘/usr/src/kernels/6.1.31-v8.1.el9.altarch’
make: *** [Makefile:9: all] Error 2

There is a crb repository. It is not enabled by default. You can enable it by running dnf config-manager --enable crb.

Compiling a kernel manually is not recommended, even for a raspberry pi. It is recommended to take the source RPM, unpack it, make your changes, pack it back to a new source RPM, and then build via mock, for example mock -r rocky-9-x86_64 /home/myuser/rpmbuild/SRPMS/some-package.src.rpm.

[root@highroller aarch64-rl9-raspi]# dnf config-manager --enable crb

Updating Subscription Management repositories.

This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.

[root@highroller aarch64-rl9-raspi]#

I’ve been compiling kernels from 1994 on x86, DEC and ARM platforms, I’d like to think I am okay. I will look into ‘mock.’ This rpm is built from source C files using ddiskit, available on github, to take the source and use gcc to build a kernel module that is packaged in a binary rpm. Source RPM is available in the spec yet I don’t care to build a SRPM as the codebase is export controlled. GitHub - orosp/ddiskit

Available on the Red Hat catalog, Red Hat Ecosystem Catalog