Hi! I was wondering if anyone could help me find where to obtain the source code for kernel driver modules (specifically sdhci-pci*.c).
I have the kernel source rpm but the drivers are not included.
kernel-4.18.0-553.61.1.el8_10.src.rpm
The devel packages contain the header files, but not the c source, and I’ve been looking all over trying to figure out where I might find the source that matches the AlmaLinux8.10/RHEL8.10 kernel. Or, is GIT for the sdchi-pci-core.c file the only place to get this? (And, does anyone know if the sdchi-pci-core.c compiles to produce the sdhci-pci.ko.xz in the actual drivers directory?)
I have a need to make a mod to the SD Card reader clock speed, and this has been killing me.
Thanks!
Yes, the source code for kernel driver modules like sdhci-pci*.c is included in the kernel source RPM, but you have to prepare the full source tree for your kernel version by running the RPM build preparation step.
Here’s how you can extract it for AlmaLinux/RHEL 8.10 (kernel-4.18.0-553.61.1.el8_10):
-
Install the SRPM:
rpm -ivh kernel-4.18.0-553.61.1.el8_10.src.rpm
-
Prepare the sources:
cd ~/rpmbuild/SPECS
rpmbuild -bp --target=$(uname -m) kernel.spec
-
After that, you will find all the driver source files (including sdhci-pci-core.c, etc.) in:
~/rpmbuild/BUILD/kernel-/linux-/drivers/mmc/host/
And yes, sdhci-pci-core.c is compiled as part of the sdhci-pci.ko module in the kernel.
You don’t need to use the upstream git; the full, patched sources as shipped by Red Hat/Alma are there once you do the steps above.
Hope this helps!
Thank you SO much for that help. I was also missing a ton of deps, but they installed easily.
I’m new to kernel mods, so I had no clue I needed that rpmbuild step.
1 Like