Fedora Core 5 Section 8.7 should state that you DO need to install the kernel-devel package to create /usr/src/kernels using :- su -c 'yum install kernel-devel' (this should really be installed when the devel package is selected on install) ------ Current ----- 8.7. Building Only Kernel Modules An exploded source tree is not required to build a kernel module, such as your own device driver, against the currently in-use kernel. For example, to build the foo.ko module, create the following Makefile in the directory containing the foo.c file:
There are actually at least 4 use cases to cover: 1) All I need is to compile a 3rd-party module: The easiest way is to install the "kernel-devel" RPM and then point make(1) to the infrastructure that provides: # cd /path/to/new/module # make -C /lib/module/$(uname -r)/build M=$PWD modules # make -C /lib/module/$(uname -r)/build M=$PWD modules_install is often sufficient. 2) I need to work with same kernel sources as the distro, perhaps to debug a crash: Install the "kernel-devel" RPM. In "/usr/src/kernels/$(uname -r)" find a fully-configured kernel source tree with only those sources used for the FCn kernel. Sources for features not supported by the Fedora project, such as NTFS, are not currently provided in this RPM. This RPM is also useful to build a new Fedora kernel with some configuration parameters altered. To compile a 3rd-party driver using these files, use a make(1) command similar to: # make -C /usr/src/kernels/$(uname -r) M=$PWD modules # make -C /usr/src/kernels/$(uname -r) M=$PWD modules_install 3)I want to use a feature not supported by Fedora, or, I want to see full kernel sources for the current distribution. Install the "kernel-${version}-${release}.src.rpm" RPM. Sources for the plain kernel, the Xen kernels, and the vanilla kernel will be installed in "${RPMROOT}/BUILD/kernel-${version}". To build a 3rd-party driver, use a make(1) command similar to: # make -C ${RPMROOT}/BUILD/kernel-${version}/linux-${version} M=$PWD modules # make -C ${RPMROOT}/BUILD/kernel-${version}/linux-${version} M=$PWD modules_install 4) I have a textbook about kernel programming and I want to follow the examples. Install the "kernel-${release}-${version}.src.rpm" RPM as explained above. Then move the desired sources into "/usr/src/linux-$(uname -r)" like this: # cd ${RPMROOT}/BUILD/kernel-${version} # mv linux-${version} /usr/src/linux-$(uname -r) # cd /usr/src/ # ln -s ./linux-$(uname -r) linux # cd /usr/src/linux
Don't shoot me. I didn't package kernel sources in all these variations ;-)
Thank you for your feedback. I have added more information and instructions to http://fedoraproject.org/wiki/Docs/Beats/Kernel. These will be available as an errata and on subsequent release notes published.