public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] kernel-install.eclass: run depmod after compressing modules
@ 2024-08-09 15:49 Andrew Ammerlaan
  2024-08-09 16:11 ` Michał Górny
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Ammerlaan @ 2024-08-09 15:49 UTC (permalink / raw
  To: gentoo-dev; +Cc: Andrew Ammerlaan

(de)compressing modules changes the path of the module files so we need to
run depmod to ensure that tools such as modprobe/modinfo work.

Note that depmod is often, but *not* always, run by sys-kernel/installkernel.
Systemd installs a hook to do this, but there is no equivalent on openrc
systems. So instead just ensure that the tree of modules we install is
consistent here in the eclass.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
---
 eclass/kernel-install.eclass | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index 496e258815d2..930640188c26 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -796,6 +796,9 @@ kernel-install_compress_modules() {
 		find "${ED}/lib/modules/${KV_FULL}" -name '*.ko' -print0 |
 			xargs -0 -P "$(makeopts_jobs)" -n 128 "${compress[@]}"
 		assert "Compressing kernel modules failed"
+
+		# Module paths have changed, run depmod
+		depmod --all --basedir "${ED}" ${KV_FULL} || die
 	fi
 }
 
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] [PATCH] kernel-install.eclass: run depmod after compressing modules
  2024-08-09 15:49 [gentoo-dev] [PATCH] kernel-install.eclass: run depmod after compressing modules Andrew Ammerlaan
@ 2024-08-09 16:11 ` Michał Górny
  2024-08-09 16:50   ` Andrew Nowa Ammerlaan
  0 siblings, 1 reply; 3+ messages in thread
From: Michał Górny @ 2024-08-09 16:11 UTC (permalink / raw
  To: gentoo-dev; +Cc: Andrew Ammerlaan

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

On Fri, 2024-08-09 at 17:49 +0200, Andrew Ammerlaan wrote:
> (de)compressing modules changes the path of the module files so we need to
> run depmod to ensure that tools such as modprobe/modinfo work.
> 
> Note that depmod is often, but *not* always, run by sys-kernel/installkernel.
> Systemd installs a hook to do this, but there is no equivalent on openrc
> systems. So instead just ensure that the tree of modules we install is
> consistent here in the eclass.
> 
> Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
> ---
>  eclass/kernel-install.eclass | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
> index 496e258815d2..930640188c26 100644
> --- a/eclass/kernel-install.eclass
> +++ b/eclass/kernel-install.eclass
> @@ -796,6 +796,9 @@ kernel-install_compress_modules() {
>  		find "${ED}/lib/modules/${KV_FULL}" -name '*.ko' -print0 |
>  			xargs -0 -P "$(makeopts_jobs)" -n 128 "${compress[@]}"
>  		assert "Compressing kernel modules failed"
> +
> +		# Module paths have changed, run depmod
> +		depmod --all --basedir "${ED}" ${KV_FULL} || die
>  	fi
>  }
>  

Are you actually supposed to run it on ED and not EROOT?  Won't that
cause file collisions (even if we circumvent them via CONFIG_PROTECT).

-- 
Best regards,
Michał Górny


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] [PATCH] kernel-install.eclass: run depmod after compressing modules
  2024-08-09 16:11 ` Michał Górny
@ 2024-08-09 16:50   ` Andrew Nowa Ammerlaan
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Nowa Ammerlaan @ 2024-08-09 16:50 UTC (permalink / raw
  To: gentoo-dev

On 09/08/2024 18:11, Michał Górny wrote:
> On Fri, 2024-08-09 at 17:49 +0200, Andrew Ammerlaan wrote:
>> (de)compressing modules changes the path of the module files so we need to
>> run depmod to ensure that tools such as modprobe/modinfo work.
>>
>> Note that depmod is often, but *not* always, run by sys-kernel/installkernel.
>> Systemd installs a hook to do this, but there is no equivalent on openrc
>> systems. So instead just ensure that the tree of modules we install is
>> consistent here in the eclass.
>>
>> Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
>> ---
>>   eclass/kernel-install.eclass | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
>> index 496e258815d2..930640188c26 100644
>> --- a/eclass/kernel-install.eclass
>> +++ b/eclass/kernel-install.eclass
>> @@ -796,6 +796,9 @@ kernel-install_compress_modules() {
>>   		find "${ED}/lib/modules/${KV_FULL}" -name '*.ko' -print0 |
>>   			xargs -0 -P "$(makeopts_jobs)" -n 128 "${compress[@]}"
>>   		assert "Compressing kernel modules failed"
>> +
>> +		# Module paths have changed, run depmod
>> +		depmod --all --basedir "${ED}" ${KV_FULL} || die
>>   	fi
>>   }
>>   
> 
> Are you actually supposed to run it on ED and not EROOT?  

Either works, but doing it in ED ensures that the 
gentoo-kernel-bin[modules-compress] install image is the same as the 
gentoo-kernel[modules-compress] install image.

> Won't that
> cause file collisions (even if we circumvent them via CONFIG_PROTECT).

No, it does not install any files that we are not installing anyway, it 
just updates them.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-09 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09 15:49 [gentoo-dev] [PATCH] kernel-install.eclass: run depmod after compressing modules Andrew Ammerlaan
2024-08-09 16:11 ` Michał Górny
2024-08-09 16:50   ` Andrew Nowa Ammerlaan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox