Automating The Preparation Of Kernel Sources

Home » CentOS » Automating The Preparation Of Kernel Sources
CentOS 3 Comments

I have a driver that requires installing the kernel sources (into my own rpmbuild tree, not the system) prior to compiling. I followed the info for CentOS6 here:

http://wiki.CentOS.org/HowTos/I_need_the_Kernel_Source#head-a8dae925eec15786df9f6f8c918eff16bf67be0d

I can successfully compile and install the module from tarball after manually prepping the kernel sources, but I need to turn this into a proper RPM and am wondering if there are macros I’m not seeing for how to prep the kernel sources as part of a %prep or %build phase. I have looked at many real-world spec files and googled all afternoon and cannot find any info on this. As this will ultimately be a mock build, having to go into the mock shell and manually prep the sources would be a PITA. Am I looking for something that doesn’t exist?

Thanks for any suggestions you might have!

3 thoughts on - Automating The Preparation Of Kernel Sources

  • Seems quite recursive to me. I would have to list the source rpm for the various kernels which means I would be bundling a src.rpm into the driver’s src.rpm as well as calling rpmbuild itself from within a spec file. This would be the RPM way of doing it, at least (I do need to generate/distribute the src.rpm for the driver). Short of any rpm-specific way of solving the “my spec file relies on real kernel sources”, I’ll probably have make a kernel-sources RPM (not source RPM) that actually installs somewhere other than $HOME and use that RPM as a buildrequire in place of kernel-devel, which is insufficient for my need.