Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Installing headers manually
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Sun Aug 28, 2011 11:59 am    Post subject: Installing headers manually Reply with quote

The Linux-headers package is outdated, and always is; I was wondering about moving to linux-3.0.3 but with the right headers (even though I know they are backwards compatible), thus make headers_install is the right idea, but make headers_install doesn't work if linux-headers is not installed (it asks for limits.h for starters). This is putting in a lot of doubt.

So question is how do I install this package manually?
_________________
My blog
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44226
Location: 56N 3W

PostPosted: Sun Aug 28, 2011 12:13 pm    Post subject: Reply with quote

dE_logics,

You actually have multiple copies of linux-headers installed

The linux-headers package is a stable set of headers for the rest of the system to use, apart from the few things that need to build against the kernel of your choice. Such packages find the headers by following the /usr/src/linux symlink.

Each kernel source tree comes with its own set of linux-headers. If you really want to use kernel provided headers system wide, (you really don't want to do that) make yourself a symlink.

When it breaks, sympathy will be minimal.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Sun Aug 28, 2011 1:37 pm    Post subject: Reply with quote

You mean -

ln -s /usr/src/linux/include /usr/include/linux?
_________________
My blog
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44226
Location: 56N 3W

PostPosted: Sun Aug 28, 2011 1:47 pm    Post subject: Reply with quote

dE_logics,

Something like that ... but its a really bad idea ...
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Mon Aug 29, 2011 8:41 am    Post subject: Reply with quote

Looks like there're package conflicts. From /usr/src/linux/include, some directories already exist in /usr/include which belong to glibc.
_________________
My blog
Back to top
View user's profile Send private message
Bircoph
Developer
Developer


Joined: 27 Jun 2008
Posts: 261
Location: Moscow

PostPosted: Mon Aug 29, 2011 10:19 am    Post subject: Reply with quote

NeddySeagoon wrote:

Something like that ... but its a really bad idea ...

Hmm, can you tell us why?

About half a year ago I had some problems with external module with gentoo linux-headers.
I made make headers_install and copied from /usr/src/linux/usr/include those directories which
are in the linux-headers package.

I have no problems on three different systems so far.
And yes, I do not use gentoo kernel, only vanilla since I had enough with hardly traced in
gentoo-sources. I do not really need any of gentoo patches and am absolutely happy with vanilla
kernel and vanilla sources as described above.
_________________
Per aspera ad astra!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44226
Location: 56N 3W

PostPosted: Mon Aug 29, 2011 12:22 pm    Post subject: Reply with quote

Bircoph,

The kernel-headers package is updated with changes in the kernel that are needed by other things, in particular glibc.
If you want to use live headers, you should rebuild things that build against the headers.
Its a verybadthing if glibc breaks because of a problem with the headers used to build it.

External kernel modules should not build against the kernel-headers package.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Bircoph
Developer
Developer


Joined: 27 Jun 2008
Posts: 261
Location: Moscow

PostPosted: Mon Aug 29, 2011 12:28 pm    Post subject: Reply with quote

NeddySeagoon,

so is it normal to use 2.6.39 headers with the 3.0 kernel? I doubt so. I always thought it is a bad idea to use old headers with new kernel or vice versa and they should be as close as possible. I had problems with subversion (bug 263497) due to too large difference between installed kernel headers and current kernel, though headers were newer than the kernel.
_________________
Per aspera ad astra!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 44226
Location: 56N 3W

PostPosted: Mon Aug 29, 2011 1:59 pm    Post subject: Reply with quote

Bircoph,

If it wasn't for the 20th annaversary release of the kernel, 3.0 would have been 2.6.40.

The kernel-headers is always slightly behind the kernel of the day. Its fine to use a 2.6 kernel-headers with a 3.0 kernel.
You can get too big a gap between your kernel and kernel-headers but if you keep both up to date, its rare.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Bircoph
Developer
Developer


Joined: 27 Jun 2008
Posts: 261
Location: Moscow

PostPosted: Mon Aug 29, 2011 9:09 pm    Post subject: Reply with quote

NeddySeagoon,

Quote:

If it wasn't for the 20th annaversary release of the kernel, 3.0 would have been 2.6.40.

Yes, I understand that well enough, just put it as the most recent example.

Quote:

The kernel-headers is always slightly behind the kernel of the day. Its fine to use a 2.6 kernel-headers with a 3.0 kernel.
You can get too big a gap between your kernel and kernel-headers but if you keep both up to date, its rare.

Usually I update a specific system once in two or three months (with an exception for critical security updates), and kernel is updated in the first place (together with headers), than I rebuild modules and update system set — the latter includes glibc update, it will be bumped in this period. Afterwards the world update follows. It should be no issues with kernel headers in this case and, perhaps, it gives glibc the ability to taste the most recent kernel yummy.
_________________
Per aspera ad astra!
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 14400

PostPosted: Mon Aug 29, 2011 11:54 pm    Post subject: Reply with quote

New headers with an old kernel may cause a problem if a program using those headers decides to build only the code path that requires a new kernel. Old headers with a new kernel should work in typical cases. How else could you update to a newer kernel on an installed system?
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Tue Aug 30, 2011 2:42 am    Post subject: Reply with quote

Bircoph wrote:
NeddySeagoon wrote:

Something like that ... but its a really bad idea ...

Hmm, can you tell us why?

About half a year ago I had some problems with external module with gentoo linux-headers.
I made make headers_install and copied from /usr/src/linux/usr/include those directories which
are in the linux-headers package.

I have no problems on three different systems so far.
And yes, I do not use gentoo kernel, only vanilla since I had enough with hardly traced in
gentoo-sources. I do not really need any of gentoo patches and am absolutely happy with vanilla
kernel and vanilla sources as described above.


You overwrote packages belonging to glibc?
_________________
My blog
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5414

PostPosted: Tue Aug 30, 2011 4:34 am    Post subject: Reply with quote

small question, if each kernel has it own linux-headers, why there is a need to a separate linux-headers package?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Bircoph
Developer
Developer


Joined: 27 Jun 2008
Posts: 261
Location: Moscow

PostPosted: Tue Aug 30, 2011 5:50 am    Post subject: Reply with quote

dE_logics wrote:

You overwrote packages belonging to glibc?

I overwrote nothing. The only difference with standard system is linux-headers in package.provided. I unmerged a portage's package and support it manually.

DaggyStyle wrote:

small question, if each kernel has it own linux-headers, why there is a need to a separate linux-headers package?

Because you can install at /usr/include/ only one set of kernel headers at a time.
_________________
Per aspera ad astra!
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6194

PostPosted: Tue Aug 30, 2011 11:46 am    Post subject: Reply with quote

Well, actually headers in linux-headers are stripped from kernel specific stuff and have a few fixes applied, so that the cleanup doesn't break anything.
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5414

PostPosted: Tue Aug 30, 2011 12:05 pm    Post subject: Reply with quote

so why not link to latest headers?
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
Back to top
View user's profile Send private message
Bircoph
Developer
Developer


Joined: 27 Jun 2008
Posts: 261
Location: Moscow

PostPosted: Tue Aug 30, 2011 12:46 pm    Post subject: Reply with quote

VoidMage wrote:
Well, actually headers in linux-headers are stripped from kernel specific stuff and have a few fixes applied, so that the cleanup doesn't break anything.

Isn't make headers_install supposed to prepare tree of headers ready to setup in the system? If it is not, this should be reported as a bug to kernel devs.

Well, I know that Gentoo ships some kernel headers outside of the kernel, e.g. /usr/include/drm. That's Gentoo problem. But well, I install/link only those headers, which are in the linux-headers top directory list.
_________________
Per aspera ad astra!
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Tue Aug 30, 2011 2:49 pm    Post subject: Reply with quote

Bircoph wrote:
dE_logics wrote:

You overwrote packages belonging to glibc?

I overwrote nothing. The only difference with standard system is linux-headers in package.provided. I unmerged a portage's package and support it manually.


Code:
equery files glibc | grep '/usr/include/scsi'
/usr/include/scsi
/usr/include/scsi/scsi.h
/usr/include/scsi/scsi_ioctl.h
/usr/include/scsi/sg.h


Code:
cd /usr/src/linux/include/scsi/
ls -1
Kbuild
fc
fc_encode.h
fc_frame.h
iscsi_if.h
iscsi_proto.h
libfc.h
libfcoe.h
libiscsi.h
libiscsi_tcp.h
libsas.h
libsrp.h
osd_attributes.h
osd_initiator.h
osd_protocol.h
osd_sec.h
osd_sense.h
osd_types.h
sas.h
sas_ata.h
scsi.h
scsi_bsg_fc.h
scsi_cmnd.h
scsi_dbg.h
scsi_device.h
scsi_devinfo.h
scsi_dh.h
scsi_driver.h
scsi_eh.h
scsi_host.h
scsi_ioctl.h
scsi_netlink.h
scsi_netlink_fc.h
scsi_scan.h
scsi_tcq.h
scsi_tgt.h
scsi_tgt_if.h
scsi_transport.h
scsi_transport_fc.h
scsi_transport_iscsi.h
scsi_transport_sas.h
scsi_transport_spi.h
scsi_transport_srp.h
scsicam.h
sg.h
srp.h


There're a few more folders.
_________________
My blog
Back to top
View user's profile Send private message
Bircoph
Developer
Developer


Joined: 27 Jun 2008
Posts: 261
Location: Moscow

PostPosted: Tue Aug 30, 2011 4:18 pm    Post subject: Reply with quote

dE_logics wrote:

Code:
equery files glibc | grep '/usr/include/scsi'
/usr/include/scsi
/usr/include/scsi/scsi.h
/usr/include/scsi/scsi_ioctl.h
/usr/include/scsi/sg.h

[...]
There're a few more folders.

He-he, you missed what I wrote earlier:

Bircoph wrote:

I made make headers_install and copied from /usr/src/linux/usr/include those directories which
are in the linux-headers package.

I copy only those dirs, which are present in Gentoo shipped linux-headers, there is no scsi dir there, thus no collisions.
_________________
Per aspera ad astra!
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9236
Location: beyond the rim

PostPosted: Wed Aug 31, 2011 10:14 am    Post subject: Reply with quote

http://linuxmafia.com/faq/Kernel/usr-src-linux-symlink.html

I think that guy knows a bit about kernel headers :twisted:
Back to top
View user's profile Send private message
Spidey
Apprentice
Apprentice


Joined: 07 Sep 2006
Posts: 269

PostPosted: Wed Aug 31, 2011 4:37 pm    Post subject: Reply with quote

That's from 2000, and I guess gentoo uses linux-headers exactly to avoid the related problem.
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Wed Aug 31, 2011 4:45 pm    Post subject: Reply with quote

What does make headers_install does? Overwrite the old/new headers?
_________________
My blog
Back to top
View user's profile Send private message
Bircoph
Developer
Developer


Joined: 27 Jun 2008
Posts: 261
Location: Moscow

PostPosted: Wed Aug 31, 2011 5:22 pm    Post subject: Reply with quote

Genone wrote:
http://linuxmafia.com/faq/Kernel/usr-src-linux-symlink.html

I think that guy knows a bit about kernel headers :twisted:

Seconded.
Quote:

In short, the only people who should update their /usr/include/linux tree are the people who actually make library releases and compile their own glibc, because, if they want to take advantage of new kernel features, they need those new definitions.

That's exactly what happens in Gentoo when you update your kernel before glibc update.

dE_logics wrote:

What does make headers_install does? Overwrite the old/new headers?

By default it installs to the $builddir/usr/include, e.g. /usr/src/linux-<ver>/usr/include. Than you may link whatever you want. It overwrites nothing. Of course, you may change install path, but that's not a default behaviour.
_________________
Per aspera ad astra!
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Thu Sep 01, 2011 10:53 am    Post subject: Reply with quote

Got it. Lets see how the packages compile.
_________________
My blog
Back to top
View user's profile Send private message
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Wed Jan 31, 2018 6:42 pm    Post subject: Reply with quote

How do we know if the headers are older than the current kernel?

  • linux-headers-4.13
  • gentoo-sources-4.9.76-r1

-- edition --

My explanation may be a bit confused.

The package version of the linux headers is the version of a linux kernel. Thus, my system uses newer kernel headers than my current kernel.

The kernel headers are provided through the kernel sources. Distributions choose to distribute userspace kernel headers (note) associated to a kernel version.
Developers of the Linux kernel do not directly provide a set of exported headers through an archive (use make headers_install).

Note:
The linux-headers package seems to contain internal headers (cf. StackOverflow), probably for the compilation of kernel modules.

See also:


helecho
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum