• [gentoo-dev] [PATCH] kernel-install.eclass: run depmod after compressin

    From Andrew Ammerlaan@21:1/5 to All on Fri Aug 9 17:50:01 2024
    (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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to Andrew Ammerlaan on Fri Aug 9 18:20:01 2024
    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


    -----BEGIN PGP SIGNATURE-----

    iQFGBAABCgAwFiEEx2qEUJQJjSjMiybFY5ra4jKeJA4FAma2P5sSHG1nb3JueUBn ZW50b28ub3JnAAoJEGOa2uIyniQO1b8H/0LWjTp0XIT/xplkA1HO/4F6eFeheZNp wb5i+LSw+5ZJzaAW9k9fd0R/wLo1L8zEaIppRc2NW/0SBPno1a+6PD+1eatXNHgS MauEhhx/dOpeiUsMFWQbQSFAyON08z4ysfY/X6pa4XrjoQCt6MQCnv12CAboilAB sD9Oa6OFcdFK98B5m+Vc0BmgNyzX6bCgDeeyuuEe82rXCoEVCHFbUmloTEePW3Gs RJ0cgahredPhT/Dsn9nluNJi4tUcSiP1vfAx4u5RVOzOTdNsLzen5OyCBTAvFUMw /uVQU58t9I6aMlXnn9b4BViFa4FUVCcAgWgLjPMtZ2OX1E2mHL4hGpU=
    =Fycn
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrew Nowa Ammerlaan@21:1/5 to All on Fri Aug 9 19:00:01 2024
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)