Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need two files from the Linux kernel's source code, which I deleted by mistake:

  1. Option.c
  2. 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.)

share|improve this question

closed as too localized by BigSack, jokerdino, izx, John S Gruber, Amith KK Aug 18 '12 at 6:42

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
What location did you delete them from? Are you getting an error message? –  hexafraction Aug 14 '12 at 12:37
add comment

2 Answers 2

up vote 5 down vote accepted

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:

sudo rm -rf /usr/src/linux-source-3.2.0/linux-source-3.2.0
sudo apt-get update
sudo apt-get --reinstall install linux-source-3.2.0
cd /usr/src/linux-source-3.2.0
sudo tar xvjf linux-source-3.2.0.tar.bz2

(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.)

  • You might also want to have the package 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 reinstalling linux-source with the above method will not replace missing files, as linux-source is just a metapackage that always depends on the most recent versioned linux-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:

find /usr/src/linux-source-3.2.0/linux-source-3.2.0 -iname Option.c -or -iname usb-wwan.h

Please note that I've used the -iname option, which performs case-insensitive matching. (Option.c, with a capital O, is a somewhat unlikely name for a source file in the Linux kernel's sources.)

The output will look like:

/usr/src/linux-source-3.2.0/linux-source-3.2.0/drivers/usb/serial/option.c
/usr/src/linux-source-3.2.0/linux-source-3.2.0/drivers/usb/serial/usb-wwan.h

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.

share|improve this answer
add comment

Note: This answer most particularly addresses an earlier version of the question. This answer is still correct, but the question was made more general, so that it no longer insists on getting the file directly from other users.

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.

share|improve this answer
    
Can you please give me these two files. I am in desperate need of them. Please!! –  BigSack Aug 14 '12 at 10:26
    
Though i understand your concern. –  BigSack Aug 14 '12 at 10:26
2  
Kernel source code is available online. Go ahead and find them yourself - kernel.org –  donatello Aug 14 '12 at 10:29
    
I can't download theme, i am in need of them. –  BigSack Aug 14 '12 at 10:31
    
@BigGenius If you are in need of them, you would download them. Why can't you use official sources? –  hexafraction Aug 14 '12 at 12:36
show 3 more comments

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