Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This is the first time I am working on Fedora. I will be writing some device drivers.

I understand that for proper compilation of the driver I must have the same source code as that of the running kernel.

In Ubuntu I used to do this using apt-get. But this is not working in Fedora, so how do I download this?

share|improve this question
    
Is there any reason you aren't downloading the kernel source directly, and compiling that? You can checkout the specific version, and use the Fedora specific config file from your /boot directory. –  AsheeshR May 3 at 12:06
1  
fedoraproject.org/wiki/Building_a_custom_kernel ... Haven't tried that, found via Google for fedora kernel source, first result. –  derobert May 3 at 12:19

1 Answer 1

To download the source for the Linux kernel on a Red Hat based distro you'll need to use the tool yum. This is equivalent to apt-get. This tool needs to either be run using sudo or to become the root user on the box.

$ yum install kernel-devel kernel-tools kernel-headers

The source will be installed here:

$ ls -l /usr/src/kernels/$(uname -r)

Where uname -r is the version of the kernel + architecture that you're using:

$ uname -r
3.13.9-100.fc19.x86_64

This is the source for kernel version 3.13.9. The point release (the Fedora project adds patches to their kernel) which is represented by the -100. The architecture is x86_64, i.e. 64-bit.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.