The two directories are provided by the corresponding packages, which contain the header files for the kernel. Use
dpkg command to find which package provide the directories.
$ dpkg -S /usr/src/linux*
The first directory
/usr/src/linux-headers-X.X.XX-XX comprises header files for multiple architectures, including x86, amd64, powerpc and others, resulting in more number of files and larger size of package.
The other directory
/usr/src/linux-headers-X.X.XX-XX-generic seemed to contain mostly source codes relevant to x86 architecture that is targeted for the local installation.
The corresponding package has hinted in the description, for example:
$ apt-cache show linux-headers-3.16.0-25 | grep -A3 Description-en
Description-en: Header files related to Linux kernel version 3.16.0
This package provides kernel header files for version 3.16.0, for sites
that want the latest kernel headers. Please read
/usr/share/doc/linux-lts-utopic-headers-3.16.0-25/debian.README.gz for details
As far as I am aware, both directories contain only source codes and not binaries. And the difference between both is mainly the target architecture of source codes.
Related: What does a kernel source tree contain? Is this related to Linux kernel headers?
Extended answer (2015.07.30)
since both store
x86 related code, what is the difference btwn the
x86 code in the two directories? – Richard Jul 29 '15 at 19:11
Most of directories and files contained in
/usr/src/linux-headers-X.X.XX-XX-generic are symbolic links, which pointing to actual directories and files in
/usr/src/linux-headers-X.X.XX-XX. In other words,
arch/x86 found in those two directories are just the difference of actual and symbolic links, with some leftover files of
asm headers in
Between those two packages, one may notice another major difference is the presence of
generated directories in
At my best understanding, I would think that
*-generic directory holds the necessary header files for configuring and compiling modules relevant to
x86 architecture, without making accidential changes to the source directory of
Above all, the two directories are probably the "clean" approach to packaging and compiling the packages on respective platforms. Although, I am not in position to clarify this matter.