Here is an example that will explain better:
I have a selected the audio driver from the picture and i would like to browse through its source. How do i get to the path of the source files from here?
configurationkernellinux-kernelsource
Here is an example that will explain better:
I have a selected the audio driver from the picture and i would like to browse through its source. How do i get to the path of the source files from here?
EDIT: Use the -bc
switch of rpmbuild
:
-bc Do the "%build" stage from the spec file (after doing the %prep stage).
This generally involves the equivalent of a "make".
... since -bp
will just unpack the "sources" related to the .rpm, but will not "make" them - which involves applying the specific SUSE patches... My attempt to use rpmbuild -bp
is left below for reference - not that it, on its own, doesn't even extract the linux sources. Below is the log of using rpmbuild -bc
, which both unpacks vanilla sources and applies patches to them (which can be seen from the terminal log, which has been left out here; note also that the patched sources will be in "BUILDROOT
"):
> mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
> echo "%_topdir $(pwd)/rpmbuild" > ~/.rpmmacros
> rpm -i ../kernel-source-2.6.31.14-0.8.1.src.rpm
> ls rpmbuild/*
rpmbuild/BUILD:
rpmbuild/RPMS:
rpmbuild/SOURCES:
arch-symbols kernel-source.rpmlintrc patches.kernel.org.tar.bz2
built-in-where kernel-source.spec.in patches.rpmify.tar.bz2
...
> cd rpmbuild/SPECS
> rm -rf ../BUILD/*
> rpmbuild -bc --target=`uname -m` kernel-source.spec 2>&1
> ls ../BUILDROOT/
kernel-source-2.6.31.14-0.8.1.i386
> ls ../BUILD
kernel-source-2.6.31.14
> ls -la ../BUILDROOT/kernel-source-2.6.31.14-0.8.1.i386/usr/src/
total 16
drwxr-xr-x 4 linux users 4096 2011-11-11 20:55 .
drwxr-xr-x 3 linux users 4096 2011-11-11 20:54 ..
lrwxrwxrwx 1 linux users 5 2011-11-11 20:54 linux -> linux
drwxr-xr-x 24 linux users 4096 2011-11-11 20:56 linux-2.6.31.14-0.8.1
drwxr-xr-x 23 linux users 4096 2011-11-11 20:55 linux-2.6.31.14-0.8.1-vanilla
> ls ../BUILDROOT/kernel-source-2.6.31.14-0.8.1.i386/usr/src/linux-2.6.31.14-0.8.1
arch crypto fs Kbuild MAINTAINERS README security virt
block Documentation include kdb Makefile REPORTING-BUGS sound
....
Ok, this turned out to be quite convoluted (given I still don't know the proper way to do this), but the post How to compile custom kernel on Centos/Xen or optimize CS:S server showed the way. Following that post, I did this ( still in the kernel-source-2.6.31.14/
directory as in the OP ):
> mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
> echo "%_topdir $(pwd)/rpmbuild" > ~/.rpmmacros
> rpm -i ../kernel-source-2.6.31.14-0.8.1.src.rpm
> ls rpmbuild/*
rpmbuild/BUILD:
rpmbuild/RPMS:
rpmbuild/SOURCES:
arch-symbols kernel-source.rpmlintrc patches.kernel.org.tar.bz2
built-in-where kernel-source.spec.in patches.rpmify.tar.bz2
...
> cd rpmbuild/SPECS
> rpmbuild -bp --target=`uname -m` kernel-source.spec
Building target platforms: i686
Building for target i686
error: Failed build dependencies:
fdupes is needed by kernel-source-2.6.31.14-0.8.1.src
> sudo zypper install fdupes
> rpmbuild -bp --target=`uname -m` kernel-source.spec
Building target platforms: i686
Building for target i686
Executing(%prep): /bin/bash -e /var/tmp/rpm-tmp.4uWZo1
+ umask 022
+ cd /path/to/kernel-source-2.6.31.14/rpmbuild/BUILD
+ '[' -e /path/to/kernel-source-2.6.31.14/rpmbuild/SOURCES/linux-2.6.31.tar.bz2 ']'
+ echo 'Symbol(s): '
Symbol(s):
+ cd /path/to/kernel-source-2.6.31.14/rpmbuild/BUILD
+ rm -rf kernel-source-2.6.31.14
+ /bin/mkdir -p kernel-source-2.6.31.14
+ cd kernel-source-2.6.31.14
+ /usr/bin/bzip2 -dc /path/to/kernel-source-2.6.31.14/rpmbuild/SOURCES/config.tar.bz2
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ /usr/bin/bzip2 -dc /path/to/kernel-source-2.6.31.14/rpmbuild/SOURCES/patches.arch.tar.bz2
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ /usr/bin/bzip2 -dc /path/to/kernel-source-2.6.31.14/rpmbuild/SOURCES/patches.drivers.tar.bz2
+ /bin/tar -xf -
+ STATUS=0
... [snip] ...
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
> ls ../BUILD/kernel-source-2.6.31.14/
config patches.arch patches.kabi patches.rt patches.trace
patches.addon patches.drivers patches.kernel.org patches.staging patches.xen
patches.apparmor patches.fixes patches.rpmify patches.suse
....
# ?? no linux sources?
... and, surprisingly, after all this, I still couldn't see any linux sources? However, I did notice that -e /path/to/kernel-source-2.6.31.14/rpmbuild/SOURCES/linux-2.6.31.tar.bz2
in the script above; and guessing that the linux*.tar.bz2 probably didn't get unpacked (there was nothing after the Symbol(s):
line in the original output for the snippet above); I basically repeated what the rpmbuild
tmp script did:
# done previously
> # cd ./rpmbuild/SPECS/
> # rpmbuild -bp --target=`uname -m` kernel-source.spec 2>&1
> cd ../..
> cd ./rpmbuild/BUILD/kernel-source-2.6.31.14/
> /usr/bin/bzip2 -dc ../../../rpmbuild/SOURCES/linux-2.6.31.tar.bz2 | /bin/tar -xf -
> ls # linux-2.6.31 directory gets created
> ls linux-2.6.31/
arch crypto fs Kbuild Makefile REPORTING-BUGS sound
block Documentation include kernel mm samples tools
...
Well.. finally, those are linux source files I can recognize :)
However, those are still, seemingly, the "vanilla" 'unpatched' sources - I guess there is a command that does all this along with patching, but I'm at loss as to what it is... Anyways, hope this may also help others a bit - cheers!
Best way to get an idea is taking look at the Slackware build scripts (located in sources/*/*
in the distribution trees). There are also some additional Slackware package repositories, which contain lots of packages not found in Slackware proper, so you might not necessarily need to build everything yourself. Two of the well-known are Eric Hameleers' slackbuilds repo and slackbuilds.
That said, the install part of the application build system usually puts these files (headers) in the appropriate place, i.e. /usr/include
or /usr/local/include
, depending whether you are installing into /usr
or /usr/local
(the latter being usually default).
As for the sources - generally speaking you should not need anything else than headers once you compile the application (apart from any header files you need when you want to compile another piece of code against it). Unless you want to actually develop the software, you discard the sources right after compilation. And if you want to develop you usually keep a separate tree somewhere under version control and do not build your packages from this devel tree, rather from a more stable one.
Last but not the least, you really want to make a package first and only install that (i.e. not running make install
as root directly), since it makes system maintenance easier (and you don't have to keep the sources to be able to run make uninstall
).
Best Answer
You have to use
grep -r CONFIG_SND_SOC_MXS_SGTL5000
.Each of these config options just represents a
#define
macro. Many of them don't belong to a single file but instead are checked in multiple source files.CONFIG_64BIT
for example appears in around 1k source code files.