简体   繁体   中英

kernel source code location in linux

I am working in Windows and running fedora through VMware.

By default, the kernel source tree should be in usr/src/ directory. Instead I could find only an empty directory called kernels. The actual source code is missing there.

When browsing I thought it might be in other directories like /boot . But I couldn't find source tree there as well.

I need to modify system call tables for which I should be able to access those source codes.

Kernel source is not installed by default. You can follow eg the instructions here to install the source and build your kernel.

You probably need to install the kernel-devel package.

On Fedora, all of the software is managed through a system called the Red Hat Package Manager ( RPM ). Every file (other than user data and other transient files like logs and such) is "owned" by a package. The ls command is from coreutils , the kernel is probably from kernel and BZFlag (the greatest Linux game ever) is provided by the bzflag package.

In the good old days, you would try to install software by using the rpm command (type " man rpm " for more information) and giving it the path to an RPM file that you had downloaded. The rpm command would then dutifully respond by informing you that you first need to satisfy 33 prerequisites. Then you would go download those 33 prerequisites and try to install them, only to find that each of those had their own prerequisites. And so on.

These days, Fedora has a nice set of online repositories of packages (and you can add others for third party software), and a program called yum that can download databases of all the packages, and you tell yum "install package foo for me" (by typing something like " yum install kernel-devel ") and it goes and figures out that in order to install that package, you need a bunch of other prerequisite packages, and so on. It then automatically downloads and installs everything you need, and away you go. For more information on the various incantations that make yum go, see " man yum ").

You might only need kernel-headers, depending what exactly it is you are doing, building drivers normally only requires the headers.

I found this page which may be of use to you Complete Fedora Kernel Headers It mentions that the 'kernel-devel' package doesn't include everything. (that would be just too simple!) It also tells you exactly how to use the rpm package handler.

You can, (I have tried this years ago, although I use Gentoo now), just download an archive from kernel.org and unpack it in /usr/src, but then you would have a 'vanilla' kernel without the Fedora patches.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM