3

I want to locate the kernel's signal.c source code on my machine, to study the differences (if exist) between what I have and this source code. I tried following this post suggestion, but didn't get far.

I guess I need more specific instructions. I'm working with ubuntu 14.04, x86_64, linux-source-3.13.0 (last one is an output from apt-cache search linux-source).

1

If you followed the instructions, you have installed a kernel source package, named linux-source-3.13.0, e.g., by

sudo apt-get install linux-source-3.13.0

or

sudo apt-get install linux-source

which installs a virtual package that installs the versioned package as a dependency.

Having done that, you can find the file you were looking for (using the package name):

dpkg -L linux-source-3.13.0 |grep -F signal.c

and get the pathname(s) of any files in that package named "signal.c"

If the package was actually a tarball of the sources, you would have to extract those files, e.g., using tar. In that case, dpkg -L linux-source would only list the tarball (and the grep would return nothing).

For the case of a tarball, you could do this:

tar tvf $(dpkg -L linux-source-3.13.0) |grep -F signal.c

if it contained only one file. But supposing you had something like

/usr
/usr/src
/usr/src/linux-patch-3.13-rt.patch.bz2
/usr/src/linux-source-3.13.tar.bz2
/usr/share
/usr/share/doc
/usr/share/doc/linux-source-3.13
/usr/share/doc/linux-source-3.13/copyright
/usr/share/doc/linux-source-3.13/changelog.Debian.gz
/usr/share/doc/linux-source-3.13/README.Debian

then the file you are looking for would be in the "tar.bz2" file, so...

tar tvf $(dpkg -L linux-source-3.13.0|grep -F .tar.bz2) |grep -F signal.c

would show the pathnames within that tarball for "signal.c"

Further reading:

| improve this answer | |
  • Am I supposed to replace linux-source with something else? I get the output: package 'linux-source' is not installed. I tried replacing it with linux-image-extra-3.19.0-65-generic, without results. – HelterSkelter Jul 31 '16 at 18:05
  • How can I determine if the package need to be extracted? – HelterSkelter Jul 31 '16 at 18:06
  • I'd start with "dpkg -L linux-source |less" and see what it has in it. – Thomas Dickey Jul 31 '16 at 18:08
  • Once again, I got: dpkg-query: package 'linux-source' is not installed – HelterSkelter Jul 31 '16 at 18:09
  • Sounds like you're looking for this command: sudo apt-get source linux-image-$(uname -r) – Chef Pharaoh Aug 1 '16 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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