# Provided linux kernel and linux-headers

## turner2501

Hi,

  I've been patching and compiling my own kernel on 4 machines for a long while now.  I have a deployment method that makes it efficient and simple.

  However, it happens often that the "distance" between my linux-headers package and the running kernel is great.  I've had some issues compiling and running some software in the past.  I'd like to add self-managed linux-headers to my deployment method... but I need to clarify a few things.

  1) I would need to remove the package entirely and add a line in package.provided.  What line would work?  linux-headers-9999 ??  The rest of the deployment method would be done after a complete and successful gentoo update (emerge -uDN world && emerge --depclean && revdep-rebuild).

  2) I need to `make headers_install` with perhaps envvar INSTALL_HDR_PATH set to "/usr"

  3) Rebuild packages that are built using linux-headers (glibc for sure, but I read alsalib also, since i'm having issues compiling ffmpeg now i guess it's related too?)

  4) Run revdep-rebuild to make sure they're all good.

Would this work?  Is there any recommendations against?  I understand the risk of instability, but it's a risk I'm willing to take, I'd rather call it a responsibility rather than a risk.

Thanks for your input!

Turner

----------

## Hu

I can understand the convenience of out-of-Portage kernel sources, but do you actually need to manage linux-headers externally?  Would it not be sufficient to mask versions of linux-headers that are newer than the kernel you have chosen to run?

----------

## turner2501

Your suggestion would be excellent if that was the problem... but the thing is it's the other way around:  my kernel is always newer than linux-headers and sometimes when it's too far ahead some intense issues arise (similar to issues when linux-headers is not same as when glibc was compiled).

I'm just wondering how valuable linux-headers are if I'm maintaining my own kernel...  It basically means near zero efforts to do the "make headers_install" and then I just have to make sure to recompile glibc.  While this may seem like an inconvenience if done often, I still like the potential stability it could yield (and it would fix the intense problem that happen when they're distanced).

Really, I think I'd need to try it to see how better it can be for me... but i'm wondering how I can "provide" linux-headers to gentoo, so it wont try to reinstall it...

----------

## Hu

What kind of problems have you had related to an old linux-headers?

I generally encourage people to stay away from installing non-package-managed files into /usr.  If your only issue is that Gentoo does not provide linux-headers of a version you find useful, perhaps you could create an overlay ebuild for linux-headers that installs the version you want.  This would give you control over what version is installed and where it obtains its files, but leave the installed files under control of Portage so that you can easily remove them later, upgrade, and protect against file collisions.  It would be up to you whether the overlay ebuild was just a copy of linux-headers adjusted to the version you want (and thus inheriting all the features and quirks of Gentoo's package) or the overlay ebuild could be a simple unpack&&copy operation.

----------

## turner2501

Problems are too various to describe, also I don't really wish to change the topic in that direction.  (I've already had other threads going in various forums a while ago)

The suggestion you gave is really interesting, I see the point you're making with the file collisions, etc...  Also I guess it would take care of removing unneeded files when upgrading, etc...

But there's a lot of difficulty ahead with this though, I'd have to learn overlays, ebuilds, learn how to make emerge use my own ebuild, etc...

Can you help me by pointing the best documentation I can read on these topics so I can build the solution quickly?

Thanks a lot!

----------

## Hu

If you have the time, the Gentoo Development Guide is an excellent reference.  However, it covers much more than you need here, so you would want to pick pieces from it.  See in particular Gentoo Development Guide: Overlay and Gentoo Development Guide: Ebuild File Format.

Since ebuilds are just a specialized dialect of bash, if you can express your installation process as a shell script, it can be converted to an ebuild.  If you have any problems, feel free to post a work-in-progress ebuild or even just a free form bash script that would do what you want.

----------

## turner2501

Thanks Hu for your last reply.

I was able to build a dummy ebuild i called linux-headers-9999.ebuild...

I was able to emerge it in a SLOT="9"

It doesn't do anything at the moment, but I basically setup all ebuild functions and write an elog in all of them, so I see how it does.  Very cool...

I think I'll try to use it more, perhaps replace my deployment scripts by a single versionned ebuild which would be updated along with the rest of the system...

Thanks a lot!

----------

