I need two files from the Linux kernel's source code, which I deleted by mistake:
Option.c
usb-wwan.h
I searched using these commands, but did not find them:
find -name Option.c
find -name usb-wwan.h
How can I get these files? (I do have access to an Ubuntu 12.04 installation disk.)
Obtaining Linux's Sources (For Ubuntu's Downstream Kernel)
You obtained the kernel sources somehow. You should redownload them, or redo whatever you did to get them.
In particular, if you're running Ubuntu 12.04, and either you don't know how you got your kernel sources or you got them by installing a package whose name starts with
linux-source
, then you can put back any deleted file by completely reinstalling the package:(Please note that it is intentional that
linux-source-3.2.0
appears twice in the first command, which removes the manually extracted source directory, if any.)linux-source
(with no version number in the name) installed, so that you keep getting the source code for new kernels as they become available. But reinstallinglinux-source
with the above method will not replace missing files, aslinux-source
is just a metapackage that always depends on the most recent versionedlinux-source-
package in your Ubuntu release.Searching For Files By Name In Kernel Sources
Now you should have the missing files, so search for them:
Please note that I've used the
-iname
option, which performs case-insensitive matching. (Option.c
, with a capitalO
, is a somewhat unlikely name for a source file in the Linux kernel's sources.)The output will look like:
Please note that these files are from Ubuntu's downstream kernel, patched (i.e., modified) specially for Ubuntu, and its parent distribution, Debian. See this page (especially this section) for details. This is probably what you want, because it corresponds to the kernel that's likely to actually be installed on your machine. But depending on your specific needs, you might need a different kernel altogether.
Trusting files uploaded by other people for use inside your kernel is extremely insecure. Your best bet is to find these files on another system you installed and copy them yourself, or probably do a reinstallation.