[CentOS] Automating the preparation of kernel sources

Tue Aug 5 01:24:48 UTC 2014
BC <centoslistmail at gmail.com>

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!