Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Purpose and proper care of /lib/modules/`uname -r`/build
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
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20048

PostPosted: Thu Jun 21, 2018 3:18 am    Post subject: Purpose and proper care of /lib/modules/`uname -r`/build Reply with quote

I've made an ebuild to compile and install gentoo-sources kernels. It works through src_install, which brings me to this post.

I did find the kernel documentation in kbuild/modules.txt, but that doesn't really explain much (or I didn't see it).

For older uninstalled kernels, I haven't removed anything under /lib/modules, so the links for {build,source} -> /usr/src/linux-... are obviously broken.

With the ebuild, ${D}lib/modules/`uname -r`/build is a link to where portage does the compiling, and source is still a link to /usr/src/linux-...

My question is, once emerge is complete, the temporary directory is gone, and the build link is dead from the start. Is there any value to having the dead build link? Does having it dead in the live file system present any problems?

From the modules.txt file, it sounds like the links are only needed for compiling modules. But as the build directory is not saved, the entire kernel would need to be rebuilt, so the links don't seem useful once installed.

Thanks.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Thu Jun 21, 2018 8:39 pm    Post subject: Re: Purpose and proper care of /lib/modules/`uname -r`/build Reply with quote

pjp wrote:
My question is, once emerge is complete, the temporary directory is gone, and the build link is dead from the start. Is there any value to having the dead build link? Does having it dead in the live file system present any problems?

pjp ... you omit it from pkg_install() ... it's not needed, anything requiring source will depend on sys-kernel/*-sources. This is the case for bindists, they don't install modules/*/{build,source} symlinks ... and any packaged modules are tied to the kernel version dependency.

pjp wrote:
From the modules.txt file, it sounds like the links are only needed for compiling modules. But as the build directory is not saved, the entire kernel would need to be rebuilt, so the links don't seem useful once installed.

Your problem would be if your kernel-bin package is out of sync with *-sources, and if you were building something which expects to install to ${EROOT}lib/modules/{version} ... so something like sys-kernel/spl ... I expect this would need the very same version so this wouldn't fail.

HTH & best ... khay
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20048

PostPosted: Fri Jun 22, 2018 4:37 am    Post subject: Re: Purpose and proper care of /lib/modules/`uname -r`/build Reply with quote

khayyam wrote:
pjp wrote:
My question is, once emerge is complete, the temporary directory is gone, and the build link is dead from the start. Is there any value to having the dead build link? Does having it dead in the live file system present any problems?

pjp ... you omit it from pkg_install() ... it's not needed, anything requiring source will depend on sys-kernel/*-sources. This is the case for bindists, they don't install modules/*/{build,source} symlinks ... and any packaged modules are tied to the kernel version dependency.
Thanks, that addresses the immediate concern. I'll add researching how to bindists handle the kernel version dependency.

khayyam wrote:
pjp wrote:
From the modules.txt file, it sounds like the links are only needed for compiling modules. But as the build directory is not saved, the entire kernel would need to be rebuilt, so the links don't seem useful once installed.

Your problem would be if your kernel-bin package is out of sync with *-sources, and if you were building something which expects to install to ${EROOT}lib/modules/{version} ... so something like sys-kernel/spl ... I expect this would need the very same version so this wouldn't fail.

HTH & best ... khay
Thanks again. I knew a "good" ebuild wasn't going to be that easy :)
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Fri Jun 22, 2018 10:14 am    Post subject: Re: Purpose and proper care of /lib/modules/`uname -r`/build Reply with quote

pjp wrote:
so the links don't seem useful once installed.Thanks.

their utility is pointing the location of sources of the kernel that build these modules, you are assuming everyone use /usr/src/linux* scheme, where you could just build a kernel from whatever directory you like.
and the only reliable way to find where could be kernel sources of a module is then checking the path /lib/modules/kversion/source is pointing to (or unreliably assuming everyone use /usr/src/linux-kversion as source holder).

so the links are useful, because it's better to readlink /lib/modules/$(uname -r)/source than (wrongly) assuming /usr/src/linux-$(uname -r) hold them.

you might argue, but we knows kernel source location as all kernels handle by portage use /usr/src as sources holder
but not all gentoo users are using a kernel handle by portage, and they might also not use the "kernel sources should be in /usr/src" path rule.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20048

PostPosted: Fri Jun 22, 2018 3:05 pm    Post subject: Re: Purpose and proper care of /lib/modules/`uname -r`/build Reply with quote

krinn wrote:
...
I wasn't assuming /usr/src/linux, but your comments seem to reinforce my perception that the links are a feature for convenience (for lack of a better description).
_________________
Quis separabit? Quo animo?
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